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