OLD | NEW |
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 2652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2663 } else if (patch != null) { | 2663 } else if (patch != null) { |
2664 return 'origin ${super.toString()}'; | 2664 return 'origin ${super.toString()}'; |
2665 } else { | 2665 } else { |
2666 return super.toString(); | 2666 return super.toString(); |
2667 } | 2667 } |
2668 } | 2668 } |
2669 } | 2669 } |
2670 | 2670 |
2671 class EnumClassElementX extends ClassElementX implements EnumClassElement { | 2671 class EnumClassElementX extends ClassElementX implements EnumClassElement { |
2672 final Enum node; | 2672 final Enum node; |
2673 Iterable<FieldElement> _enumValues; | 2673 List<FieldElement> _enumValues; |
2674 | 2674 |
2675 EnumClassElementX(String name, Element enclosing, int id, this.node) | 2675 EnumClassElementX(String name, Element enclosing, int id, this.node) |
2676 : super(name, enclosing, id, STATE_NOT_STARTED); | 2676 : super(name, enclosing, id, STATE_NOT_STARTED); |
2677 | 2677 |
2678 @override | 2678 @override |
2679 bool get hasNode => true; | 2679 bool get hasNode => true; |
2680 | 2680 |
2681 @override | 2681 @override |
2682 Token get position => node.name.token; | 2682 Token get position => node.name.token; |
2683 | 2683 |
2684 @override | 2684 @override |
2685 bool get isEnumClass => true; | 2685 bool get isEnumClass => true; |
2686 | 2686 |
2687 @override | 2687 @override |
2688 Node parseNode(Compiler compiler) => node; | 2688 Node parseNode(Compiler compiler) => node; |
2689 | 2689 |
2690 @override | 2690 @override |
2691 accept(ElementVisitor visitor) => visitor.visitEnumClassElement(this); | 2691 accept(ElementVisitor visitor) => visitor.visitEnumClassElement(this); |
2692 | 2692 |
2693 List<DartType> computeTypeParameters(Compiler compiler) => const <DartType>[]; | 2693 List<DartType> computeTypeParameters(Compiler compiler) => const <DartType>[]; |
2694 | 2694 |
2695 Iterable<FieldElement> get enumValues { | 2695 List<FieldElement> get enumValues { |
2696 assert(invariant(this, _enumValues != null, | 2696 assert(invariant(this, _enumValues != null, |
2697 message: "enumValues has not been computed for $this.")); | 2697 message: "enumValues has not been computed for $this.")); |
2698 return _enumValues; | 2698 return _enumValues; |
2699 } | 2699 } |
2700 | 2700 |
2701 void set enumValues(Iterable<FieldElement> values) { | 2701 void set enumValues(List<FieldElement> values) { |
2702 assert(invariant(this, _enumValues == null, | 2702 assert(invariant(this, _enumValues == null, |
2703 message: "enumValues has already been computed for $this.")); | 2703 message: "enumValues has already been computed for $this.")); |
2704 _enumValues = values; | 2704 _enumValues = values; |
2705 } | 2705 } |
2706 } | 2706 } |
2707 | 2707 |
2708 class EnumConstructorElementX extends ConstructorElementX { | 2708 class EnumConstructorElementX extends ConstructorElementX { |
2709 final FunctionExpression node; | 2709 final FunctionExpression node; |
2710 | 2710 |
2711 EnumConstructorElementX(EnumClassElementX enumClass, | 2711 EnumConstructorElementX(EnumClassElementX enumClass, |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3063 AstElement get definingElement; | 3063 AstElement get definingElement; |
3064 | 3064 |
3065 bool get hasResolvedAst => definingElement.hasTreeElements; | 3065 bool get hasResolvedAst => definingElement.hasTreeElements; |
3066 | 3066 |
3067 ResolvedAst get resolvedAst { | 3067 ResolvedAst get resolvedAst { |
3068 return new ResolvedAst(declaration, | 3068 return new ResolvedAst(declaration, |
3069 definingElement.node, definingElement.treeElements); | 3069 definingElement.node, definingElement.treeElements); |
3070 } | 3070 } |
3071 | 3071 |
3072 } | 3072 } |
OLD | NEW |