Skip to content

Commit 3135eb5

Browse files
alexmarkovcommit-bot@chromium.org
authored andcommitted
[vm/bytecode] Fix initial scope in field initializers
Fixes language_2/async_await_test with bytecode in dartk-reload-linux-release-x64 configuration. Change-Id: I6e7c7ae89cea2be8e1948a7ea0314c679387aa06 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117930 Reviewed-by: Régis Crelier <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
1 parent 1345fb8 commit 3135eb5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/vm/lib/bytecode/gen_bytecode.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,8 +1795,8 @@ class BytecodeGenerator extends RecursiveVisitor<Null> {
17951795

17961796
if (options.emitLocalVarInfo && locals.currentContextSize > 0) {
17971797
// Open a new scope after allocating context.
1798-
asm.localVariableTable.enterScope(
1799-
asm.offset, locals.currentContextLevel, function.fileOffset);
1798+
asm.localVariableTable.enterScope(asm.offset, locals.currentContextLevel,
1799+
function != null ? function.fileOffset : enclosingMember.fileOffset);
18001800
}
18011801

18021802
if (locals.hasCapturedParameters) {
@@ -1811,8 +1811,10 @@ class BytecodeGenerator extends RecursiveVisitor<Null> {
18111811
_genStoreVar(locals.capturedReceiverVar);
18121812
}
18131813
}
1814-
function.positionalParameters.forEach(_copyParamIfCaptured);
1815-
locals.sortedNamedParameters.forEach(_copyParamIfCaptured);
1814+
if (function != null) {
1815+
function.positionalParameters.forEach(_copyParamIfCaptured);
1816+
locals.sortedNamedParameters.forEach(_copyParamIfCaptured);
1817+
}
18161818
}
18171819
}
18181820

0 commit comments

Comments
 (0)