| 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 | 542 |
| 543 FunctionElement helperForMainArity() => null; | 543 FunctionElement helperForMainArity() => null; |
| 544 | 544 |
| 545 void forgetElement(Element element) {} | 545 void forgetElement(Element element) {} |
| 546 | 546 |
| 547 void registerMainHasArguments(Enqueuer enqueuer) {} | 547 void registerMainHasArguments(Enqueuer enqueuer) {} |
| 548 | 548 |
| 549 void registerAsyncMarker(FunctionElement element, | 549 void registerAsyncMarker(FunctionElement element, |
| 550 Enqueuer enqueuer, | 550 Enqueuer enqueuer, |
| 551 Registry registry) {} | 551 Registry registry) {} |
| 552 |
| 553 EnqueueTask makeEnqueuer() => new EnqueueTask(compiler); |
| 552 } | 554 } |
| 553 | 555 |
| 554 /// Backend callbacks function specific to the resolution phase. | 556 /// Backend callbacks function specific to the resolution phase. |
| 555 class ResolutionCallbacks { | 557 class ResolutionCallbacks { |
| 556 /// Register that [node] is a call to `assert`. | 558 /// Register that [node] is a call to `assert`. |
| 557 void onAssert(Send node, Registry registry) {} | 559 void onAssert(Send node, Registry registry) {} |
| 558 | 560 |
| 559 /// Register that an 'await for' has been seen. | 561 /// Register that an 'await for' has been seen. |
| 560 void onAsyncForIn(AsyncForIn node, Registry registry) {} | 562 void onAsyncForIn(AsyncForIn node, Registry registry) {} |
| 561 | 563 |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 bool useStartupEmitter: false, | 1061 bool useStartupEmitter: false, |
| 1060 this.useContentSecurityPolicy: false, | 1062 this.useContentSecurityPolicy: false, |
| 1061 this.suppressWarnings: false, | 1063 this.suppressWarnings: false, |
| 1062 this.fatalWarnings: false, | 1064 this.fatalWarnings: false, |
| 1063 bool hasIncrementalSupport: false, | 1065 bool hasIncrementalSupport: false, |
| 1064 this.enableExperimentalMirrors: false, | 1066 this.enableExperimentalMirrors: false, |
| 1065 this.allowNativeExtensions: false, | 1067 this.allowNativeExtensions: false, |
| 1066 this.generateCodeWithCompileTimeErrors: false, | 1068 this.generateCodeWithCompileTimeErrors: false, |
| 1067 this.testMode: false, | 1069 this.testMode: false, |
| 1068 api.CompilerOutput outputProvider, | 1070 api.CompilerOutput outputProvider, |
| 1069 List<String> strips: const []}) | 1071 List<String> strips: const [], |
| 1072 Backend makeBackend(Compiler compiler)}) |
| 1070 : this.disableTypeInferenceFlag = | 1073 : this.disableTypeInferenceFlag = |
| 1071 disableTypeInferenceFlag || !emitJavaScript, | 1074 disableTypeInferenceFlag || !emitJavaScript, |
| 1072 this.analyzeOnly = | 1075 this.analyzeOnly = |
| 1073 analyzeOnly || analyzeSignaturesOnly || analyzeAllFlag, | 1076 analyzeOnly || analyzeSignaturesOnly || analyzeAllFlag, |
| 1074 this.analyzeSignaturesOnly = analyzeSignaturesOnly, | 1077 this.analyzeSignaturesOnly = analyzeSignaturesOnly, |
| 1075 this.analyzeAllFlag = analyzeAllFlag, | 1078 this.analyzeAllFlag = analyzeAllFlag, |
| 1076 this.hasIncrementalSupport = hasIncrementalSupport, | 1079 this.hasIncrementalSupport = hasIncrementalSupport, |
| 1077 cacheStrategy = new CacheStrategy(hasIncrementalSupport), | 1080 cacheStrategy = new CacheStrategy(hasIncrementalSupport), |
| 1078 this.userOutputProvider = outputProvider == null | 1081 this.userOutputProvider = outputProvider == null |
| 1079 ? const NullCompilerOutput() : outputProvider { | 1082 ? const NullCompilerOutput() : outputProvider { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1091 | 1094 |
| 1092 if (verbose) { | 1095 if (verbose) { |
| 1093 progress = new Stopwatch()..start(); | 1096 progress = new Stopwatch()..start(); |
| 1094 } | 1097 } |
| 1095 | 1098 |
| 1096 // TODO(johnniwinther): Separate the dependency tracking from the enqueuing | 1099 // TODO(johnniwinther): Separate the dependency tracking from the enqueuing |
| 1097 // for global dependencies. | 1100 // for global dependencies. |
| 1098 globalDependencies = | 1101 globalDependencies = |
| 1099 new CodegenRegistry(this, new TreeElementMapping(null)); | 1102 new CodegenRegistry(this, new TreeElementMapping(null)); |
| 1100 | 1103 |
| 1101 if (emitJavaScript) { | 1104 if (makeBackend != null) { |
| 1105 backend = makeBackend(this); |
| 1106 } else if (emitJavaScript) { |
| 1102 js_backend.JavaScriptBackend jsBackend = | 1107 js_backend.JavaScriptBackend jsBackend = |
| 1103 new js_backend.JavaScriptBackend( | 1108 new js_backend.JavaScriptBackend( |
| 1104 this, generateSourceMap: generateSourceMap, | 1109 this, generateSourceMap: generateSourceMap, |
| 1105 useStartupEmitter: useStartupEmitter); | 1110 useStartupEmitter: useStartupEmitter); |
| 1106 backend = jsBackend; | 1111 backend = jsBackend; |
| 1107 } else { | 1112 } else { |
| 1108 backend = new dart_backend.DartBackend(this, strips, | 1113 backend = new dart_backend.DartBackend(this, strips, |
| 1109 multiFile: dart2dartMultiFile); | 1114 multiFile: dart2dartMultiFile); |
| 1110 if (dumpInfo) { | 1115 if (dumpInfo) { |
| 1111 throw new ArgumentError('--dump-info is not supported for dart2dart.'); | 1116 throw new ArgumentError('--dump-info is not supported for dart2dart.'); |
| 1112 } | 1117 } |
| 1113 } | 1118 } |
| 1114 | 1119 |
| 1115 tasks = [ | 1120 tasks = [ |
| 1116 libraryLoader = new LibraryLoaderTask(this), | 1121 libraryLoader = new LibraryLoaderTask(this), |
| 1117 serialization = new SerializationTask(this), | 1122 serialization = new SerializationTask(this), |
| 1118 scanner = new ScannerTask(this), | 1123 scanner = new ScannerTask(this), |
| 1119 dietParser = new DietParserTask(this), | 1124 dietParser = new DietParserTask(this), |
| 1120 parser = new ParserTask(this), | 1125 parser = new ParserTask(this), |
| 1121 patchParser = new PatchParserTask(this), | 1126 patchParser = new PatchParserTask(this), |
| 1122 resolver = new ResolverTask(this, backend.constantCompilerTask), | 1127 resolver = new ResolverTask(this, backend.constantCompilerTask), |
| 1123 closureToClassMapper = new closureMapping.ClosureTask(this), | 1128 closureToClassMapper = new closureMapping.ClosureTask(this), |
| 1124 checker = new TypeCheckerTask(this), | 1129 checker = new TypeCheckerTask(this), |
| 1125 irBuilder = new IrBuilderTask(this, backend.sourceInformationStrategy), | 1130 irBuilder = new IrBuilderTask(this, backend.sourceInformationStrategy), |
| 1126 typesTask = new ti.TypesTask(this), | 1131 typesTask = new ti.TypesTask(this), |
| 1127 constants = backend.constantCompilerTask, | 1132 constants = backend.constantCompilerTask, |
| 1128 deferredLoadTask = new DeferredLoadTask(this), | 1133 deferredLoadTask = new DeferredLoadTask(this), |
| 1129 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 1134 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
| 1130 enqueuer = new EnqueueTask(this), | 1135 enqueuer = backend.makeEnqueuer(), |
| 1131 dumpInfoTask = new DumpInfoTask(this), | 1136 dumpInfoTask = new DumpInfoTask(this), |
| 1132 reuseLibraryTask = new GenericTask('Reuse library', this), | 1137 reuseLibraryTask = new GenericTask('Reuse library', this), |
| 1133 ]; | 1138 ]; |
| 1134 | 1139 |
| 1135 tasks.addAll(backend.tasks); | 1140 tasks.addAll(backend.tasks); |
| 1136 } | 1141 } |
| 1137 | 1142 |
| 1138 Universe get resolverWorld => enqueuer.resolution.universe; | 1143 Universe get resolverWorld => enqueuer.resolution.universe; |
| 1139 Universe get codegenWorld => enqueuer.codegen.universe; | 1144 Universe get codegenWorld => enqueuer.codegen.universe; |
| 1140 | 1145 |
| (...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2512 InterfaceType streamType([DartType elementType]) { | 2517 InterfaceType streamType([DartType elementType]) { |
| 2513 InterfaceType type = streamClass.computeType(compiler); | 2518 InterfaceType type = streamClass.computeType(compiler); |
| 2514 if (elementType == null) { | 2519 if (elementType == null) { |
| 2515 return streamClass.rawType; | 2520 return streamClass.rawType; |
| 2516 } | 2521 } |
| 2517 return type.createInstantiation([elementType]); | 2522 return type.createInstantiation([elementType]); |
| 2518 } | 2523 } |
| 2519 } | 2524 } |
| 2520 | 2525 |
| 2521 typedef void InternalErrorFunction(Spannable location, String message); | 2526 typedef void InternalErrorFunction(Spannable location, String message); |
| OLD | NEW |