lib/condenser/processors/node_modules/@babel/traverse/lib/path/context.js in condenser-0.0.8 vs lib/condenser/processors/node_modules/@babel/traverse/lib/path/context.js in condenser-0.0.9
- old
+ new
@@ -24,10 +24,12 @@
exports.requeue = requeue;
exports._getQueueContexts = _getQueueContexts;
var _index = _interopRequireDefault(require("../index"));
+var _index2 = require("./index");
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function call(key) {
const opts = this.opts;
this.debug(key);
@@ -59,11 +61,11 @@
if (ret) {
throw new Error(`Unexpected return value from visitor method ${fn}`);
}
if (this.node !== node) return true;
- if (this.shouldStop || this.shouldSkip || this.removed) return true;
+ if (this._traverseFlags > 0) return true;
}
return false;
}
@@ -83,11 +85,11 @@
if (this.opts.shouldSkip && this.opts.shouldSkip(this)) {
return false;
}
- if (this.call("enter") || this.shouldSkip) {
+ if (this.shouldSkip || this.call("enter") || this.shouldSkip) {
this.debug("Skip...");
return this.shouldStop;
}
this.debug("Recursing into...");
@@ -101,16 +103,19 @@
function skip() {
this.shouldSkip = true;
}
function skipKey(key) {
+ if (this.skipKeys == null) {
+ this.skipKeys = {};
+ }
+
this.skipKeys[key] = true;
}
function stop() {
- this.shouldStop = true;
- this.shouldSkip = true;
+ this._traverseFlags |= _index2.SHOULD_SKIP | _index2.SHOULD_STOP;
}
function setScope() {
if (this.opts && this.opts.noScope) return;
let path = this.parentPath;
@@ -125,15 +130,16 @@
this.scope = this.getScope(target);
if (this.scope) this.scope.init();
}
function setContext(context) {
- this.shouldSkip = false;
- this.shouldStop = false;
- this.removed = false;
- this.skipKeys = {};
+ if (this.skipKeys != null) {
+ this.skipKeys = {};
+ }
+ this._traverseFlags = 0;
+
if (context) {
this.context = context;
this.state = context.state;
this.opts = context.opts;
}
@@ -206,12 +212,10 @@
this.contexts.push(context);
this.setContext(context);
}
function setup(parentPath, container, listKey, key) {
- this.inList = !!listKey;
this.listKey = listKey;
- this.parentKey = listKey || key;
this.container = container;
this.parentPath = parentPath || this.parentPath;
this.setKey(key);
}
\ No newline at end of file