| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 // Use the file name as script name. | 379 // Use the file name as script name. |
| 380 var path = script.uri.path; | 380 var path = script.uri.path; |
| 381 return path.substring(path.lastIndexOf('/') + 1); | 381 return path.substring(path.lastIndexOf('/') + 1); |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 } | 384 } |
| 385 | 385 |
| 386 class PrefixElement extends Element { | 386 class PrefixElement extends Element { |
| 387 Map<SourceString, Element> imported; | 387 Map<SourceString, Element> imported; |
| 388 Token firstPosition; | 388 Token firstPosition; |
| 389 final CompilationUnitElement patchSource; |
| 389 | 390 |
| 390 PrefixElement(SourceString prefix, Element enclosing, this.firstPosition) | 391 PrefixElement(SourceString prefix, Element enclosing, this.firstPosition, |
| 392 [this.patchSource]) |
| 391 : imported = new Map<SourceString, Element>(), | 393 : imported = new Map<SourceString, Element>(), |
| 392 super(prefix, ElementKind.PREFIX, enclosing); | 394 super(prefix, ElementKind.PREFIX, enclosing); |
| 393 | 395 |
| 396 CompilationUnitElement getCompilationUnit() { |
| 397 if (patchSoure !== null) return patchSource; |
| 398 return super.getCompilationUnit(); |
| 399 } |
| 400 |
| 394 lookupLocalMember(SourceString memberName) => imported[memberName]; | 401 lookupLocalMember(SourceString memberName) => imported[memberName]; |
| 395 | 402 |
| 396 Type computeType(Compiler compiler) => compiler.types.dynamicType; | 403 Type computeType(Compiler compiler) => compiler.types.dynamicType; |
| 397 | 404 |
| 398 Token position() => firstPosition; | 405 Token position() => firstPosition; |
| 399 } | 406 } |
| 400 | 407 |
| 401 class TypedefElement extends Element { | 408 class TypedefElement extends Element { |
| 402 Type cachedType; | 409 Type cachedType; |
| 403 Typedef cachedNode; | 410 Typedef cachedNode; |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 final Node node; | 1136 final Node node; |
| 1130 Type bound; | 1137 Type bound; |
| 1131 Type type; | 1138 Type type; |
| 1132 TypeVariableElement(name, Element enclosing, this.node, this.type, | 1139 TypeVariableElement(name, Element enclosing, this.node, this.type, |
| 1133 [this.bound]) | 1140 [this.bound]) |
| 1134 : super(name, ElementKind.TYPE_VARIABLE, enclosing); | 1141 : super(name, ElementKind.TYPE_VARIABLE, enclosing); |
| 1135 Type computeType(compiler) => type; | 1142 Type computeType(compiler) => type; |
| 1136 Node parseNode(compiler) => node; | 1143 Node parseNode(compiler) => node; |
| 1137 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 1144 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 1138 } | 1145 } |
| OLD | NEW |