]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
wip: fix runtimeConstant marking
authorEvan You <yyx990803@gmail.com>
Fri, 13 Nov 2020 03:44:18 +0000 (22:44 -0500)
committerEvan You <yyx990803@gmail.com>
Fri, 13 Nov 2020 03:44:18 +0000 (22:44 -0500)
packages/compiler-core/src/transforms/transformExpression.ts

index 276c8cb1bdfcc1d07f661886bf8976871c79c5b9..f72bd16bb34cefe4c81aade8dbe32d95166617eb 100644 (file)
@@ -100,13 +100,6 @@ export function processExpression(
   }
 
   const { inline, bindingMetadata } = context
-
-  // const bindings exposed from setup - we know they never change
-  if (bindingMetadata[node.content] === BindingTypes.CONST) {
-    node.isRuntimeConstant = true
-    return node
-  }
-
   const prefix = (raw: string) => {
     const type = hasOwn(bindingMetadata, raw) && bindingMetadata[raw]
     if (inline) {
@@ -138,6 +131,10 @@ export function processExpression(
   // bail on parens to prevent any possible function invocations.
   const bailConstant = rawExp.indexOf(`(`) > -1
   if (isSimpleIdentifier(rawExp)) {
+    // const bindings exposed from setup - we know they never change
+    if (bindingMetadata[node.content] === BindingTypes.CONST) {
+      node.isRuntimeConstant = true
+    }
     if (
       !asParams &&
       !context.identifiers[rawExp] &&