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

Unified Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 710343002: Check enums in switch cases. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix problem on redirecting factories. Created 6 years, 1 month 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 | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/elements/visitor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/elements/modelx.dart
diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart
index e58d75242743f7114a2daf0c5984288f9558ed5b..cf029c08ed8063d155a44679b59ccaceff557f3c 100644
--- a/pkg/compiler/lib/src/elements/modelx.dart
+++ b/pkg/compiler/lib/src/elements/modelx.dart
@@ -2418,8 +2418,9 @@ abstract class ClassElementX extends BaseClassElementX {
}
}
-class EnumClassElementX extends ClassElementX {
+class EnumClassElementX extends ClassElementX implements EnumClassElement {
final Enum node;
+ Iterable<FieldElement> enumValuesCache;
floitsch 2014/11/17 13:31:12 private? maybe even _enumValues That's the most co
Johnni Winther 2014/11/18 09:44:20 Done.
EnumClassElementX(String name, Element enclosing, int id, this.node)
: super(name, enclosing, id, STATE_NOT_STARTED);
@@ -2437,9 +2438,21 @@ class EnumClassElementX extends ClassElementX {
Node parseNode(Compiler compiler) => node;
@override
- accept(ElementVisitor visitor) => visitor.visitClassElement(this);
+ accept(ElementVisitor visitor) => visitor.visitEnumClassElement(this);
List<DartType> computeTypeParameters(Compiler compiler) => const <DartType>[];
+
+ Iterable<FieldElement> get enumValues {
+ assert(invariant(this, enumValuesCache != null,
+ message: "enumValues has not been computed for $this."));
+ return enumValuesCache;
+ }
+
+ void set enumValues(Iterable<FieldElement> values) {
+ assert(invariant(this, enumValuesCache == null,
+ message: "enumValues has already been computed for $this."));
+ enumValuesCache = values;
+ }
}
class EnumConstructorElementX extends ConstructorElementX {
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/elements/visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698