Skip to content

Commit

Permalink
perf: always return void 0 as undefined node (#10243)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung authored and nicolo-ribaudo committed Aug 1, 2019
1 parent 3e4a9d5 commit 5fb4d84
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions packages/babel-traverse/src/scope/index.js
Expand Up @@ -490,12 +490,7 @@ export default class Scope {
}

buildUndefinedNode() {
if (this.hasBinding("undefined")) {
return t.unaryExpression("void", t.numericLiteral(0), true);
} else {
// eslint-disable-next-line @babel/development/no-undefined-identifier
return t.identifier("undefined");
}
return t.unaryExpression("void", t.numericLiteral(0), true);
}

registerConstantViolation(path: NodePath) {
Expand Down

0 comments on commit 5fb4d84

Please sign in to comment.