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 '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart' show Resolution; | 8 import '../common/resolution.dart' show Resolution; |
9 import '../common/tasks.dart' show CompilerTask; | 9 import '../common/tasks.dart' show CompilerTask; |
10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 reporter.reportErrorMessage( | 45 reporter.reportErrorMessage( |
46 element, MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION); | 46 element, MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION); |
47 } | 47 } |
48 return element; | 48 return element; |
49 } | 49 } |
50 | 50 |
51 void checkMatchingPatchParameters(FunctionElement origin, | 51 void checkMatchingPatchParameters(FunctionElement origin, |
52 List<Element> originParameters, List<Element> patchParameters) { | 52 List<Element> originParameters, List<Element> patchParameters) { |
53 bool isUnnamedListConstructor = origin is ConstructorElement && | 53 bool isUnnamedListConstructor = origin is ConstructorElement && |
54 compiler.commonElements.isUnnamedListConstructor(origin); | 54 resolution.commonElements.isUnnamedListConstructor(origin); |
55 | 55 |
56 assert(originParameters.length == patchParameters.length); | 56 assert(originParameters.length == patchParameters.length); |
57 for (int index = 0; index < originParameters.length; index++) { | 57 for (int index = 0; index < originParameters.length; index++) { |
58 ParameterElementX originParameter = originParameters[index]; | 58 ParameterElementX originParameter = originParameters[index]; |
59 ParameterElementX patchParameter = patchParameters[index]; | 59 ParameterElementX patchParameter = patchParameters[index]; |
60 // TODO(johnniwinther): Remove the conditional patching when we never | 60 // TODO(johnniwinther): Remove the conditional patching when we never |
61 // resolve the same method twice. | 61 // resolve the same method twice. |
62 if (!originParameter.isPatched) { | 62 if (!originParameter.isPatched) { |
63 originParameter.applyPatch(patchParameter); | 63 originParameter.applyPatch(patchParameter); |
64 } else { | 64 } else { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 'originParameterCount': originSignature.optionalParameterCount, | 184 'originParameterCount': originSignature.optionalParameterCount, |
185 'patchParameterCount': patchSignature.optionalParameterCount | 185 'patchParameterCount': patchSignature.optionalParameterCount |
186 }); | 186 }); |
187 }); | 187 }); |
188 } else { | 188 } else { |
189 checkMatchingPatchParameters(origin, originSignature.optionalParameters, | 189 checkMatchingPatchParameters(origin, originSignature.optionalParameters, |
190 patchSignature.optionalParameters); | 190 patchSignature.optionalParameters); |
191 } | 191 } |
192 } | 192 } |
193 } | 193 } |
OLD | NEW |