| OLD | NEW |
| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // better way to access "dart:core". | 73 // better way to access "dart:core". |
| 74 bool implicitlyImportCoreLibrary = compiler.coreLibrary !== null; | 74 bool implicitlyImportCoreLibrary = compiler.coreLibrary !== null; |
| 75 for (ScriptTag tag in imports.toLink()) { | 75 for (ScriptTag tag in imports.toLink()) { |
| 76 // Now that we have processed all the source tags, it is safe to | 76 // Now that we have processed all the source tags, it is safe to |
| 77 // start loading other libraries. | 77 // start loading other libraries. |
| 78 StringNode argument = tag.argument; | 78 StringNode argument = tag.argument; |
| 79 Uri resolved = base.resolve(argument.dartString.slowToString()); | 79 Uri resolved = base.resolve(argument.dartString.slowToString()); |
| 80 if (resolved.toString() == "dart:core") { | 80 if (resolved.toString() == "dart:core") { |
| 81 implicitlyImportCoreLibrary = false; | 81 implicitlyImportCoreLibrary = false; |
| 82 } | 82 } |
| 83 importLibrary(library, loadLibrary(resolved, argument), tag); | 83 LibraryElement importedLibrary = loadLibrary(resolved, argument); |
| 84 importLibrary(library, importedLibrary, tag); |
| 85 if (resolved.scheme == "dart") { |
| 86 compiler.patchDartLibrary(importedLibrary, resolved.path); |
| 87 } |
| 84 } | 88 } |
| 85 if (implicitlyImportCoreLibrary) { | 89 if (implicitlyImportCoreLibrary) { |
| 86 importLibrary(library, compiler.coreLibrary, null); | 90 importLibrary(library, compiler.coreLibrary, null); |
| 87 } | 91 } |
| 88 } | 92 } |
| 89 | 93 |
| 90 void scanElements(CompilationUnitElement compilationUnit) { | 94 void scanElements(CompilationUnitElement compilationUnit) { |
| 91 Script script = compilationUnit.script; | 95 Script script = compilationUnit.script; |
| 92 Token tokens; | 96 Token tokens; |
| 93 try { | 97 try { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 static final int RESOURCE = 4; | 204 static final int RESOURCE = 4; |
| 201 | 205 |
| 202 /** Next state. */ | 206 /** Next state. */ |
| 203 static final List<int> NEXT = | 207 static final List<int> NEXT = |
| 204 const <int>[NO_TAG_SEEN, | 208 const <int>[NO_TAG_SEEN, |
| 205 IMPORT, // Only one library tag is allowed. | 209 IMPORT, // Only one library tag is allowed. |
| 206 IMPORT, | 210 IMPORT, |
| 207 SOURCE, | 211 SOURCE, |
| 208 RESOURCE]; | 212 RESOURCE]; |
| 209 } | 213 } |
| OLD | NEW |