From: Evan You Date: Mon, 9 Aug 2021 20:22:20 +0000 (-0400) Subject: fix(compiler-sfc): fix import usage check for last expression X-Git-Tag: v3.2.1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e1682f060883ee11e802834adb273159d8e84cc;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-sfc): fix import usage check for last expression --- diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index 85aa31337e..6c76e5fe75 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -206,7 +206,7 @@ return { x } exports[`SFC compile `) assertCode(content) @@ -231,7 +232,7 @@ defineExpose({ foo: 123 }) // y: should not be matched by {{ yy }} or 'y' in binding exps // x$y: #4274 should escape special chars when creating Regex expect(content).toMatch( - `return { fooBar, FooBaz, FooQux, vMyDir, x, z, x$y }` + `return { fooBar, FooBaz, FooQux, vMyDir, x, z, x$y, Last }` ) }) }) diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 89a33f2ecc..9a558f25f8 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -2220,6 +2220,7 @@ function resolveTemplateUsageCheckString(sfc: SFCDescriptor) { ] }) + code += ';' templateUsageCheckCache.set(content, code) return code }