From: Evan You Date: Thu, 9 Sep 2021 16:28:59 +0000 (-0400) Subject: fix(compiler-sfc): properly analyze destructured bindings with dynamic keys X-Git-Tag: v3.2.12~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6e5f82d8ea5fe55432d0277e88300045eca4237;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-sfc): properly analyze destructured bindings with dynamic keys fix #4540 --- diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index 54591d402b..29bfc58cdd 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -96,6 +96,19 @@ export default /*#__PURE__*/ Object.assign(__default__, { })" `; +exports[`SFC compile + `) + expect(content).toMatch('return { foo, bar, baz, y, z }') + expect(bindings).toStrictEqual({ + foo: BindingTypes.SETUP_MAYBE_REF, + bar: BindingTypes.SETUP_MAYBE_REF, + baz: BindingTypes.SETUP_MAYBE_REF, + y: BindingTypes.SETUP_MAYBE_REF, + z: BindingTypes.SETUP_MAYBE_REF + }) + assertCode(content) + }) + test('defineProps()', () => { const { content, bindings } = compile(`