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

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

Issue 10377166: Prepare to have more than one universe. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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 scan(CompilationUnitElement compilationUnit) { 9 void scan(CompilationUnitElement compilationUnit) {
10 measure(() { 10 measure(() {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 throw; 109 throw;
110 } catch (var ex) { 110 } catch (var ex) {
111 compiler.unhandledExceptionOnElement(compilationUnit); 111 compiler.unhandledExceptionOnElement(compilationUnit);
112 throw; 112 throw;
113 } 113 }
114 } 114 }
115 115
116 LibraryElement loadLibrary(Uri uri, Node node) { 116 LibraryElement loadLibrary(Uri uri, Node node) {
117 bool newLibrary = false; 117 bool newLibrary = false;
118 LibraryElement library = 118 LibraryElement library =
119 compiler.universe.libraries.putIfAbsent(uri.toString(), () { 119 compiler.libraries.putIfAbsent(uri.toString(), () {
120 newLibrary = true; 120 newLibrary = true;
121 Script script = compiler.readScript(uri, node); 121 Script script = compiler.readScript(uri, node);
122 LibraryElement element = new LibraryElement(script); 122 LibraryElement element = new LibraryElement(script);
123 native.maybeEnableNative(compiler, element, uri); 123 native.maybeEnableNative(compiler, element, uri);
124 return element; 124 return element;
125 }); 125 });
126 if (newLibrary) { 126 if (newLibrary) {
127 compiler.withCurrentElement(library, () => scan(library)); 127 compiler.withCurrentElement(library, () => scan(library));
128 compiler.onLibraryLoaded(library, uri); 128 compiler.onLibraryLoaded(library, uri);
129 } 129 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 177 }
178 } 178 }
179 } 179 }
180 180
181 class DietParserTask extends CompilerTask { 181 class DietParserTask extends CompilerTask {
182 DietParserTask(Compiler compiler) : super(compiler); 182 DietParserTask(Compiler compiler) : super(compiler);
183 final String name = 'Diet Parser'; 183 final String name = 'Diet Parser';
184 184
185 dietParse(CompilationUnitElement compilationUnit, Token tokens) { 185 dietParse(CompilationUnitElement compilationUnit, Token tokens) {
186 measure(() { 186 measure(() {
187 Function idGenerator = compiler.universe.getNextFreeClassId; 187 Function idGenerator = compiler.getNextFreeClassId;
188 ElementListener listener = 188 ElementListener listener =
189 new ElementListener(compiler, compilationUnit, idGenerator); 189 new ElementListener(compiler, compilationUnit, idGenerator);
190 PartialParser parser = new PartialParser(listener); 190 PartialParser parser = new PartialParser(listener);
191 parser.parseUnit(tokens); 191 parser.parseUnit(tokens);
192 }); 192 });
193 } 193 }
194 } 194 }
195 195
196 /** 196 /**
197 * The fields of this class models a state machine for checking script 197 * The fields of this class models a state machine for checking script
198 * tags come in the correct order. 198 * tags come in the correct order.
199 */ 199 */
200 class TagState { 200 class TagState {
201 static final int NO_TAG_SEEN = 0; 201 static final int NO_TAG_SEEN = 0;
202 static final int LIBRARY = 1; 202 static final int LIBRARY = 1;
203 static final int IMPORT = 2; 203 static final int IMPORT = 2;
204 static final int SOURCE = 3; 204 static final int SOURCE = 3;
205 static final int RESOURCE = 4; 205 static final int RESOURCE = 4;
206 206
207 /** Next state. */ 207 /** Next state. */
208 static final List<int> NEXT = 208 static final List<int> NEXT =
209 const <int>[NO_TAG_SEEN, 209 const <int>[NO_TAG_SEEN,
210 IMPORT, // Only one library tag is allowed. 210 IMPORT, // Only one library tag is allowed.
211 IMPORT, 211 IMPORT,
212 SOURCE, 212 SOURCE,
213 RESOURCE]; 213 RESOURCE];
214 } 214 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/resolver.dart ('k') | dart/lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698