From 08d9d6dd8d222ddaca86db6647f124bd7dbaa28f Mon Sep 17 00:00:00 2001 From: daiwei Date: Fri, 19 Mar 2021 17:02:23 +0800 Subject: [PATCH] fix(compiler-sfc): should not rewrite scope variable --- .../__snapshots__/compileScript.spec.ts.snap | 26 ++++++++++++ .../__tests__/compileScript.spec.ts | 23 +++++++++++ packages/compiler-sfc/src/compileScript.ts | 40 ++++++++++++++----- 3 files changed, 79 insertions(+), 10 deletions(-) diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index 59ef9b1b7ee..2293228e7fa 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -508,6 +508,32 @@ return { n, a, b, c } }" `; +exports[`SFC compile `) + expect(content).toMatch('console.log(a)') + expect(content).toMatch('console.log(b.value)') + expect(content).toMatch('console.log(c)') + assertCode(content) + }) + test('object destructure', () => { const { content, bindings } = compile(`