| OLD | NEW |
| 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('../tree/tree.dart'); | 7 #import('../tree/tree.dart'); |
| 8 #import('../scanner/scannerlib.dart'); | 8 #import('../scanner/scannerlib.dart'); |
| 9 #import('../leg.dart'); // TODO(karlklose): we only need type. | 9 #import('../leg.dart'); // TODO(karlklose): we only need type. |
| 10 #import('../util/util.dart'); | 10 #import('../util/util.dart'); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 const ElementKind('library', ElementCategory.NONE); | 85 const ElementKind('library', ElementCategory.NONE); |
| 86 static final ElementKind PREFIX = | 86 static final ElementKind PREFIX = |
| 87 const ElementKind('prefix', ElementCategory.PREFIX); | 87 const ElementKind('prefix', ElementCategory.PREFIX); |
| 88 static final ElementKind TYPEDEF = | 88 static final ElementKind TYPEDEF = |
| 89 const ElementKind('typedef', ElementCategory.ALIAS); | 89 const ElementKind('typedef', ElementCategory.ALIAS); |
| 90 | 90 |
| 91 static final ElementKind STATEMENT = | 91 static final ElementKind STATEMENT = |
| 92 const ElementKind('statement', ElementCategory.NONE); | 92 const ElementKind('statement', ElementCategory.NONE); |
| 93 static final ElementKind LABEL = | 93 static final ElementKind LABEL = |
| 94 const ElementKind('label', ElementCategory.NONE); | 94 const ElementKind('label', ElementCategory.NONE); |
| 95 static final ElementKind VOID = |
| 96 const ElementKind('void', ElementCategory.NONE); |
| 95 | 97 |
| 96 toString() => id; | 98 toString() => id; |
| 97 } | 99 } |
| 98 | 100 |
| 99 class Element implements Hashable { | 101 class Element implements Hashable { |
| 100 final SourceString name; | 102 final SourceString name; |
| 101 final ElementKind kind; | 103 final ElementKind kind; |
| 102 final Element enclosingElement; | 104 final Element enclosingElement; |
| 103 Modifiers get modifiers() => null; | 105 Modifiers get modifiers() => null; |
| 104 | 106 |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 } | 659 } |
| 658 | 660 |
| 659 class SynthesizedConstructorElement extends FunctionElement { | 661 class SynthesizedConstructorElement extends FunctionElement { |
| 660 SynthesizedConstructorElement(Element enclosing) | 662 SynthesizedConstructorElement(Element enclosing) |
| 661 : super(enclosing.name, ElementKind.GENERATIVE_CONSTRUCTOR, | 663 : super(enclosing.name, ElementKind.GENERATIVE_CONSTRUCTOR, |
| 662 null, enclosing); | 664 null, enclosing); |
| 663 | 665 |
| 664 Token position() => enclosingElement.position(); | 666 Token position() => enclosingElement.position(); |
| 665 } | 667 } |
| 666 | 668 |
| 669 class VoidElement extends Element { |
| 670 VoidElement(Element enclosing) |
| 671 : super(Types.VOID, ElementKind.VOID, enclosing); |
| 672 Type computeType(compiler) => compiler.types.voidType; |
| 673 Node parseNode(_) { |
| 674 throw 'internal error: parseNode on void'; |
| 675 } |
| 676 bool impliesType() => true; |
| 677 } |
| 678 |
| 667 class ClassElement extends ContainerElement { | 679 class ClassElement extends ContainerElement { |
| 668 Type type; | 680 Type type; |
| 669 Type supertype; | 681 Type supertype; |
| 670 Type defaultClass; | 682 Type defaultClass; |
| 671 Link<Element> members = const EmptyLink<Element>(); | 683 Link<Element> members = const EmptyLink<Element>(); |
| 672 Map<SourceString, Element> localMembers; | 684 Map<SourceString, Element> localMembers; |
| 673 Map<SourceString, Element> constructors; | 685 Map<SourceString, Element> constructors; |
| 674 Link<Type> interfaces = const EmptyLink<Type>(); | 686 Link<Type> interfaces = const EmptyLink<Type>(); |
| 675 LinkedHashMap<SourceString, TypeVariableElement> typeParameters; | 687 LinkedHashMap<SourceString, TypeVariableElement> typeParameters; |
| 676 bool isResolved = false; | 688 bool isResolved = false; |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 final Node node; | 1042 final Node node; |
| 1031 Type bound; | 1043 Type bound; |
| 1032 Type type; | 1044 Type type; |
| 1033 TypeVariableElement(name, Element enclosing, this.node, this.type, | 1045 TypeVariableElement(name, Element enclosing, this.node, this.type, |
| 1034 [this.bound]) | 1046 [this.bound]) |
| 1035 : super(name, ElementKind.TYPE_VARIABLE, enclosing); | 1047 : super(name, ElementKind.TYPE_VARIABLE, enclosing); |
| 1036 Type computeType(compiler) => type; | 1048 Type computeType(compiler) => type; |
| 1037 Node parseNode(compiler) => node; | 1049 Node parseNode(compiler) => node; |
| 1038 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 1050 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 1039 } | 1051 } |
| OLD | NEW |