Skip to content

Commit d26afd7

Browse files
committed
for-in or for-of expression is evaluated before loop back edge
1 parent 945babb commit d26afd7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/binder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1032,12 +1032,12 @@ namespace ts {
10321032
function bindForInOrForOfStatement(node: ForInOrOfStatement): void {
10331033
const preLoopLabel = createLoopLabel();
10341034
const postLoopLabel = createBranchLabel();
1035+
bind(node.expression);
10351036
addAntecedent(preLoopLabel, currentFlow);
10361037
currentFlow = preLoopLabel;
10371038
if (node.kind === SyntaxKind.ForOfStatement) {
10381039
bind(node.awaitModifier);
10391040
}
1040-
bind(node.expression);
10411041
addAntecedent(postLoopLabel, currentFlow);
10421042
bind(node.initializer);
10431043
if (node.initializer.kind !== SyntaxKind.VariableDeclarationList) {

0 commit comments

Comments
 (0)