perf: always return void 0 as undefined node (#10243)

This commit is contained in:
Huáng Jùnliàng 2019-08-01 03:53:40 -04:00 committed by Nicolò Ribaudo
parent 3e4a9d588b
commit 5fb4d84a33

View File

@ -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) {