From 26a09f08cf1ed43c640879f23fdad56c5c9282f7 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期四, 09 六月 2022 15:02:38 +0800
Subject: [PATCH] TODO#139884 Banner 1 文案調整

---
 PAMapp/node_modules/@babel/traverse/lib/scope/index.js |   66 +++++++++++++++++++++++++-------
 1 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/PAMapp/node_modules/@babel/traverse/lib/scope/index.js b/PAMapp/node_modules/@babel/traverse/lib/scope/index.js
index 8ab588a..1ef4fa6 100644
--- a/PAMapp/node_modules/@babel/traverse/lib/scope/index.js
+++ b/PAMapp/node_modules/@babel/traverse/lib/scope/index.js
@@ -53,7 +53,13 @@
   toIdentifier,
   unaryExpression,
   variableDeclaration,
-  variableDeclarator
+  variableDeclarator,
+  isRecordExpression,
+  isTupleExpression,
+  isObjectProperty,
+  isTopicReference,
+  isMetaProperty,
+  isPrivateName
 } = _t;
 
 function gatherNodeParts(node, parts) {
@@ -303,14 +309,14 @@
   },
 
   Function(path) {
-    if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {
-      path.scope.registerBinding("local", path.get("id"), path);
-    }
-
     const params = path.get("params");
 
     for (const param of params) {
       path.scope.registerBinding("param", param);
+    }
+
+    if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {
+      path.scope.registerBinding("local", path.get("id"), path);
     }
   },
 
@@ -430,7 +436,7 @@
   }
 
   isStatic(node) {
-    if (isThisExpression(node) || isSuper(node)) {
+    if (isThisExpression(node) || isSuper(node) || isTopicReference(node)) {
       return true;
     }
 
@@ -467,7 +473,7 @@
   checkBlockScopedCollisions(local, kind, name, id) {
     if (kind === "param") return;
     if (local.kind === "local") return;
-    const duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && (kind === "let" || kind === "const");
+    const duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && kind === "const";
 
     if (duplicate) {
       throw this.hub.buildError(id, `Duplicate declaration "${name}"`, TypeError);
@@ -575,6 +581,7 @@
         this.registerBinding(path.node.kind, declar);
       }
     } else if (path.isClassDeclaration()) {
+      if (path.node.declare) return;
       this.registerBinding("let", path);
     } else if (path.isImportDeclaration()) {
       const specifiers = path.get("specifiers");
@@ -681,8 +688,16 @@
       if (!binding) return false;
       if (constantsOnly) return binding.constant;
       return true;
+    } else if (isThisExpression(node) || isMetaProperty(node) || isTopicReference(node) || isPrivateName(node)) {
+      return true;
     } else if (isClass(node)) {
+      var _node$decorators;
+
       if (node.superClass && !this.isPure(node.superClass, constantsOnly)) {
+        return false;
+      }
+
+      if (((_node$decorators = node.decorators) == null ? void 0 : _node$decorators.length) > 0) {
         return false;
       }
 
@@ -695,25 +710,44 @@
       return true;
     } else if (isBinary(node)) {
       return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
-    } else if (isArrayExpression(node)) {
+    } else if (isArrayExpression(node) || isTupleExpression(node)) {
       for (const elem of node.elements) {
-        if (!this.isPure(elem, constantsOnly)) return false;
+        if (elem !== null && !this.isPure(elem, constantsOnly)) return false;
       }
 
       return true;
-    } else if (isObjectExpression(node)) {
+    } else if (isObjectExpression(node) || isRecordExpression(node)) {
       for (const prop of node.properties) {
         if (!this.isPure(prop, constantsOnly)) return false;
       }
 
       return true;
     } else if (isMethod(node)) {
+      var _node$decorators2;
+
       if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
-      if (node.kind === "get" || node.kind === "set") return false;
+
+      if (((_node$decorators2 = node.decorators) == null ? void 0 : _node$decorators2.length) > 0) {
+        return false;
+      }
+
       return true;
     } else if (isProperty(node)) {
+      var _node$decorators3;
+
       if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
-      return this.isPure(node.value, constantsOnly);
+
+      if (((_node$decorators3 = node.decorators) == null ? void 0 : _node$decorators3.length) > 0) {
+        return false;
+      }
+
+      if (isObjectProperty(node) || node.static) {
+        if (node.value !== null && !this.isPure(node.value, constantsOnly)) {
+          return false;
+        }
+      }
+
+      return true;
     } else if (isUnaryExpression(node)) {
       return this.isPure(node.argument, constantsOnly);
     } else if (isTaggedTemplateExpression(node)) {
@@ -847,8 +881,8 @@
     }
 
     const declarator = variableDeclarator(opts.id, opts.init);
-    declarPath.node.declarations.push(declarator);
-    this.registerBinding(kind, declarPath.get("declarations").pop());
+    const len = declarPath.node.declarations.push(declarator);
+    path.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]);
   }
 
   getProgramParent() {
@@ -937,9 +971,11 @@
       if (binding) {
         var _previousPath;
 
-        if ((_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param") {} else {
+        if ((_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param" && binding.kind !== "local") {} else {
           return binding;
         }
+      } else if (!binding && name === "arguments" && scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) {
+        break;
       }
 
       previousPath = scope.path;

--
Gitblit v1.8.0