summaryrefslogtreecommitdiff
path: root/node_modules/@babel/traverse/lib/path/context.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-08-30 17:21:18 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-08-30 17:21:18 +0800
commitefbc2ffe6a1ee5ec38a4396305561d6515d0943e (patch)
tree2b4c94f18f2c792dfda813050755d5c0273fae22 /node_modules/@babel/traverse/lib/path/context.js
parent43acceb75957c880a5ba5a31aae221394a36d5f6 (diff)
node fixes, updates
Diffstat (limited to 'node_modules/@babel/traverse/lib/path/context.js')
-rw-r--r--node_modules/@babel/traverse/lib/path/context.js46
1 files changed, 33 insertions, 13 deletions
diff --git a/node_modules/@babel/traverse/lib/path/context.js b/node_modules/@babel/traverse/lib/path/context.js
index 7b52a658..78bbe6b8 100644
--- a/node_modules/@babel/traverse/lib/path/context.js
+++ b/node_modules/@babel/traverse/lib/path/context.js
@@ -10,10 +10,11 @@ exports._resyncList = _resyncList;
exports._resyncParent = _resyncParent;
exports._resyncRemoved = _resyncRemoved;
exports.call = call;
-exports.isBlacklisted = exports.isDenylisted = isDenylisted;
+exports.isDenylisted = isDenylisted;
exports.popContext = popContext;
exports.pushContext = pushContext;
exports.requeue = requeue;
+exports.requeueComputedKeyAndDecorators = requeueComputedKeyAndDecorators;
exports.resync = resync;
exports.setContext = setContext;
exports.setKey = setKey;
@@ -25,15 +26,17 @@ exports.stop = stop;
exports.visit = visit;
var _traverseNode = require("../traverse-node.js");
var _index = require("./index.js");
+var _removal = require("./removal.js");
+var t = require("@babel/types");
function call(key) {
const opts = this.opts;
this.debug(key);
if (this.node) {
- if (this._call(opts[key])) return true;
+ if (_call.call(this, opts[key])) return true;
}
if (this.node) {
var _opts$this$node$type;
- return this._call((_opts$this$node$type = opts[this.node.type]) == null ? void 0 : _opts$this$node$type[key]);
+ return _call.call(this, (_opts$this$node$type = opts[this.node.type]) == null ? void 0 : _opts$this$node$type[key]);
}
return false;
}
@@ -60,6 +63,9 @@ function isDenylisted() {
const denylist = (_this$opts$denylist = this.opts.denylist) != null ? _this$opts$denylist : this.opts.blacklist;
return denylist && denylist.indexOf(this.node.type) > -1;
}
+{
+ exports.isBlacklisted = isDenylisted;
+}
function restoreContext(path, context) {
if (path.context !== context) {
path.context = context;
@@ -79,7 +85,7 @@ function visit() {
return false;
}
const currentContext = this.context;
- if (this.shouldSkip || this.call("enter")) {
+ if (this.shouldSkip || call.call(this, "enter")) {
this.debug("Skip...");
return this.shouldStop;
}
@@ -87,7 +93,7 @@ function visit() {
this.debug("Recursing into...");
this.shouldStop = (0, _traverseNode.traverseNode)(this.node, this.opts, this.scope, this.state, this, this.skipKeys);
restoreContext(this, currentContext);
- this.call("exit");
+ call.call(this, "exit");
return this.shouldStop;
}
function skip() {
@@ -129,14 +135,14 @@ function setContext(context) {
this.state = context.state;
this.opts = context.opts;
}
- this.setScope();
+ setScope.call(this);
return this;
}
function resync() {
if (this.removed) return;
- this._resyncParent();
- this._resyncList();
- this._resyncKey();
+ _resyncParent.call(this);
+ _resyncList.call(this);
+ _resyncKey.call(this);
}
function _resyncParent() {
if (this.parentPath) {
@@ -151,14 +157,14 @@ function _resyncKey() {
if (Array.isArray(this.container)) {
for (let i = 0; i < this.container.length; i++) {
if (this.container[i] === this.node) {
- this.setKey(i);
+ setKey.call(this, i);
return;
}
}
} else {
for (const key of Object.keys(this.container)) {
if (this.container[key] === this.node) {
- this.setKey(key);
+ setKey.call(this, key);
return;
}
}
@@ -173,7 +179,7 @@ function _resyncList() {
}
function _resyncRemoved() {
if (this.key == null || !this.container || this.container[this.key] !== this.node) {
- this._markRemoved();
+ _removal._markRemoved.call(this);
}
}
function popContext() {
@@ -192,7 +198,7 @@ function setup(parentPath, container, listKey, key) {
this.listKey = listKey;
this.container = container;
this.parentPath = parentPath || this.parentPath;
- this.setKey(key);
+ setKey.call(this, key);
}
function setKey(key) {
var _this$node;
@@ -208,6 +214,20 @@ function requeue(pathToQueue = this) {
context.maybeQueue(pathToQueue);
}
}
+function requeueComputedKeyAndDecorators() {
+ const {
+ context,
+ node
+ } = this;
+ if (!t.isPrivate(node) && node.computed) {
+ context.maybeQueue(this.get("key"));
+ }
+ if (node.decorators) {
+ for (const decorator of this.get("decorators")) {
+ context.maybeQueue(decorator);
+ }
+ }
+}
function _getQueueContexts() {
let path = this;
let contexts = this.contexts;