| 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 super(prefix, ElementKind.PREFIX, enclosing); | 338 super(prefix, ElementKind.PREFIX, enclosing); |
| 339 | 339 |
| 340 lookupLocalMember(SourceString memberName) => imported[memberName]; | 340 lookupLocalMember(SourceString memberName) => imported[memberName]; |
| 341 | 341 |
| 342 Type computeType(Compiler compiler) => compiler.types.dynamicType; | 342 Type computeType(Compiler compiler) => compiler.types.dynamicType; |
| 343 | 343 |
| 344 Token position() => firstPosition; | 344 Token position() => firstPosition; |
| 345 } | 345 } |
| 346 | 346 |
| 347 class TypedefElement extends Element { | 347 class TypedefElement extends Element { |
| 348 Token token; | 348 final Token token; |
| 349 Type cachedType; |
| 350 |
| 349 TypedefElement(SourceString name, Element enclosing, this.token) | 351 TypedefElement(SourceString name, Element enclosing, this.token) |
| 350 : super(name, ElementKind.TYPEDEF, enclosing); | 352 : super(name, ElementKind.TYPEDEF, enclosing) { |
| 353 cachedType = new InterfaceType(this); |
| 354 } |
| 351 | 355 |
| 352 position() => findMyName(token); | 356 position() => findMyName(token); |
| 357 |
| 358 Type computeType(Compiler compiler) => cachedType; |
| 353 } | 359 } |
| 354 | 360 |
| 355 class VariableElement extends Element { | 361 class VariableElement extends Element { |
| 356 final VariableListElement variables; | 362 final VariableListElement variables; |
| 357 Expression cachedNode; // The send or the identifier in the variables list. | 363 Expression cachedNode; // The send or the identifier in the variables list. |
| 358 | 364 |
| 359 Modifiers get modifiers() => variables.modifiers; | 365 Modifiers get modifiers() => variables.modifiers; |
| 360 | 366 |
| 361 VariableElement(SourceString name, | 367 VariableElement(SourceString name, |
| 362 VariableListElement this.variables, | 368 VariableListElement this.variables, |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 } else if (element.kind == ElementKind.GETTER | 728 } else if (element.kind == ElementKind.GETTER |
| 723 || element.kind == ElementKind.SETTER) { | 729 || element.kind == ElementKind.SETTER) { |
| 724 addGetterOrSetter(element, localMembers[element.name], listener); | 730 addGetterOrSetter(element, localMembers[element.name], listener); |
| 725 } else { | 731 } else { |
| 726 localMembers[element.name] = element; | 732 localMembers[element.name] = element; |
| 727 } | 733 } |
| 728 } | 734 } |
| 729 | 735 |
| 730 Type computeType(compiler) { | 736 Type computeType(compiler) { |
| 731 if (type === null) { | 737 if (type === null) { |
| 732 type = new InterfaceType(name, this); | 738 type = new InterfaceType(this); |
| 733 } | 739 } |
| 734 return type; | 740 return type; |
| 735 } | 741 } |
| 736 | 742 |
| 737 ClassElement ensureResolved(Compiler compiler) { | 743 ClassElement ensureResolved(Compiler compiler) { |
| 738 if (!isResolved && !isBeingResolved) { | 744 if (!isResolved && !isBeingResolved) { |
| 739 isBeingResolved = true; | 745 isBeingResolved = true; |
| 740 compiler.resolveClass(this); | 746 compiler.resolveClass(this); |
| 741 isBeingResolved = false; | 747 isBeingResolved = false; |
| 742 isResolved = true; | 748 isResolved = true; |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 final Node node; | 1063 final Node node; |
| 1058 Type bound; | 1064 Type bound; |
| 1059 Type type; | 1065 Type type; |
| 1060 TypeVariableElement(name, Element enclosing, this.node, this.type, | 1066 TypeVariableElement(name, Element enclosing, this.node, this.type, |
| 1061 [this.bound]) | 1067 [this.bound]) |
| 1062 : super(name, ElementKind.TYPE_VARIABLE, enclosing); | 1068 : super(name, ElementKind.TYPE_VARIABLE, enclosing); |
| 1063 Type computeType(compiler) => type; | 1069 Type computeType(compiler) => type; |
| 1064 Node parseNode(compiler) => node; | 1070 Node parseNode(compiler) => node; |
| 1065 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 1071 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 1066 } | 1072 } |
| OLD | NEW |