summaryrefslogtreecommitdiff
path: root/node_modules/@babel/traverse/lib/path/introspection.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@babel/traverse/lib/path/introspection.js')
-rw-r--r--node_modules/@babel/traverse/lib/path/introspection.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/node_modules/@babel/traverse/lib/path/introspection.js b/node_modules/@babel/traverse/lib/path/introspection.js
index b83b717d..d79e570c 100644
--- a/node_modules/@babel/traverse/lib/path/introspection.js
+++ b/node_modules/@babel/traverse/lib/path/introspection.js
@@ -38,7 +38,8 @@ function matchesPattern(pattern, allowPartial) {
return _matchesPattern(this.node, pattern, allowPartial);
}
function has(key) {
- const val = this.node && this.node[key];
+ var _this$node;
+ const val = (_this$node = this.node) == null ? void 0 : _this$node[key];
if (val && Array.isArray(val)) {
return !!val.length;
} else {
@@ -352,6 +353,18 @@ function isConstantExpression() {
} = this.node;
return operator !== "in" && operator !== "instanceof" && this.get("left").isConstantExpression() && this.get("right").isConstantExpression();
}
+ if (this.isMemberExpression()) {
+ return !this.node.computed && this.get("object").isIdentifier({
+ name: "Symbol"
+ }) && !this.scope.hasBinding("Symbol", {
+ noGlobals: true
+ });
+ }
+ if (this.isCallExpression()) {
+ return this.node.arguments.length === 1 && this.get("callee").matchesPattern("Symbol.for") && !this.scope.hasBinding("Symbol", {
+ noGlobals: true
+ }) && this.get("arguments")[0].isStringLiteral();
+ }
return false;
}
function isInStrictMode() {