From: 三咲智子 Kevin Deng Date: Thu, 18 May 2023 03:09:40 +0000 (+0800) Subject: fix(compiler-sfc): don't hoist regexp literial (#8300) X-Git-Tag: v3.3.3~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ec73a3aea7a52e9479f107ae5737761166ddae6;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-sfc): don't hoist regexp literial (#8300) --- diff --git a/packages/compiler-sfc/__tests__/compileScript/__snapshots__/hoistStatic.spec.ts.snap b/packages/compiler-sfc/__tests__/compileScript/__snapshots__/hoistStatic.spec.ts.snap index 3b94955f2d..307b3e212f 100644 --- a/packages/compiler-sfc/__tests__/compileScript/__snapshots__/hoistStatic.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/compileScript/__snapshots__/hoistStatic.spec.ts.snap @@ -37,7 +37,6 @@ exports[`sfc hoist static > should hoist literal value 1`] = ` const nil = null const bigint = 100n const template = \`str\` - const regex = /.*/g export default { setup(__props) { @@ -124,6 +123,8 @@ exports[`sfc hoist static > should not hoist a variable 1`] = ` let KEY1 = 'default value' var KEY2 = 123 + const regex = /.*/g + const undef = undefined return () => {} } diff --git a/packages/compiler-sfc/__tests__/compileScript/hoistStatic.spec.ts b/packages/compiler-sfc/__tests__/compileScript/hoistStatic.spec.ts index 7b3a8a813c..d2c76c9a2c 100644 --- a/packages/compiler-sfc/__tests__/compileScript/hoistStatic.spec.ts +++ b/packages/compiler-sfc/__tests__/compileScript/hoistStatic.spec.ts @@ -19,7 +19,6 @@ describe('sfc hoist static', () => { const nil = null const bigint = 100n const template = \`str\` - const regex = /.*/g `.trim() const { content, bindings } = compile(`