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 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 | 1051 |
1052 if (verbose) { | 1052 if (verbose) { |
1053 progress = new Stopwatch()..start(); | 1053 progress = new Stopwatch()..start(); |
1054 } | 1054 } |
1055 | 1055 |
1056 // TODO(johnniwinther): Separate the dependency tracking from the enqueueing | 1056 // TODO(johnniwinther): Separate the dependency tracking from the enqueueing |
1057 // for global dependencies. | 1057 // for global dependencies. |
1058 globalDependencies = | 1058 globalDependencies = |
1059 new CodegenRegistry(this, new TreeElementMapping(null)); | 1059 new CodegenRegistry(this, new TreeElementMapping(null)); |
1060 | 1060 |
| 1061 SourceInformationFactory sourceInformationFactory = |
| 1062 const SourceInformationFactory(); |
| 1063 if (generateSourceMap) { |
| 1064 sourceInformationFactory = |
| 1065 const bool.fromEnvironment('USE_NEW_SOURCE_INFO', defaultValue: false) |
| 1066 ? const PositionSourceInformationFactory() |
| 1067 : const StartEndSourceInformationFactory(); |
| 1068 } |
1061 if (emitJavaScript) { | 1069 if (emitJavaScript) { |
1062 js_backend.JavaScriptBackend jsBackend = | 1070 js_backend.JavaScriptBackend jsBackend = new js_backend.JavaScriptBackend( |
1063 new js_backend.JavaScriptBackend(this, generateSourceMap); | 1071 this, sourceInformationFactory, generateSourceMap: generateSourceMap); |
1064 backend = jsBackend; | 1072 backend = jsBackend; |
1065 } else { | 1073 } else { |
1066 backend = new dart_backend.DartBackend(this, strips, | 1074 backend = new dart_backend.DartBackend(this, strips, |
1067 multiFile: dart2dartMultiFile); | 1075 multiFile: dart2dartMultiFile); |
1068 if (dumpInfo) { | 1076 if (dumpInfo) { |
1069 throw new ArgumentError('--dump-info is not supported for dart2dart.'); | 1077 throw new ArgumentError('--dump-info is not supported for dart2dart.'); |
1070 } | 1078 } |
1071 } | 1079 } |
1072 | 1080 |
1073 tasks = [ | 1081 tasks = [ |
1074 libraryLoader = new LibraryLoaderTask(this), | 1082 libraryLoader = new LibraryLoaderTask(this), |
1075 scanner = new ScannerTask(this), | 1083 scanner = new ScannerTask(this), |
1076 dietParser = new DietParserTask(this), | 1084 dietParser = new DietParserTask(this), |
1077 parser = new ParserTask(this), | 1085 parser = new ParserTask(this), |
1078 patchParser = new PatchParserTask(this), | 1086 patchParser = new PatchParserTask(this), |
1079 resolver = new ResolverTask(this, backend.constantCompilerTask), | 1087 resolver = new ResolverTask(this, backend.constantCompilerTask), |
1080 closureToClassMapper = new closureMapping.ClosureTask(this), | 1088 closureToClassMapper = new closureMapping.ClosureTask(this), |
1081 checker = new TypeCheckerTask(this), | 1089 checker = new TypeCheckerTask(this), |
1082 irBuilder = new IrBuilderTask(this), | 1090 irBuilder = new IrBuilderTask(this, sourceInformationFactory), |
1083 typesTask = new ti.TypesTask(this), | 1091 typesTask = new ti.TypesTask(this), |
1084 constants = backend.constantCompilerTask, | 1092 constants = backend.constantCompilerTask, |
1085 deferredLoadTask = new DeferredLoadTask(this), | 1093 deferredLoadTask = new DeferredLoadTask(this), |
1086 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 1094 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
1087 enqueuer = new EnqueueTask(this), | 1095 enqueuer = new EnqueueTask(this), |
1088 dumpInfoTask = new DumpInfoTask(this), | 1096 dumpInfoTask = new DumpInfoTask(this), |
1089 reuseLibraryTask = new GenericTask('Reuse library', this), | 1097 reuseLibraryTask = new GenericTask('Reuse library', this), |
1090 ]; | 1098 ]; |
1091 | 1099 |
1092 tasks.addAll(backend.tasks); | 1100 tasks.addAll(backend.tasks); |
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2425 return futureClass.computeType(compiler).createInstantiation([elementType]); | 2433 return futureClass.computeType(compiler).createInstantiation([elementType]); |
2426 } | 2434 } |
2427 | 2435 |
2428 @override | 2436 @override |
2429 InterfaceType streamType([DartType elementType = const DynamicType()]) { | 2437 InterfaceType streamType([DartType elementType = const DynamicType()]) { |
2430 return streamClass.computeType(compiler).createInstantiation([elementType]); | 2438 return streamClass.computeType(compiler).createInstantiation([elementType]); |
2431 } | 2439 } |
2432 } | 2440 } |
2433 | 2441 |
2434 typedef void InternalErrorFunction(Spannable location, String message); | 2442 typedef void InternalErrorFunction(Spannable location, String message); |
OLD | NEW |