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

Side by Side Diff: lib/compiler/implementation/scanner/scanner_task.dart

Issue 10967068: Stop importing js_helper.dart explicitly in the core library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Undid changes not necessary for main compiler change. Created 8 years, 3 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
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 scanLibrary(LibraryElement library) { 9 void scanLibrary(LibraryElement library) {
10 var compilationUnit = library.entryCompilationUnit; 10 var compilationUnit = library.entryCompilationUnit;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 void scanElements(CompilationUnitElement compilationUnit) { 110 void scanElements(CompilationUnitElement compilationUnit) {
111 Script script = compilationUnit.script; 111 Script script = compilationUnit.script;
112 Token tokens = new StringScanner(script.text).tokenize(); 112 Token tokens = new StringScanner(script.text).tokenize();
113 compiler.dietParser.dietParse(compilationUnit, tokens); 113 compiler.dietParser.dietParse(compilationUnit, tokens);
114 } 114 }
115 115
116 LibraryElement loadLibrary(Uri uri, Node node, Uri canonicalUri) { 116 LibraryElement loadLibrary(Uri uri, Node node, Uri canonicalUri) {
117 bool newLibrary = false; 117 bool newLibrary = false;
118 LibraryElement library = 118 LibraryElement createLibrary() {
119 compiler.libraries.putIfAbsent(uri.toString(), () { 119 newLibrary = true;
120 newLibrary = true; 120 Script script = compiler.readScript(uri, node);
121 Script script = compiler.readScript(uri, node); 121 LibraryElement element = new LibraryElement(script, canonicalUri);
122 LibraryElement element = new LibraryElement(script, canonicalUri); 122 native.maybeEnableNative(compiler, element, uri);
123 native.maybeEnableNative(compiler, element, uri); 123 return element;
124 return element; 124 }
125 }); 125 LibraryElement library;
126 if (canonicalUri === null) {
127 library = createLibrary();
128 } else {
129 library = compiler.libraries.putIfAbsent(canonicalUri.toString(),
130 createLibrary);
131 }
126 if (newLibrary) { 132 if (newLibrary) {
127 compiler.withCurrentElement(library, () { 133 compiler.withCurrentElement(library, () {
128 scanLibrary(library); 134 scanLibrary(library);
129 compiler.onLibraryLoaded(library, uri); 135 compiler.onLibraryLoaded(library, uri);
130 }); 136 });
131 } 137 }
132 return library; 138 return library;
133 } 139 }
134 140
135 void importLibrary(LibraryElement library, LibraryElement imported, 141 void importLibrary(LibraryElement library, LibraryElement imported,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 static const int RESOURCE = 4; 215 static const int RESOURCE = 4;
210 216
211 /** Next state. */ 217 /** Next state. */
212 static const List<int> NEXT = 218 static const List<int> NEXT =
213 const <int>[NO_TAG_SEEN, 219 const <int>[NO_TAG_SEEN,
214 IMPORT, // Only one library tag is allowed. 220 IMPORT, // Only one library tag is allowed.
215 IMPORT, 221 IMPORT,
216 SOURCE, 222 SOURCE,
217 RESOURCE]; 223 RESOURCE];
218 } 224 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698