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 part of dart2js; | 5 part of dart2js; |
6 | 6 |
7 /** | 7 /** |
8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
9 * compiled. | 9 * compiled. |
10 */ | 10 */ |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 /// constants. | 265 /// constants. |
266 BackendConstantEnvironment get constants; | 266 BackendConstantEnvironment get constants; |
267 | 267 |
268 /// The compiler task responsible for the compilation of constants for both | 268 /// The compiler task responsible for the compilation of constants for both |
269 /// the frontend and the backend. | 269 /// the frontend and the backend. |
270 ConstantCompilerTask get constantCompilerTask; | 270 ConstantCompilerTask get constantCompilerTask; |
271 | 271 |
272 /// Backend callback methods for the resolution phase. | 272 /// Backend callback methods for the resolution phase. |
273 ResolutionCallbacks get resolutionCallbacks; | 273 ResolutionCallbacks get resolutionCallbacks; |
274 | 274 |
| 275 /// The strategy used for collecting and emitting source information. |
| 276 SourceInformationStrategy get sourceInformationStrategy { |
| 277 return const SourceInformationStrategy(); |
| 278 } |
| 279 |
275 // TODO(johnniwinther): Move this to the JavaScriptBackend. | 280 // TODO(johnniwinther): Move this to the JavaScriptBackend. |
276 String get patchVersion => null; | 281 String get patchVersion => null; |
277 | 282 |
278 /// Set of classes that need to be considered for reflection although not | 283 /// Set of classes that need to be considered for reflection although not |
279 /// otherwise visible during resolution. | 284 /// otherwise visible during resolution. |
280 Iterable<ClassElement> classesRequiredForReflection = const []; | 285 Iterable<ClassElement> classesRequiredForReflection = const []; |
281 | 286 |
282 // Given a [FunctionElement], return a buffer with the code generated for it | 287 // Given a [FunctionElement], return a buffer with the code generated for it |
283 // or null if no code was generated. | 288 // or null if no code was generated. |
284 CodeBuffer codeOf(Element element) => null; | 289 CodeBuffer codeOf(Element element) => null; |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 | 1091 |
1087 if (verbose) { | 1092 if (verbose) { |
1088 progress = new Stopwatch()..start(); | 1093 progress = new Stopwatch()..start(); |
1089 } | 1094 } |
1090 | 1095 |
1091 // TODO(johnniwinther): Separate the dependency tracking from the enqueuing | 1096 // TODO(johnniwinther): Separate the dependency tracking from the enqueuing |
1092 // for global dependencies. | 1097 // for global dependencies. |
1093 globalDependencies = | 1098 globalDependencies = |
1094 new CodegenRegistry(this, new TreeElementMapping(null)); | 1099 new CodegenRegistry(this, new TreeElementMapping(null)); |
1095 | 1100 |
1096 SourceInformationFactory sourceInformationFactory = | |
1097 const SourceInformationFactory(); | |
1098 if (generateSourceMap) { | |
1099 sourceInformationFactory = | |
1100 const bool.fromEnvironment('USE_NEW_SOURCE_INFO', defaultValue: false) | |
1101 ? const PositionSourceInformationFactory() | |
1102 : const StartEndSourceInformationFactory(); | |
1103 } | |
1104 if (emitJavaScript) { | 1101 if (emitJavaScript) { |
1105 js_backend.JavaScriptBackend jsBackend = new js_backend.JavaScriptBackend( | 1102 js_backend.JavaScriptBackend jsBackend = |
1106 this, sourceInformationFactory, generateSourceMap: generateSourceMap); | 1103 new js_backend.JavaScriptBackend( |
| 1104 this, generateSourceMap: generateSourceMap); |
1107 backend = jsBackend; | 1105 backend = jsBackend; |
1108 } else { | 1106 } else { |
1109 backend = new dart_backend.DartBackend(this, strips, | 1107 backend = new dart_backend.DartBackend(this, strips, |
1110 multiFile: dart2dartMultiFile); | 1108 multiFile: dart2dartMultiFile); |
1111 if (dumpInfo) { | 1109 if (dumpInfo) { |
1112 throw new ArgumentError('--dump-info is not supported for dart2dart.'); | 1110 throw new ArgumentError('--dump-info is not supported for dart2dart.'); |
1113 } | 1111 } |
1114 } | 1112 } |
1115 | 1113 |
1116 tasks = [ | 1114 tasks = [ |
1117 libraryLoader = new LibraryLoaderTask(this), | 1115 libraryLoader = new LibraryLoaderTask(this), |
1118 scanner = new ScannerTask(this), | 1116 scanner = new ScannerTask(this), |
1119 dietParser = new DietParserTask(this), | 1117 dietParser = new DietParserTask(this), |
1120 parser = new ParserTask(this), | 1118 parser = new ParserTask(this), |
1121 patchParser = new PatchParserTask(this), | 1119 patchParser = new PatchParserTask(this), |
1122 resolver = new ResolverTask(this, backend.constantCompilerTask), | 1120 resolver = new ResolverTask(this, backend.constantCompilerTask), |
1123 closureToClassMapper = new closureMapping.ClosureTask(this), | 1121 closureToClassMapper = new closureMapping.ClosureTask(this), |
1124 checker = new TypeCheckerTask(this), | 1122 checker = new TypeCheckerTask(this), |
1125 irBuilder = new IrBuilderTask(this, sourceInformationFactory), | 1123 irBuilder = new IrBuilderTask(this, backend.sourceInformationStrategy), |
1126 typesTask = new ti.TypesTask(this), | 1124 typesTask = new ti.TypesTask(this), |
1127 constants = backend.constantCompilerTask, | 1125 constants = backend.constantCompilerTask, |
1128 deferredLoadTask = new DeferredLoadTask(this), | 1126 deferredLoadTask = new DeferredLoadTask(this), |
1129 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 1127 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
1130 enqueuer = new EnqueueTask(this), | 1128 enqueuer = new EnqueueTask(this), |
1131 dumpInfoTask = new DumpInfoTask(this), | 1129 dumpInfoTask = new DumpInfoTask(this), |
1132 reuseLibraryTask = new GenericTask('Reuse library', this), | 1130 reuseLibraryTask = new GenericTask('Reuse library', this), |
1133 ]; | 1131 ]; |
1134 | 1132 |
1135 tasks.addAll(backend.tasks); | 1133 tasks.addAll(backend.tasks); |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 InterfaceType streamType([DartType elementType]) { | 2505 InterfaceType streamType([DartType elementType]) { |
2508 InterfaceType type = streamClass.computeType(compiler); | 2506 InterfaceType type = streamClass.computeType(compiler); |
2509 if (elementType == null) { | 2507 if (elementType == null) { |
2510 return streamClass.rawType; | 2508 return streamClass.rawType; |
2511 } | 2509 } |
2512 return type.createInstantiation([elementType]); | 2510 return type.createInstantiation([elementType]); |
2513 } | 2511 } |
2514 } | 2512 } |
2515 | 2513 |
2516 typedef void InternalErrorFunction(Spannable location, String message); | 2514 typedef void InternalErrorFunction(Spannable location, String message); |
OLD | NEW |