]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
types: move scopeIds into PrefixMeta
authorEvan You <yyx990803@gmail.com>
Tue, 8 Oct 2019 16:09:22 +0000 (12:09 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 8 Oct 2019 16:09:22 +0000 (12:09 -0400)
packages/compiler-core/src/transforms/transformExpression.ts

index 80a2bc719261e360806c9301f92774ff4d2775a3..1c5d67dedcdbd5ea434ea46718cb4f03c962c454 100644 (file)
@@ -63,6 +63,7 @@ interface PrefixMeta {
   prefix?: string
   start: number
   end: number
+  scopeIds?: Set<string>
 }
 
 // Important: since this function uses Node.js only dependencies, it should
@@ -145,10 +146,7 @@ export function processExpression(
                 )
               ) {
                 const { name } = child
-                if (
-                  (node as any)._scopeIds &&
-                  (node as any)._scopeIds.has(name)
-                ) {
+                if (node.scopeIds && node.scopeIds.has(name)) {
                   return
                 }
                 if (name in knownIds) {
@@ -156,19 +154,16 @@ export function processExpression(
                 } else {
                   knownIds[name] = 1
                 }
-                ;(
-                  (node as any)._scopeIds ||
-                  ((node as any)._scopeIds = new Set())
-                ).add(name)
+                ;(node.scopeIds || (node.scopeIds = new Set())).add(name)
               }
             }
           })
         )
       }
     },
-    leave(node: any) {
-      if (node !== ast.body[0].expression && node._scopeIds) {
-        node._scopeIds.forEach((id: string) => {
+    leave(node: Node & PrefixMeta) {
+      if (node !== ast.body[0].expression && node.scopeIds) {
+        node.scopeIds.forEach((id: string) => {
           knownIds[id]--
           if (knownIds[id] === 0) {
             delete knownIds[id]