Chromium Code Reviews| 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..695c8d1f28288eedc9b0480fb668daa9a41157bb 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,11 @@ class ScannerTask extends CompilerTask { |
| } |
| void importLibrary(LibraryElement library, LibraryElement imported, |
| - ScriptTag tag, [CompilationUnitElement patch]) { |
| + ScriptTag tag, [LibraryElement patch]) { |
|
Lasse Reichstein Nielsen
2012/08/08 14:22:12
Again I'd prefer to have CompilationUnitElement he
Anders Johnsen
2012/08/08 17:30:37
I see. Will fix.
|
| 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) { |
| @@ -143,7 +144,7 @@ class ScannerTask extends CompilerTask { |
| Element e = library.find(prefix); |
| if (e === null) { |
| e = new PrefixElement(prefix, library, tag.getBeginToken(), patch); |
| - library.define(e, compiler); |
| + library.addToScope(e, compiler); |
| } |
| if (e.kind !== ElementKind.PREFIX) { |
| compiler.withCurrentElement(e, () { |
| @@ -170,7 +171,7 @@ class ScannerTask extends CompilerTask { |
| } else { |
| imported.forEachExport((Element element) { |
| compiler.withCurrentElement(element, () { |
| - library.define(element, compiler); |
| + library.addToScope(element, compiler); |
| }); |
| }); |
| } |