@vue/compiler-core 3.2.8 → 3.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3184,7 +3184,7 @@ function processExpression(node, context,
3184
3184
  // function params
3185
3185
  asParams = false,
3186
3186
  // v-on handler values may contain multiple statements
3187
- asRawStatements = false) {
3187
+ asRawStatements = false, localVars = Object.create(context.identifiers)) {
3188
3188
  if (!context.prefixIdentifiers || !node.content.trim()) {
3189
3189
  return node;
3190
3190
  }
@@ -3198,7 +3198,7 @@ asRawStatements = false) {
3198
3198
  const isUpdateArg = parent && parent.type === 'UpdateExpression' && parent.argument === id;
3199
3199
  // ({ x } = y)
3200
3200
  const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
3201
- if (type === "setup-const" /* SETUP_CONST */) {
3201
+ if (type === "setup-const" /* SETUP_CONST */ || localVars[raw]) {
3202
3202
  return raw;
3203
3203
  }
3204
3204
  else if (type === "setup-ref" /* SETUP_REF */) {
@@ -3222,7 +3222,7 @@ asRawStatements = false) {
3222
3222
  // x = y --> isRef(x) ? x.value = y : x = y
3223
3223
  const { right: rVal, operator } = parent;
3224
3224
  const rExp = rawExp.slice(rVal.start - 1, rVal.end - 1);
3225
- const rExpString = stringifyExpression(processExpression(createSimpleExpression(rExp, false), context));
3225
+ const rExpString = stringifyExpression(processExpression(createSimpleExpression(rExp, false), context, false, false, knownIds));
3226
3226
  return `${context.helperString(IS_REF)}(${raw})${context.isTS ? ` //@ts-ignore\n` : ``} ? ${raw}.value ${operator} ${rExpString} : ${raw}`;
3227
3227
  }
3228
3228
  else if (isUpdateArg) {
@@ -3122,7 +3122,7 @@ function processExpression(node, context,
3122
3122
  // function params
3123
3123
  asParams = false,
3124
3124
  // v-on handler values may contain multiple statements
3125
- asRawStatements = false) {
3125
+ asRawStatements = false, localVars = Object.create(context.identifiers)) {
3126
3126
  if (!context.prefixIdentifiers || !node.content.trim()) {
3127
3127
  return node;
3128
3128
  }
@@ -3136,7 +3136,7 @@ asRawStatements = false) {
3136
3136
  const isUpdateArg = parent && parent.type === 'UpdateExpression' && parent.argument === id;
3137
3137
  // ({ x } = y)
3138
3138
  const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
3139
- if (type === "setup-const" /* SETUP_CONST */) {
3139
+ if (type === "setup-const" /* SETUP_CONST */ || localVars[raw]) {
3140
3140
  return raw;
3141
3141
  }
3142
3142
  else if (type === "setup-ref" /* SETUP_REF */) {
@@ -3160,7 +3160,7 @@ asRawStatements = false) {
3160
3160
  // x = y --> isRef(x) ? x.value = y : x = y
3161
3161
  const { right: rVal, operator } = parent;
3162
3162
  const rExp = rawExp.slice(rVal.start - 1, rVal.end - 1);
3163
- const rExpString = stringifyExpression(processExpression(createSimpleExpression(rExp, false), context));
3163
+ const rExpString = stringifyExpression(processExpression(createSimpleExpression(rExp, false), context, false, false, knownIds));
3164
3164
  return `${context.helperString(IS_REF)}(${raw})${context.isTS ? ` //@ts-ignore\n` : ``} ? ${raw}.value ${operator} ${rExpString} : ${raw}`;
3165
3165
  }
3166
3166
  else if (isUpdateArg) {
@@ -782,7 +782,7 @@ export declare interface Position {
782
782
  column: number;
783
783
  }
784
784
 
785
- export declare function processExpression(node: SimpleExpressionNode, context: TransformContext, asParams?: boolean, asRawStatements?: boolean): ExpressionNode;
785
+ export declare function processExpression(node: SimpleExpressionNode, context: TransformContext, asParams?: boolean, asRawStatements?: boolean, localVars?: Record<string, number>): ExpressionNode;
786
786
 
787
787
  export declare function processFor(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (forNode: ForNode) => (() => void) | undefined): (() => void) | undefined;
788
788
 
@@ -2921,7 +2921,7 @@ function processExpression(node, context,
2921
2921
  // function params
2922
2922
  asParams = false,
2923
2923
  // v-on handler values may contain multiple statements
2924
- asRawStatements = false) {
2924
+ asRawStatements = false, localVars = Object.create(context.identifiers)) {
2925
2925
  {
2926
2926
  if ((process.env.NODE_ENV !== 'production')) {
2927
2927
  // simple in-browser validation (same logic in 2.x)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.2.8",
3
+ "version": "3.2.9",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.2.8",
35
+ "@vue/shared": "3.2.9",
36
36
  "@babel/parser": "^7.15.0",
37
37
  "@babel/types": "^7.15.0",
38
38
  "estree-walker": "^2.0.2",