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

Unified Diff: dart/frog/leg/scanner/scanner_task.dart

Issue 9359039: Source in most stuff. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 8 years, 10 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
« no previous file with comments | « dart/frog/leg/scanner/listener.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/scanner/scanner_task.dart
diff --git a/dart/frog/leg/scanner/scanner_task.dart b/dart/frog/leg/scanner/scanner_task.dart
index a4a4a4a7c471bd552aa29be4dfd31a8ce91685e3..9ded910a385e0bb89cfc19a51dc9d629bb89140f 100644
--- a/dart/frog/leg/scanner/scanner_task.dart
+++ b/dart/frog/leg/scanner/scanner_task.dart
@@ -16,13 +16,18 @@ class ScannerTask extends CompilerTask {
}
void processScriptTags(LibraryElement library) {
+ LinkBuilder<ScriptTag> imports = new LinkBuilder<ScriptTag>();
+ Uri cwd = new Uri(scheme: 'file', path: compiler.currentDirectory);
+ Uri base = cwd.resolve(library.script.name.toString());
for (ScriptTag tag in library.tags.reverse()) {
SourceString argument = tag.argument.value.copyWithoutQuotes(1, 1);
- Uri cwd = new Uri(scheme: 'file', path: compiler.currentDirectory);
- Uri base = cwd.resolve(library.script.name.toString());
Uri resolved = base.resolve(argument.toString());
if (tag.isImport()) {
- importLibrary(library, loadLibrary(resolved, tag), tag.prefix);
+ // It is not safe to import other libraries at this point as
+ // another library could then observe the current library
+ // before it fully declares all the members that are sourced
+ // in.
+ imports.addLast(tag);
} else if (tag.isLibrary()) {
if (library.libraryTag !== null) {
compiler.cancel("duplicated library declaration", node: tag);
@@ -38,6 +43,13 @@ class ScannerTask extends CompilerTask {
compiler.cancel("illegal script tag: ${tag.tag}", node: tag);
}
}
+ for (ScriptTag tag in imports.toLink()) {
+ // Now that we have processed all the source tags, it is safe to
+ // start loading other libraries.
+ SourceString argument = tag.argument.value.copyWithoutQuotes(1, 1);
+ Uri resolved = base.resolve(argument.toString());
+ importLibrary(library, loadLibrary(resolved, tag), tag.prefix);
+ }
if (compiler.coreLibrary !== null) {
importLibrary(library, compiler.coreLibrary, null);
}
« no previous file with comments | « dart/frog/leg/scanner/listener.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698