Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: pkg/compiler/lib/src/js_model/locals.dart

Issue 3003283003: Handle missing break in last switch case (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_model/locals.dart
diff --git a/pkg/compiler/lib/src/js_model/locals.dart b/pkg/compiler/lib/src/js_model/locals.dart
index 306fd3dd9e9d25036ad2972a6a180a5db17e26a9..4fcf63a7bf458ca0de60463dc286be4afbe60d6c 100644
--- a/pkg/compiler/lib/src/js_model/locals.dart
+++ b/pkg/compiler/lib/src/js_model/locals.dart
@@ -260,6 +260,17 @@ class JumpVisitor extends ir.Visitor {
jumpTargetMap[node] = target;
super.visitBreakStatement(node);
}
+
+ @override
+ visitSwitchStatement(ir.SwitchStatement node) {
+ node.expression.accept(this);
+ if (node.cases.isNotEmpty && !node.cases.last.isDefault) {
+ // Ensure that [node] has a corresponding target. We generate a break in
+ // case of a missing break on the last case if it isn't a default case.
+ _getJumpTarget(node);
+ }
+ super.visitSwitchStatement(node);
+ }
}
class JJumpTarget extends JumpTarget<ir.Node> {
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698