Chromium Code Reviews| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 | 306 |
| 307 void forEachExport(f(Element element)) { | 307 void forEachExport(f(Element element)) { |
| 308 elements.forEach((SourceString _, Element e) { | 308 elements.forEach((SourceString _, Element e) { |
| 309 if (this === e.getLibrary() | 309 if (this === e.getLibrary() |
| 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 | |
| 317 bool hasLibraryName() => (!tags.isEmpty()) && tags.reverse().head.isLibrary(); | |
|
ngeoffray
2012/03/23 17:22:52
The 'reverse' call looks sooooooo expensive for so
ahe
2012/03/24 08:02:03
Especially when the library tag is recorded alread
| |
| 316 } | 318 } |
| 317 | 319 |
| 318 class PrefixElement extends Element { | 320 class PrefixElement extends Element { |
| 319 Map<SourceString, Element> imported; | 321 Map<SourceString, Element> imported; |
| 320 Token firstPosition; | 322 Token firstPosition; |
| 321 | 323 |
| 322 PrefixElement(SourceString prefix, Element enclosing, this.firstPosition) | 324 PrefixElement(SourceString prefix, Element enclosing, this.firstPosition) |
| 323 : imported = new Map<SourceString, Element>(), | 325 : imported = new Map<SourceString, Element>(), |
| 324 super(prefix, ElementKind.PREFIX, enclosing); | 326 super(prefix, ElementKind.PREFIX, enclosing); |
| 325 | 327 |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 945 final Node node; | 947 final Node node; |
| 946 Type bound; | 948 Type bound; |
| 947 Type type; | 949 Type type; |
| 948 TypeVariableElement(name, Element enclosing, this.node, this.type, | 950 TypeVariableElement(name, Element enclosing, this.node, this.type, |
| 949 [this.bound]) | 951 [this.bound]) |
| 950 : super(name, ElementKind.TYPE_VARIABLE, enclosing); | 952 : super(name, ElementKind.TYPE_VARIABLE, enclosing); |
| 951 Type computeType(compiler) => type; | 953 Type computeType(compiler) => type; |
| 952 Node parseNode(compiler) => node; | 954 Node parseNode(compiler) => node; |
| 953 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 955 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 954 } | 956 } |
| OLD | NEW |