| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 && e.kind !== ElementKind.PREFIX | 310 && e.kind !== ElementKind.PREFIX |
| 311 && e.kind !== ElementKind.FOREIGN) { | 311 && e.kind !== ElementKind.FOREIGN) { |
| 312 if (!e.name.isPrivate()) f(e); | 312 if (!e.name.isPrivate()) f(e); |
| 313 } | 313 } |
| 314 }); | 314 }); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 class PrefixElement extends Element { | 318 class PrefixElement extends Element { |
| 319 Map<SourceString, Element> imported; | 319 Map<SourceString, Element> imported; |
| 320 Token firstPosition; |
| 320 | 321 |
| 321 PrefixElement(SourceString prefix, Element enclosing) | 322 PrefixElement(SourceString prefix, Element enclosing, this.firstPosition) |
| 322 : imported = new Map<SourceString, Element>(), | 323 : imported = new Map<SourceString, Element>(), |
| 323 super(prefix, ElementKind.PREFIX, enclosing); | 324 super(prefix, ElementKind.PREFIX, enclosing); |
| 324 | 325 |
| 325 lookupLocalMember(SourceString memberName) => imported[memberName]; | 326 lookupLocalMember(SourceString memberName) => imported[memberName]; |
| 326 | 327 |
| 327 Type computeType(Compiler compiler) => compiler.types.dynamicType; | 328 Type computeType(Compiler compiler) => compiler.types.dynamicType; |
| 329 |
| 330 Token position() => firstPosition; |
| 328 } | 331 } |
| 329 | 332 |
| 330 class TypedefElement extends Element { | 333 class TypedefElement extends Element { |
| 331 TypedefElement(SourceString name, Element enclosing) | 334 Token token; |
| 335 TypedefElement(SourceString name, Element enclosing, this.token) |
| 332 : super(name, ElementKind.TYPEDEF, enclosing); | 336 : super(name, ElementKind.TYPEDEF, enclosing); |
| 337 |
| 338 position() => findMyName(token); |
| 333 } | 339 } |
| 334 | 340 |
| 335 class VariableElement extends Element { | 341 class VariableElement extends Element { |
| 336 final VariableListElement variables; | 342 final VariableListElement variables; |
| 337 Expression cachedNode; // The send or the identifier in the variables list. | 343 Expression cachedNode; // The send or the identifier in the variables list. |
| 338 | 344 |
| 339 Modifiers get modifiers() => variables.modifiers; | 345 Modifiers get modifiers() => variables.modifiers; |
| 340 | 346 |
| 341 VariableElement(SourceString name, | 347 VariableElement(SourceString name, |
| 342 VariableListElement this.variables, | 348 VariableListElement this.variables, |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 final Node node; | 945 final Node node; |
| 940 Type bound; | 946 Type bound; |
| 941 Type type; | 947 Type type; |
| 942 TypeVariableElement(name, Element enclosing, this.node, this.type, | 948 TypeVariableElement(name, Element enclosing, this.node, this.type, |
| 943 [this.bound]) | 949 [this.bound]) |
| 944 : super(name, ElementKind.TYPE_VARIABLE, enclosing); | 950 : super(name, ElementKind.TYPE_VARIABLE, enclosing); |
| 945 Type computeType(compiler) => type; | 951 Type computeType(compiler) => type; |
| 946 Node parseNode(compiler) => node; | 952 Node parseNode(compiler) => node; |
| 947 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 953 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 948 } | 954 } |
| OLD | NEW |