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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.modelx; 5 library elements.modelx;
6 6
7 import 'elements.dart'; 7 import 'elements.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../helpers/helpers.dart'; // Included for debug helpers. 9 import '../helpers/helpers.dart'; // Included for debug helpers.
10 import '../tree/tree.dart'; 10 import '../tree/tree.dart';
(...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 if (origin != null) { 2411 if (origin != null) {
2412 return 'patch ${super.toString()}'; 2412 return 'patch ${super.toString()}';
2413 } else if (patch != null) { 2413 } else if (patch != null) {
2414 return 'origin ${super.toString()}'; 2414 return 'origin ${super.toString()}';
2415 } else { 2415 } else {
2416 return super.toString(); 2416 return super.toString();
2417 } 2417 }
2418 } 2418 }
2419 } 2419 }
2420 2420
2421 class EnumClassElementX extends ClassElementX { 2421 class EnumClassElementX extends ClassElementX implements EnumClassElement {
2422 final Enum node; 2422 final Enum node;
2423 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.
2423 2424
2424 EnumClassElementX(String name, Element enclosing, int id, this.node) 2425 EnumClassElementX(String name, Element enclosing, int id, this.node)
2425 : super(name, enclosing, id, STATE_NOT_STARTED); 2426 : super(name, enclosing, id, STATE_NOT_STARTED);
2426 2427
2427 @override 2428 @override
2428 bool get hasNode => true; 2429 bool get hasNode => true;
2429 2430
2430 @override 2431 @override
2431 Token get position => node.name.token; 2432 Token get position => node.name.token;
2432 2433
2433 @override 2434 @override
2434 bool get isEnumClass => true; 2435 bool get isEnumClass => true;
2435 2436
2436 @override 2437 @override
2437 Node parseNode(Compiler compiler) => node; 2438 Node parseNode(Compiler compiler) => node;
2438 2439
2439 @override 2440 @override
2440 accept(ElementVisitor visitor) => visitor.visitClassElement(this); 2441 accept(ElementVisitor visitor) => visitor.visitEnumClassElement(this);
2441 2442
2442 List<DartType> computeTypeParameters(Compiler compiler) => const <DartType>[]; 2443 List<DartType> computeTypeParameters(Compiler compiler) => const <DartType>[];
2444
2445 Iterable<FieldElement> get enumValues {
2446 assert(invariant(this, enumValuesCache != null,
2447 message: "enumValues has not been computed for $this."));
2448 return enumValuesCache;
2449 }
2450
2451 void set enumValues(Iterable<FieldElement> values) {
2452 assert(invariant(this, enumValuesCache == null,
2453 message: "enumValues has already been computed for $this."));
2454 enumValuesCache = values;
2455 }
2443 } 2456 }
2444 2457
2445 class EnumConstructorElementX extends ConstructorElementX { 2458 class EnumConstructorElementX extends ConstructorElementX {
2446 final FunctionExpression node; 2459 final FunctionExpression node;
2447 2460
2448 EnumConstructorElementX(EnumClassElementX enumClass, 2461 EnumConstructorElementX(EnumClassElementX enumClass,
2449 Modifiers modifiers, 2462 Modifiers modifiers,
2450 this.node) 2463 this.node)
2451 : super('', // Name. 2464 : super('', // Name.
2452 ElementKind.GENERATIVE_CONSTRUCTOR, 2465 ElementKind.GENERATIVE_CONSTRUCTOR,
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 AstElement get definingElement; 2813 AstElement get definingElement;
2801 2814
2802 bool get hasResolvedAst => definingElement.hasTreeElements; 2815 bool get hasResolvedAst => definingElement.hasTreeElements;
2803 2816
2804 ResolvedAst get resolvedAst { 2817 ResolvedAst get resolvedAst {
2805 return new ResolvedAst(declaration, 2818 return new ResolvedAst(declaration,
2806 definingElement.node, definingElement.treeElements); 2819 definingElement.node, definingElement.treeElements);
2807 } 2820 }
2808 2821
2809 } 2822 }
OLDNEW
« 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