Index: pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
index 7a84b26ef8d355126509dbfff59bdec08b7d8271..bf20af0fbd5db011776be0ddda3d9b217adc9b07 100644 |
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
@@ -2858,7 +2858,19 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { |
@override |
void endSwitchStatement(Token switchKeyword, Token endToken) { |
debugEvent("SwitchStatement"); |
- // Do nothing. Handled by [endSwitchBlock]. |
+ |
+ List<SwitchCase> cases = pop(); |
+ JumpTarget target = exitBreakTarget(); |
+ exitSwitchScope(); |
+ exitLocalScope(); |
+ Expression expression = popForValue(); |
+ Statement result = new KernelSwitchStatement(expression, cases) |
+ ..fileOffset = switchKeyword.charOffset; |
+ if (target.hasUsers) { |
+ result = new KernelLabeledStatement(result); |
+ target.resolveBreaks(result); |
+ } |
+ exitLoopOrSwitch(result); |
} |
@override |
@@ -2909,16 +2921,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { |
new ExpressionStatement(buildFallThroughError(current.fileOffset))); |
} |
} |
- JumpTarget target = exitBreakTarget(); |
- exitSwitchScope(); |
- exitLocalScope(); |
- Expression expression = popForValue(); |
- Statement result = new KernelSwitchStatement(expression, cases); |
- if (target.hasUsers) { |
- result = new KernelLabeledStatement(result); |
- target.resolveBreaks(result); |
- } |
- exitLoopOrSwitch(result); |
+ |
+ push(cases); |
} |
@override |