| Index: lib/compiler/implementation/scanner/scanner_task.dart
|
| diff --git a/lib/compiler/implementation/scanner/scanner_task.dart b/lib/compiler/implementation/scanner/scanner_task.dart
|
| index a1ed5fb6ba1faf9dd96d814c8bd959a64ad8bda7..d3aee92515d299aa958a1754aa431c10c96df67f 100644
|
| --- a/lib/compiler/implementation/scanner/scanner_task.dart
|
| +++ b/lib/compiler/implementation/scanner/scanner_task.dart
|
| @@ -6,15 +6,16 @@ class ScannerTask extends CompilerTask {
|
| ScannerTask(Compiler compiler) : super(compiler);
|
| String get name() => 'Scanner';
|
|
|
| + void scanLibrary(LibraryElement library) {
|
| + var compilationUnit = library.entryCompilationUnit;
|
| + compiler.log("scanning library ${compilationUnit.script.name}");
|
| + scan(compilationUnit);
|
| + processScriptTags(library);
|
| + }
|
| +
|
| void scan(CompilationUnitElement compilationUnit) {
|
| measure(() {
|
| - if (compilationUnit.kind === ElementKind.LIBRARY) {
|
| - compiler.log("scanning library ${compilationUnit.script.name}");
|
| - }
|
| scanElements(compilationUnit);
|
| - if (compilationUnit.kind === ElementKind.LIBRARY) {
|
| - processScriptTags(compilationUnit);
|
| - }
|
| });
|
| }
|
|
|
| @@ -35,7 +36,7 @@ class ScannerTask extends CompilerTask {
|
| }
|
|
|
| LinkBuilder<ScriptTag> imports = new LinkBuilder<ScriptTag>();
|
| - Uri base = library.script.uri;
|
| + Uri base = library.uri;
|
| for (ScriptTag tag in library.tags.reverse()) {
|
| StringNode argument = tag.argument;
|
| // TODO(lrn): Support interpolations here. We need access to the
|
| @@ -122,7 +123,7 @@ class ScannerTask extends CompilerTask {
|
| });
|
| if (newLibrary) {
|
| compiler.withCurrentElement(library, () {
|
| - scan(library);
|
| + scanLibrary(library);
|
| compiler.onLibraryLoaded(library, uri);
|
| });
|
| }
|
| @@ -130,11 +131,12 @@ class ScannerTask extends CompilerTask {
|
| }
|
|
|
| void importLibrary(LibraryElement library, LibraryElement imported,
|
| - ScriptTag tag, [CompilationUnitElement patch]) {
|
| + ScriptTag tag,
|
| + [CompilationUnitElement patchCompilationUnit]) {
|
| if (!imported.hasLibraryName()) {
|
| compiler.withCurrentElement(library, () {
|
| compiler.reportError(tag === null ? null : tag.argument,
|
| - 'no #library tag found in ${imported.script.uri}');
|
| + 'no #library tag found in ${imported.uri}');
|
| });
|
| }
|
| if (tag !== null && tag.prefix !== null) {
|
| @@ -142,8 +144,9 @@ class ScannerTask extends CompilerTask {
|
| new SourceString(tag.prefix.dartString.slowToString());
|
| Element e = library.find(prefix);
|
| if (e === null) {
|
| - e = new PrefixElement(prefix, library, tag.getBeginToken(), patch);
|
| - library.define(e, compiler);
|
| + e = new PrefixElement(prefix, library, tag.getBeginToken(),
|
| + patchCompilationUnit);
|
| + library.addToScope(e, compiler);
|
| }
|
| if (e.kind !== ElementKind.PREFIX) {
|
| compiler.withCurrentElement(e, () {
|
| @@ -170,7 +173,7 @@ class ScannerTask extends CompilerTask {
|
| } else {
|
| imported.forEachExport((Element element) {
|
| compiler.withCurrentElement(element, () {
|
| - library.define(element, compiler);
|
| + library.addToScope(element, compiler);
|
| });
|
| });
|
| }
|
|
|