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

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/elements.dart

Issue 14890026: Handle switch statement in simple types 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/types/simple_types_inferrer.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 22849)
+++ sdk/lib/_internal/compiler/implementation/elements/elements.dart (working copy)
@@ -525,6 +525,29 @@
&& node.isCall
&& node.arguments.isEmpty;
}
+
+ static bool switchStatementHasContinue(SwitchStatement node,
+ TreeElements elements) {
+ for (SwitchCase switchCase in node.cases) {
+ for (Node labelOrCase in switchCase.labelsAndCases) {
+ Node label = labelOrCase.asLabel();
+ if (label != null) {
+ LabelElement labelElement = elements[label];
+ if (labelElement != null && labelElement.isContinueTarget) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ static bool switchStatementHasDefault(SwitchStatement node) {
+ for (SwitchCase switchCase in node.cases) {
+ if (switchCase.isDefaultCase) return true;
+ }
+ return false;
+ }
}
abstract class ErroneousElement extends Element implements FunctionElement {
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698