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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 14623030: Detect dead code, and handle breaks and continues in inferrer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/builder.dart (revision 22927)
+++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy)
@@ -4274,21 +4274,14 @@
visitLabeledStatement(LabeledStatement node) {
Statement body = node.statement;
- if (body is Loop || body is SwitchStatement) {
+ if (body is Loop
+ || body is SwitchStatement
+ || Elements.isUnusedLabel(node, elements)) {
// Loops and switches handle their own labels.
visit(body);
return;
}
- // Non-loop statements can only be break targets, not continue targets.
TargetElement targetElement = elements[body];
- if (targetElement == null || !identical(targetElement.statement, body)) {
- // Labeled statements with no element on the body have no breaks.
- // A different target statement only happens if the body is itself
- // a break or continue for a different target. In that case, this
- // label is also always unused.
- visit(body);
- return;
- }
LocalsHandler beforeLocals = new LocalsHandler.from(localsHandler);
assert(targetElement.isBreakTarget);
JumpHandler handler = new JumpHandler(this, targetElement);

Powered by Google App Engine
This is Rietveld 408576698