Skip to content

Commit 5ab6972

Browse files
committed
Improve Parser to recognize 'new Foo(...)' type expressions
1 parent 5acbe2f commit 5ab6972

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Parser.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,14 @@ class Parser extends Tapable {
10471047
}
10481048

10491049
walkNewExpression(expression) {
1050+
const callee = this.evaluateExpression(expression.callee);
1051+
if(callee.isIdentifier()) {
1052+
const result = this.applyPluginsBailResult("new " + callee.identifier, expression);
1053+
if(result === true) {
1054+
return;
1055+
}
1056+
}
1057+
10501058
this.walkExpression(expression.callee);
10511059
if(expression.arguments)
10521060
this.walkExpressions(expression.arguments);

0 commit comments

Comments
 (0)