Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Unified Diff: lib/compiler/implementation/scanner/scanner_task.dart

Issue 10830303: Refactor Library/CompilationUnit and how we define local Scope. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix reference in dart2js_mirror.dart Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 fb2e1fdc405e1b2940d3de557fdd9d3c46b86d6a..5da8ec42d8d48dd8f2c5bd413cc4ee30c5c1d766 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) {
ahe 2012/08/14 12:45:26 I think you need measure around this.
+ 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);
});
}
@@ -134,7 +135,7 @@ class ScannerTask extends CompilerTask {
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) {
@@ -147,7 +148,7 @@ class ScannerTask extends CompilerTask {
enclosing = new CompilationUnitOverrideElement(override, library);
}
e = new PrefixElement(prefix, enclosing, tag.getBeginToken());
- library.define(e, compiler);
+ library.addToScope(e, compiler);
}
if (e.kind !== ElementKind.PREFIX) {
compiler.withCurrentElement(e, () {
@@ -174,7 +175,7 @@ class ScannerTask extends CompilerTask {
} else {
imported.forEachExport((Element element) {
compiler.withCurrentElement(element, () {
- library.define(element, compiler);
+ library.addToScope(element, compiler);
});
});
}

Powered by Google App Engine
This is Rietveld 408576698