[vm/bytecode] Correct source positions for switch cases
This fixes the following tests in bytecode mode: service/step_through_switch_test broke service/step_through_switch_with_continue_test Change-Id: I3f6f835185b9dae86e5ebebfdd4484b4d1cb6af0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114549 Reviewed-by: Régis Crelier <regis@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
7b2e879858
commit
a00a8df2d9
@@ -3617,15 +3617,18 @@ class BytecodeGenerator extends RecursiveVisitor<Null> {
|
||||
if (switchCase.isDefault) {
|
||||
defaultLabel = caseLabel;
|
||||
} else {
|
||||
for (var expr in switchCase.expressions) {
|
||||
final savedSourcePosition = asm.currentSourcePosition;
|
||||
for (int i = 0; i < switchCase.expressions.length; ++i) {
|
||||
_recordSourcePosition(switchCase.expressionOffsets[i]);
|
||||
asm.emitPush(temp);
|
||||
_genPushConstExpr(expr);
|
||||
_genPushConstExpr(switchCase.expressions[i]);
|
||||
asm.emitInterfaceCall(
|
||||
cp.addInterfaceCall(
|
||||
InvocationKind.method, coreTypes.objectEquals, equalsArgDesc),
|
||||
2);
|
||||
_genJumpIfTrue(/* negated = */ false, caseLabel);
|
||||
}
|
||||
asm.currentSourcePosition = savedSourcePosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user