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 | 5 |
6 /** | 6 /** |
7 * If true, print a warning for each method that was resolved, but not | 7 * If true, print a warning for each method that was resolved, but not |
8 * compiled. | 8 * compiled. |
9 */ | 9 */ |
10 const bool REPORT_EXCESS_RESOLUTION = false; | 10 const bool REPORT_EXCESS_RESOLUTION = false; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 backend = emitJavaScript ? | 196 backend = emitJavaScript ? |
197 new js_backend.JavaScriptBackend(this, generateSourceMap) : | 197 new js_backend.JavaScriptBackend(this, generateSourceMap) : |
198 new dart_backend.DartBackend(this, cutDeclarationTypes); | 198 new dart_backend.DartBackend(this, cutDeclarationTypes); |
199 constantHandler = new ConstantHandler(this, backend.constantSystem); | 199 constantHandler = new ConstantHandler(this, backend.constantSystem); |
200 enqueuer = new EnqueueTask(this); | 200 enqueuer = new EnqueueTask(this); |
201 tasks = [scanner, dietParser, parser, resolver, closureToClassMapper, | 201 tasks = [scanner, dietParser, parser, resolver, closureToClassMapper, |
202 checker, typesTask, constantHandler, enqueuer]; | 202 checker, typesTask, constantHandler, enqueuer]; |
203 tasks.addAll(backend.tasks); | 203 tasks.addAll(backend.tasks); |
204 } | 204 } |
205 | 205 |
| 206 // TODO(floitsch): remove once the compile-time constant handler doesn't |
| 207 // depend on it anymore. |
| 208 js_backend.Namer get namer => (backend as js_backend.JavaScriptBackend).namer; |
| 209 |
206 Universe get resolverWorld => enqueuer.resolution.universe; | 210 Universe get resolverWorld => enqueuer.resolution.universe; |
207 Universe get codegenWorld => enqueuer.codegen.universe; | 211 Universe get codegenWorld => enqueuer.codegen.universe; |
208 | 212 |
209 int getNextFreeClassId() => nextFreeClassId++; | 213 int getNextFreeClassId() => nextFreeClassId++; |
210 | 214 |
211 void ensure(bool condition) { | 215 void ensure(bool condition) { |
212 if (!condition) cancel('failed assertion in leg'); | 216 if (!condition) cancel('failed assertion in leg'); |
213 } | 217 } |
214 | 218 |
215 void unimplemented(String methodName, | 219 void unimplemented(String methodName, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 coreImplLibrary = scanBuiltinLibrary('coreimpl'); | 356 coreImplLibrary = scanBuiltinLibrary('coreimpl'); |
353 jsHelperLibrary = scanBuiltinLibrary('_js_helper'); | 357 jsHelperLibrary = scanBuiltinLibrary('_js_helper'); |
354 interceptorsLibrary = scanBuiltinLibrary('_interceptors'); | 358 interceptorsLibrary = scanBuiltinLibrary('_interceptors'); |
355 | 359 |
356 addForeignFunctions(jsHelperLibrary); | 360 addForeignFunctions(jsHelperLibrary); |
357 addForeignFunctions(interceptorsLibrary); | 361 addForeignFunctions(interceptorsLibrary); |
358 | 362 |
359 libraries['dart:core'] = coreLibrary; | 363 libraries['dart:core'] = coreLibrary; |
360 libraries['dart:coreimpl'] = coreImplLibrary; | 364 libraries['dart:coreimpl'] = coreImplLibrary; |
361 | 365 |
362 assertMethod = coreLibrary.find(const SourceString('assert')); | 366 assertMethod = jsHelperLibrary.find(const SourceString('assert')); |
363 | 367 |
364 initializeSpecialClasses(); | 368 initializeSpecialClasses(); |
365 } | 369 } |
366 | 370 |
367 void importCoreLibrary(LibraryElement library) { | 371 void importCoreLibrary(LibraryElement library) { |
368 Uri coreUri = new Uri.fromComponents(scheme: 'dart', path: 'core'); | 372 Uri coreUri = new Uri.fromComponents(scheme: 'dart', path: 'core'); |
369 if (coreLibrary === null) { | 373 if (coreLibrary === null) { |
370 coreLibrary = scanner.loadLibrary(coreUri, null, coreUri); | 374 coreLibrary = scanner.loadLibrary(coreUri, null, coreUri); |
371 } | 375 } |
372 scanner.importLibrary(library, | 376 scanner.importLibrary(library, |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 final endOffset = end.charOffset + end.slowCharCount; | 926 final endOffset = end.charOffset + end.slowCharCount; |
923 | 927 |
924 // [begin] and [end] might be the same for the same empty token. This | 928 // [begin] and [end] might be the same for the same empty token. This |
925 // happens for instance when scanning '$$'. | 929 // happens for instance when scanning '$$'. |
926 assert(endOffset >= beginOffset); | 930 assert(endOffset >= beginOffset); |
927 return f(beginOffset, endOffset); | 931 return f(beginOffset, endOffset); |
928 } | 932 } |
929 | 933 |
930 String toString() => 'SourceSpan($uri, $begin, $end)'; | 934 String toString() => 'SourceSpan($uri, $begin, $end)'; |
931 } | 935 } |
OLD | NEW |