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

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/elements.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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/elements/elements.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/elements/elements.dart (revision 22927)
+++ sdk/lib/_internal/compiler/implementation/elements/elements.dart (working copy)
@@ -548,6 +548,16 @@
}
return false;
}
+
+ static bool isUnusedLabel(LabeledStatement node, TreeElements elements) {
+ Node body = node.statement;
+ TargetElement element = elements[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.
+ return element == null || element.statement != body;
+ }
}
abstract class ErroneousElement extends Element implements FunctionElement {
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698