OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.js_backend.patch_resolver; | 5 library dart2js.js_backend.patch_resolver; |
6 | 6 |
7 import '../dart2jslib.dart'; | 7 import '../dart2jslib.dart'; |
8 import '../dart_types.dart'; | 8 import '../dart_types.dart'; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../elements/modelx.dart'; | 10 import '../elements/modelx.dart'; |
11 import '../resolution/resolution.dart'; | 11 import '../resolution/resolution.dart'; |
12 import '../tree/tree.dart'; | 12 import '../tree/tree.dart'; |
13 import '../util/util.dart'; | 13 import '../util/util.dart'; |
14 | 14 |
15 class PatchResolverTask extends CompilerTask { | 15 class PatchResolverTask extends CompilerTask { |
16 PatchResolverTask(Compiler compiler) : super(compiler); | 16 PatchResolverTask(Compiler compiler) : super(compiler); |
17 | 17 |
18 String get name => 'JavaScript patch resolver'; | 18 String get name => 'JavaScript patch resolver'; |
19 | 19 |
20 FunctionElement resolveExternalFunction(FunctionElementX element) { | 20 FunctionElement resolveExternalFunction(FunctionElementX element) { |
21 if (element.isPatched) { | 21 if (element.isPatched) { |
22 FunctionElementX patch = element.patch; | 22 FunctionElementX patch = element.patch; |
23 compiler.withCurrentElement(patch, () { | 23 compiler.withCurrentElement(patch, () { |
24 patch.parseNode(compiler); | 24 patch.parseNode(compiler); |
25 patch.computeType(compiler); | 25 patch.computeType(compiler); |
26 }); | 26 }); |
27 checkMatchingPatchSignatures(element, patch); | 27 checkMatchingPatchSignatures(element, patch); |
28 element = patch; | 28 element = patch; |
29 ResolverTask.processAsyncMarker(compiler, element); | |
30 } else { | 29 } else { |
31 compiler.reportError( | 30 compiler.reportError( |
32 element, MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION); | 31 element, MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION); |
33 } | 32 } |
34 return element; | 33 return element; |
35 } | 34 } |
36 | 35 |
37 void checkMatchingPatchParameters(FunctionElement origin, | 36 void checkMatchingPatchParameters(FunctionElement origin, |
38 Link<Element> originParameters, | 37 Link<Element> originParameters, |
39 Link<Element> patchParameters) { | 38 Link<Element> patchParameters) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 'patchParameterCount': patchSignature.optionalParameterCount}); | 149 'patchParameterCount': patchSignature.optionalParameterCount}); |
151 }); | 150 }); |
152 } else { | 151 } else { |
153 checkMatchingPatchParameters(origin, | 152 checkMatchingPatchParameters(origin, |
154 originSignature.optionalParameters, | 153 originSignature.optionalParameters, |
155 patchSignature.optionalParameters); | 154 patchSignature.optionalParameters); |
156 } | 155 } |
157 } | 156 } |
158 | 157 |
159 } | 158 } |
OLD | NEW |