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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 world.registerStaticUse(element); | 169 world.registerStaticUse(element); |
170 } | 170 } |
171 | 171 |
172 void registerDirectInvocation(Element element) { | 172 void registerDirectInvocation(Element element) { |
173 world.registerStaticUse(element); | 173 world.registerStaticUse(element); |
174 } | 174 } |
175 | 175 |
176 void registerInstantiation(InterfaceType type) { | 176 void registerInstantiation(InterfaceType type) { |
177 world.registerInstantiatedType(type, this); | 177 world.registerInstantiatedType(type, this); |
178 } | 178 } |
| 179 |
| 180 void registerAsyncMarker(FunctionElement element) { |
| 181 backend.registerAsyncMarker(element, world, this); |
| 182 } |
| 183 |
179 } | 184 } |
180 | 185 |
181 /// [WorkItem] used exclusively by the [CodegenEnqueuer]. | 186 /// [WorkItem] used exclusively by the [CodegenEnqueuer]. |
182 class CodegenWorkItem extends WorkItem { | 187 class CodegenWorkItem extends WorkItem { |
183 Registry registry; | 188 Registry registry; |
184 final TreeElements resolutionTree; | 189 final TreeElements resolutionTree; |
185 | 190 |
186 CodegenWorkItem(AstElement element, | 191 CodegenWorkItem(AstElement element, |
187 ItemCompilationContext compilationContext) | 192 ItemCompilationContext compilationContext) |
188 : this.resolutionTree = element.resolvedAst.elements, | 193 : this.resolutionTree = element.resolvedAst.elements, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 227 |
223 void registerDynamicGetter(Selector selector); | 228 void registerDynamicGetter(Selector selector); |
224 | 229 |
225 void registerDynamicSetter(Selector selector); | 230 void registerDynamicSetter(Selector selector); |
226 | 231 |
227 void registerStaticInvocation(Element element); | 232 void registerStaticInvocation(Element element); |
228 | 233 |
229 void registerInstantiation(InterfaceType type); | 234 void registerInstantiation(InterfaceType type); |
230 | 235 |
231 void registerGetOfStaticFunction(FunctionElement element); | 236 void registerGetOfStaticFunction(FunctionElement element); |
| 237 |
| 238 void registerAsyncMarker(FunctionElement element); |
232 } | 239 } |
233 | 240 |
234 abstract class Backend { | 241 abstract class Backend { |
235 final Compiler compiler; | 242 final Compiler compiler; |
236 | 243 |
237 Backend(this.compiler); | 244 Backend(this.compiler); |
238 | 245 |
239 /// The [ConstantSystem] used to interpret compile-time constants for this | 246 /// The [ConstantSystem] used to interpret compile-time constants for this |
240 /// backend. | 247 /// backend. |
241 ConstantSystem get constantSystem; | 248 ConstantSystem get constantSystem; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 | 516 |
510 FunctionElement helperForBadMain() => null; | 517 FunctionElement helperForBadMain() => null; |
511 | 518 |
512 FunctionElement helperForMissingMain() => null; | 519 FunctionElement helperForMissingMain() => null; |
513 | 520 |
514 FunctionElement helperForMainArity() => null; | 521 FunctionElement helperForMainArity() => null; |
515 | 522 |
516 void forgetElement(Element element) {} | 523 void forgetElement(Element element) {} |
517 | 524 |
518 void registerMainHasArguments(Enqueuer enqueuer) {} | 525 void registerMainHasArguments(Enqueuer enqueuer) {} |
| 526 |
| 527 void registerAsyncMarker(FunctionElement element, |
| 528 Enqueuer enqueuer, |
| 529 Registry registry) {} |
519 } | 530 } |
520 | 531 |
521 /// Backend callbacks function specific to the resolution phase. | 532 /// Backend callbacks function specific to the resolution phase. |
522 class ResolutionCallbacks { | 533 class ResolutionCallbacks { |
523 /// Register that [node] is a call to `assert`. | 534 /// Register that [node] is a call to `assert`. |
524 void onAssert(Send node, Registry registry) {} | 535 void onAssert(Send node, Registry registry) {} |
525 | 536 |
526 /// Called during resolution to notify to the backend that the | 537 /// Called during resolution to notify to the backend that the |
527 /// program uses string interpolation. | 538 /// program uses string interpolation. |
528 void onStringInterpolation(Registry registry) {} | 539 void onStringInterpolation(Registry registry) {} |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 /// `true` if the last diagnostic was filtered, in which case the | 744 /// `true` if the last diagnostic was filtered, in which case the |
734 /// accompanying info message should be filtered as well. | 745 /// accompanying info message should be filtered as well. |
735 bool lastDiagnosticWasFiltered = false; | 746 bool lastDiagnosticWasFiltered = false; |
736 | 747 |
737 /// Map containing information about the warnings and hints that have been | 748 /// Map containing information about the warnings and hints that have been |
738 /// suppressed for each library. | 749 /// suppressed for each library. |
739 Map<Uri, SuppressionInfo> suppressedWarnings = <Uri, SuppressionInfo>{}; | 750 Map<Uri, SuppressionInfo> suppressedWarnings = <Uri, SuppressionInfo>{}; |
740 | 751 |
741 final bool suppressWarnings; | 752 final bool suppressWarnings; |
742 | 753 |
743 /// `true` if async/await features are supported. | |
744 final bool enableAsyncAwait; | |
745 | |
746 /// If `true`, some values are cached for reuse in incremental compilation. | 754 /// If `true`, some values are cached for reuse in incremental compilation. |
747 /// Incremental compilation is basically calling [run] more than once. | 755 /// Incremental compilation is basically calling [run] more than once. |
748 final bool hasIncrementalSupport; | 756 final bool hasIncrementalSupport; |
749 | 757 |
750 /// If `true` native extension syntax is supported by the frontend. | 758 /// If `true` native extension syntax is supported by the frontend. |
751 final bool allowNativeExtensions; | 759 final bool allowNativeExtensions; |
752 | 760 |
753 /// Output provider from user of Compiler API. | 761 /// Output provider from user of Compiler API. |
754 api.CompilerOutputProvider userOutputProvider; | 762 api.CompilerOutputProvider userOutputProvider; |
755 | 763 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 this.outputUri: null, | 1005 this.outputUri: null, |
998 this.buildId: UNDETERMINED_BUILD_ID, | 1006 this.buildId: UNDETERMINED_BUILD_ID, |
999 this.terseDiagnostics: false, | 1007 this.terseDiagnostics: false, |
1000 this.deferredMapUri: null, | 1008 this.deferredMapUri: null, |
1001 this.dumpInfo: false, | 1009 this.dumpInfo: false, |
1002 this.showPackageWarnings: false, | 1010 this.showPackageWarnings: false, |
1003 this.useContentSecurityPolicy: false, | 1011 this.useContentSecurityPolicy: false, |
1004 this.suppressWarnings: false, | 1012 this.suppressWarnings: false, |
1005 bool hasIncrementalSupport: false, | 1013 bool hasIncrementalSupport: false, |
1006 this.enableExperimentalMirrors: false, | 1014 this.enableExperimentalMirrors: false, |
1007 this.enableAsyncAwait: false, | |
1008 this.allowNativeExtensions: false, | 1015 this.allowNativeExtensions: false, |
1009 this.generateCodeWithCompileTimeErrors: false, | 1016 this.generateCodeWithCompileTimeErrors: false, |
1010 api.CompilerOutputProvider outputProvider, | 1017 api.CompilerOutputProvider outputProvider, |
1011 List<String> strips: const []}) | 1018 List<String> strips: const []}) |
1012 : this.disableTypeInferenceFlag = | 1019 : this.disableTypeInferenceFlag = |
1013 disableTypeInferenceFlag || !emitJavaScript, | 1020 disableTypeInferenceFlag || !emitJavaScript, |
1014 this.analyzeOnly = | 1021 this.analyzeOnly = |
1015 analyzeOnly || analyzeSignaturesOnly || analyzeAllFlag, | 1022 analyzeOnly || analyzeSignaturesOnly || analyzeAllFlag, |
1016 this.analyzeSignaturesOnly = analyzeSignaturesOnly, | 1023 this.analyzeSignaturesOnly = analyzeSignaturesOnly, |
1017 this.analyzeAllFlag = analyzeAllFlag, | 1024 this.analyzeAllFlag = analyzeAllFlag, |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2386 InterfaceType get nullType => nullClass.computeType(compiler); | 2393 InterfaceType get nullType => nullClass.computeType(compiler); |
2387 | 2394 |
2388 @override | 2395 @override |
2389 InterfaceType get numType => numClass.computeType(compiler); | 2396 InterfaceType get numType => numClass.computeType(compiler); |
2390 | 2397 |
2391 @override | 2398 @override |
2392 InterfaceType get stringType => stringClass.computeType(compiler); | 2399 InterfaceType get stringType => stringClass.computeType(compiler); |
2393 } | 2400 } |
2394 | 2401 |
2395 typedef void InternalErrorFunction(Spannable location, String message); | 2402 typedef void InternalErrorFunction(Spannable location, String message); |
OLD | NEW |