| 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('dart:uri'); | 7 #import('dart:uri'); |
| 8 | 8 |
| 9 #import('../tree/tree.dart'); | 9 #import('../tree/tree.dart'); |
| 10 #import('../scanner/scannerlib.dart'); | 10 #import('../scanner/scannerlib.dart'); |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 super(compilationUnit.name, | 475 super(compilationUnit.name, |
| 476 ElementKind.COMPILATION_UNIT_OVERRIDE, | 476 ElementKind.COMPILATION_UNIT_OVERRIDE, |
| 477 enclosing); | 477 enclosing); |
| 478 } | 478 } |
| 479 | 479 |
| 480 class LibraryElement extends ScopeContainerElement { | 480 class LibraryElement extends ScopeContainerElement { |
| 481 final Uri uri; | 481 final Uri uri; |
| 482 CompilationUnitElement entryCompilationUnit; | 482 CompilationUnitElement entryCompilationUnit; |
| 483 Link<CompilationUnitElement> compilationUnits = | 483 Link<CompilationUnitElement> compilationUnits = |
| 484 const EmptyLink<CompilationUnitElement>(); | 484 const EmptyLink<CompilationUnitElement>(); |
| 485 Link<ScriptTag> tags = const EmptyLink<ScriptTag>(); | 485 Link<LibraryTag> tags = const EmptyLink<LibraryTag>(); |
| 486 ScriptTag libraryTag; | 486 LibraryTag libraryTag; |
| 487 bool canUseNative = false; | 487 bool canUseNative = false; |
| 488 LibraryElement patch = null; | 488 LibraryElement patch = null; |
| 489 | 489 |
| 490 LibraryElement(Script script, [Uri uri]) | 490 LibraryElement(Script script, [Uri uri]) |
| 491 : this.uri = ((uri === null) ? script.uri : uri), | 491 : this.uri = ((uri === null) ? script.uri : uri), |
| 492 super(new SourceString(script.name), ElementKind.LIBRARY, null) { | 492 super(new SourceString(script.name), ElementKind.LIBRARY, null) { |
| 493 entryCompilationUnit = new CompilationUnitElement(script, this); | 493 entryCompilationUnit = new CompilationUnitElement(script, this); |
| 494 } | 494 } |
| 495 | 495 |
| 496 | 496 |
| 497 bool get isPatched => patch !== null; | 497 bool get isPatched => patch !== null; |
| 498 | 498 |
| 499 void addCompilationUnit(CompilationUnitElement element) { | 499 void addCompilationUnit(CompilationUnitElement element) { |
| 500 compilationUnits = compilationUnits.prepend(element); | 500 compilationUnits = compilationUnits.prepend(element); |
| 501 } | 501 } |
| 502 | 502 |
| 503 void addTag(ScriptTag tag, DiagnosticListener listener) { | 503 void addTag(LibraryTag tag, DiagnosticListener listener) { |
| 504 tags = tags.prepend(tag); | 504 tags = tags.prepend(tag); |
| 505 } | 505 } |
| 506 | 506 |
| 507 /** Look up a top-level element in this library. The element could | 507 /** Look up a top-level element in this library. The element could |
| 508 * potentially have been imported from another library. Returns | 508 * potentially have been imported from another library. Returns |
| 509 * null if no such element exist. */ | 509 * null if no such element exist. */ |
| 510 Element find(SourceString elementName) { | 510 Element find(SourceString elementName) { |
| 511 return localScope[elementName]; | 511 return localScope[elementName]; |
| 512 } | 512 } |
| 513 | 513 |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 | 1691 |
| 1692 MetadataAnnotation ensureResolved(Compiler compiler) { | 1692 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 1693 if (resolutionState == STATE_NOT_STARTED) { | 1693 if (resolutionState == STATE_NOT_STARTED) { |
| 1694 compiler.resolver.resolveMetadataAnnotation(this); | 1694 compiler.resolver.resolveMetadataAnnotation(this); |
| 1695 } | 1695 } |
| 1696 return this; | 1696 return this; |
| 1697 } | 1697 } |
| 1698 | 1698 |
| 1699 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1699 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 1700 } | 1700 } |
| OLD | NEW |