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

Side by Side Diff: dart/frog/leg/scanner/scanner_task.dart

Issue 9413006: Handle imports of dart:core and dart:coreimpl (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/frog/leg/compiler.dart ('k') | dart/tests/language/language-leg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class ScannerTask extends CompilerTask { 5 class ScannerTask extends CompilerTask {
6 ScannerTask(Compiler compiler) : super(compiler); 6 ScannerTask(Compiler compiler) : super(compiler);
7 String get name() => 'Scanner'; 7 String get name() => 'Scanner';
8 8
9 void scan(CompilationUnitElement compilationUnit) { 9 void scan(CompilationUnitElement compilationUnit) {
10 measure(() { 10 measure(() {
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 } else if (tag.isSource()) { 37 } else if (tag.isSource()) {
38 Script script = compiler.readScript(resolved, tag); 38 Script script = compiler.readScript(resolved, tag);
39 CompilationUnitElement unit = 39 CompilationUnitElement unit =
40 new CompilationUnitElement(script, library); 40 new CompilationUnitElement(script, library);
41 compiler.withCurrentElement(unit, () => scan(unit)); 41 compiler.withCurrentElement(unit, () => scan(unit));
42 } else { 42 } else {
43 compiler.cancel("illegal script tag: ${tag.tag}", node: tag); 43 compiler.cancel("illegal script tag: ${tag.tag}", node: tag);
44 } 44 }
45 } 45 }
46 // TODO(ahe): During Compiler.scanBuiltinLibraries,
47 // compiler.coreLibrary is null. Clean this up when there is a
48 // better way to access "dart:core".
49 bool implicitlyImportCoreLibrary = compiler.coreLibrary !== null;
46 for (ScriptTag tag in imports.toLink()) { 50 for (ScriptTag tag in imports.toLink()) {
47 // Now that we have processed all the source tags, it is safe to 51 // Now that we have processed all the source tags, it is safe to
48 // start loading other libraries. 52 // start loading other libraries.
49 SourceString argument = tag.argument.value.copyWithoutQuotes(1, 1); 53 SourceString argument = tag.argument.value.copyWithoutQuotes(1, 1);
50 Uri resolved = base.resolve(argument.toString()); 54 Uri resolved = base.resolve(argument.toString());
55 if (resolved.toString() == "dart:core") {
56 implicitlyImportCoreLibrary = false;
57 }
51 importLibrary(library, loadLibrary(resolved, tag), tag.prefix); 58 importLibrary(library, loadLibrary(resolved, tag), tag.prefix);
52 } 59 }
53 if (compiler.coreLibrary !== null) { 60 if (implicitlyImportCoreLibrary) {
54 importLibrary(library, compiler.coreLibrary, null); 61 importLibrary(library, compiler.coreLibrary, null);
55 } 62 }
56 } 63 }
57 64
58 void scanElements(CompilationUnitElement compilationUnit) { 65 void scanElements(CompilationUnitElement compilationUnit) {
59 compiler.log("scanning $compilationUnit"); 66 compiler.log("scanning $compilationUnit");
60 Script script = compilationUnit.script; 67 Script script = compilationUnit.script;
61 Token tokens; 68 Token tokens;
62 try { 69 try {
63 tokens = new StringScanner(script.text).tokenize(); 70 tokens = new StringScanner(script.text).tokenize();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } else { 105 } else {
99 for (Link<Element> link = imported.topLevelElements; !link.isEmpty(); 106 for (Link<Element> link = imported.topLevelElements; !link.isEmpty();
100 link = link.tail) { 107 link = link.tail) {
101 compiler.withCurrentElement(link.head, () { 108 compiler.withCurrentElement(link.head, () {
102 library.define(link.head, compiler); 109 library.define(link.head, compiler);
103 }); 110 });
104 } 111 }
105 } 112 }
106 } 113 }
107 } 114 }
OLDNEW
« no previous file with comments | « dart/frog/leg/compiler.dart ('k') | dart/tests/language/language-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698