| 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'; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 MessageKind.PATCH_POINT_TO_PARAMETER, | 87 MessageKind.PATCH_POINT_TO_PARAMETER, |
| 88 {'parameterName': patchParameter.name}); | 88 {'parameterName': patchParameter.name}); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 void checkMatchingPatchSignatures(FunctionElement origin, | 94 void checkMatchingPatchSignatures(FunctionElement origin, |
| 95 FunctionElement patch) { | 95 FunctionElement patch) { |
| 96 // TODO(johnniwinther): Show both origin and patch locations on errors. | 96 // TODO(johnniwinther): Show both origin and patch locations on errors. |
| 97 FunctionExpression originTree = origin.node; | |
| 98 FunctionSignature originSignature = origin.functionSignature; | 97 FunctionSignature originSignature = origin.functionSignature; |
| 99 FunctionExpression patchTree = patch.node; | 98 FunctionExpression patchTree = patch.node; |
| 100 FunctionSignature patchSignature = patch.functionSignature; | 99 FunctionSignature patchSignature = patch.functionSignature; |
| 101 | 100 |
| 102 if (originSignature.type.returnType != patchSignature.type.returnType) { | 101 if (originSignature.type.returnType != patchSignature.type.returnType) { |
| 103 compiler.withCurrentElement(patch, () { | 102 compiler.withCurrentElement(patch, () { |
| 104 Node errorNode = | 103 Node errorNode = |
| 105 patchTree.returnType != null ? patchTree.returnType : patchTree; | 104 patchTree.returnType != null ? patchTree.returnType : patchTree; |
| 106 compiler.reportError( | 105 compiler.reportError( |
| 107 errorNode, MessageKind.PATCH_RETURN_TYPE_MISMATCH, | 106 errorNode, MessageKind.PATCH_RETURN_TYPE_MISMATCH, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 'originParameterCount': originSignature.optionalParameterCount, | 146 'originParameterCount': originSignature.optionalParameterCount, |
| 148 'patchParameterCount': patchSignature.optionalParameterCount}); | 147 'patchParameterCount': patchSignature.optionalParameterCount}); |
| 149 }); | 148 }); |
| 150 } else { | 149 } else { |
| 151 checkMatchingPatchParameters(origin, | 150 checkMatchingPatchParameters(origin, |
| 152 originSignature.optionalParameters, | 151 originSignature.optionalParameters, |
| 153 patchSignature.optionalParameters); | 152 patchSignature.optionalParameters); |
| 154 } | 153 } |
| 155 } | 154 } |
| 156 | 155 |
| 157 } | 156 } |
| OLD | NEW |