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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library elements; 5 library elements;
6 6
7 import 'dart:uri'; 7 import 'dart:uri';
8 8
9 import 'modelx.dart'; 9 import 'modelx.dart';
10 import '../tree/tree.dart'; 10 import '../tree/tree.dart';
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 && node.arguments.tail.isEmpty; 518 && node.arguments.tail.isEmpty;
519 } 519 }
520 520
521 static bool isGrowableListConstructorCall(Element element, 521 static bool isGrowableListConstructorCall(Element element,
522 Send node, 522 Send node,
523 Compiler compiler) { 523 Compiler compiler) {
524 return element == compiler.unnamedListConstructor 524 return element == compiler.unnamedListConstructor
525 && node.isCall 525 && node.isCall
526 && node.arguments.isEmpty; 526 && node.arguments.isEmpty;
527 } 527 }
528
529 static bool switchStatementHasContinue(SwitchStatement node,
530 TreeElements elements) {
531 for (SwitchCase switchCase in node.cases) {
532 for (Node labelOrCase in switchCase.labelsAndCases) {
533 Node label = labelOrCase.asLabel();
534 if (label != null) {
535 LabelElement labelElement = elements[label];
536 if (labelElement != null && labelElement.isContinueTarget) {
537 return true;
538 }
539 }
540 }
541 }
542 return false;
543 }
544
545 static bool switchStatementHasDefault(SwitchStatement node) {
546 for (SwitchCase switchCase in node.cases) {
547 if (switchCase.isDefaultCase) return true;
548 }
549 return false;
550 }
528 } 551 }
529 552
530 abstract class ErroneousElement extends Element implements FunctionElement { 553 abstract class ErroneousElement extends Element implements FunctionElement {
531 MessageKind get messageKind; 554 MessageKind get messageKind;
532 Map get messageArguments; 555 Map get messageArguments;
533 } 556 }
534 557
535 abstract class AmbiguousElement extends Element { 558 abstract class AmbiguousElement extends Element {
536 MessageKind get messageKind; 559 MessageKind get messageKind;
537 Map get messageArguments; 560 Map get messageArguments;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 int get resolutionState; 897 int get resolutionState;
875 Token get beginToken; 898 Token get beginToken;
876 Token get endToken; 899 Token get endToken;
877 900
878 // TODO(kasperl): Try to get rid of these. 901 // TODO(kasperl): Try to get rid of these.
879 void set annotatedElement(Element value); 902 void set annotatedElement(Element value);
880 void set resolutionState(int value); 903 void set resolutionState(int value);
881 904
882 MetadataAnnotation ensureResolved(Compiler compiler); 905 MetadataAnnotation ensureResolved(Compiler compiler);
883 } 906 }
OLDNEW
« 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