| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 static final ElementKind VOID = | 95 static final ElementKind VOID = |
| 96 const ElementKind('void', ElementCategory.NONE); | 96 const ElementKind('void', ElementCategory.NONE); |
| 97 | 97 |
| 98 toString() => id; | 98 toString() => id; |
| 99 } | 99 } |
| 100 | 100 |
| 101 class Element implements Hashable { | 101 class Element implements Hashable { |
| 102 final SourceString name; | 102 final SourceString name; |
| 103 final ElementKind kind; | 103 final ElementKind kind; |
| 104 final Element enclosingElement; | 104 final Element enclosingElement; |
| 105 Link<Node> metadata = const EmptyLink<Node>(); |
| 105 Modifiers get modifiers() => null; | 106 Modifiers get modifiers() => null; |
| 106 | 107 |
| 107 Node parseNode(DiagnosticListener listener) { | 108 Node parseNode(DiagnosticListener listener) { |
| 108 listener.cancel("Internal Error: $this.parseNode", token: position()); | 109 listener.cancel("Internal Error: $this.parseNode", token: position()); |
| 109 } | 110 } |
| 110 | 111 |
| 111 Type computeType(Compiler compiler) { | 112 Type computeType(Compiler compiler) { |
| 112 compiler.internalError("$this.computeType.", token: position()); | 113 compiler.internalError("$this.computeType.", token: position()); |
| 113 } | 114 } |
| 114 | 115 |
| 116 void addMetadata(Node node) { |
| 117 metadata = metadata.prepend(node); |
| 118 } |
| 119 |
| 115 bool isFunction() => kind === ElementKind.FUNCTION; | 120 bool isFunction() => kind === ElementKind.FUNCTION; |
| 116 bool isMember() => | 121 bool isMember() => |
| 117 enclosingElement !== null && enclosingElement.kind === ElementKind.CLASS; | 122 enclosingElement !== null && enclosingElement.kind === ElementKind.CLASS; |
| 118 bool isInstanceMember() => false; | 123 bool isInstanceMember() => false; |
| 119 bool isFactoryConstructor() => modifiers !== null && modifiers.isFactory(); | 124 bool isFactoryConstructor() => modifiers !== null && modifiers.isFactory(); |
| 120 bool isGenerativeConstructor() => kind === ElementKind.GENERATIVE_CONSTRUCTOR; | 125 bool isGenerativeConstructor() => kind === ElementKind.GENERATIVE_CONSTRUCTOR; |
| 121 bool isGenerativeConstructorBody() => | 126 bool isGenerativeConstructorBody() => |
| 122 kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY; | 127 kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY; |
| 123 bool isCompilationUnit() { | 128 bool isCompilationUnit() { |
| 124 return kind === ElementKind.COMPILATION_UNIT || | 129 return kind === ElementKind.COMPILATION_UNIT || |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 final Node node; | 1141 final Node node; |
| 1137 Type bound; | 1142 Type bound; |
| 1138 Type type; | 1143 Type type; |
| 1139 TypeVariableElement(name, Element enclosing, this.node, this.type, | 1144 TypeVariableElement(name, Element enclosing, this.node, this.type, |
| 1140 [this.bound]) | 1145 [this.bound]) |
| 1141 : super(name, ElementKind.TYPE_VARIABLE, enclosing); | 1146 : super(name, ElementKind.TYPE_VARIABLE, enclosing); |
| 1142 Type computeType(compiler) => type; | 1147 Type computeType(compiler) => type; |
| 1143 Node parseNode(compiler) => node; | 1148 Node parseNode(compiler) => node; |
| 1144 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 1149 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 1145 } | 1150 } |
| OLD | NEW |