Skip to content

Commit 99edd36

Browse files
committed
Handle function expressions in 'new' constructor args
Adds logic to prescan constructor arguments of 'new' expressions for function expressions. This ensures that any function expressions passed as arguments are properly processed during compilation.
1 parent e333207 commit 99edd36

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/compiler.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8037,6 +8037,15 @@ export class Compiler extends DiagnosticEmitter {
80378037
}
80388038
break;
80398039
}
8040+
case NodeKind.New: {
8041+
let newExpr = <NewExpression>node;
8042+
// Scan constructor arguments for function expressions
8043+
let args = newExpr.args;
8044+
for (let i = 0, k = args.length; i < k; i++) {
8045+
this.prescanNodeForFunctionExpressions(args[i], instance, flow, declaredVars);
8046+
}
8047+
break;
8048+
}
80408049
case NodeKind.Parenthesized: {
80418050
let paren = <ParenthesizedExpression>node;
80428051
this.prescanNodeForFunctionExpressions(paren.expression, instance, flow, declaredVars);

0 commit comments

Comments
 (0)