diff --git a/pkg/vm/lib/bytecode/gen_bytecode.dart b/pkg/vm/lib/bytecode/gen_bytecode.dart index 63a4e94fae9..701a3df57c7 100644 --- a/pkg/vm/lib/bytecode/gen_bytecode.dart +++ b/pkg/vm/lib/bytecode/gen_bytecode.dart @@ -3617,15 +3617,18 @@ class BytecodeGenerator extends RecursiveVisitor { 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; } }