Skip to content

Commit

Permalink
perf: lazy initialize this.skipKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Sep 22, 2019
1 parent 1f4c88b commit 591e2f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/babel-traverse/src/path/context.js
Expand Up @@ -93,6 +93,9 @@ export function skip() {
}

export function skipKey(key) {
if (this.skipKeys == null) {
this.skipKeys = {};
}
this.skipKeys[key] = true;
}

Expand All @@ -117,7 +120,9 @@ export function setScope() {
}

export function setContext(context) {
this.skipKeys = {};
if (this.skipKeys != null) {
this.skipKeys = {};
}
this._traverseFlags = 0;

if (context) {
Expand Down

0 comments on commit 591e2f2

Please sign in to comment.