| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 {'parameterName': patchParameter.name}), | 99 {'parameterName': patchParameter.name}), |
| 100 ]); | 100 ]); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 void checkMatchingPatchSignatures( | 106 void checkMatchingPatchSignatures( |
| 107 FunctionElement origin, FunctionElement patch) { | 107 FunctionElement origin, FunctionElement patch) { |
| 108 // TODO(johnniwinther): Show both origin and patch locations on errors. | 108 // TODO(johnniwinther): Show both origin and patch locations on errors. |
| 109 FunctionExpression originTree = origin.node; |
| 109 FunctionSignature originSignature = origin.functionSignature; | 110 FunctionSignature originSignature = origin.functionSignature; |
| 110 FunctionExpression patchTree = patch.node; | 111 FunctionExpression patchTree = patch.node; |
| 111 FunctionSignature patchSignature = patch.functionSignature; | 112 FunctionSignature patchSignature = patch.functionSignature; |
| 112 | 113 |
| 114 if ('${originTree.typeVariables}' != '${patchTree.typeVariables}') { |
| 115 reporter.withCurrentElement(patch, () { |
| 116 Node errorNode = patchTree.typeVariables != null |
| 117 ? patchTree.typeVariables |
| 118 : patchTree; |
| 119 reporter.reportError( |
| 120 reporter.createMessage( |
| 121 errorNode, |
| 122 MessageKind.PATCH_TYPE_VARIABLES_MISMATCH, |
| 123 {'methodName': origin.name}), |
| 124 [reporter.createMessage(origin, MessageKind.THIS_IS_THE_METHOD)]); |
| 125 }); |
| 126 } |
| 113 if (originSignature.type.returnType != patchSignature.type.returnType) { | 127 if (originSignature.type.returnType != patchSignature.type.returnType) { |
| 114 reporter.withCurrentElement(patch, () { | 128 reporter.withCurrentElement(patch, () { |
| 115 Node errorNode = | 129 Node errorNode = |
| 116 patchTree.returnType != null ? patchTree.returnType : patchTree; | 130 patchTree.returnType != null ? patchTree.returnType : patchTree; |
| 117 reporter.reportErrorMessage( | 131 reporter.reportErrorMessage( |
| 118 errorNode, MessageKind.PATCH_RETURN_TYPE_MISMATCH, { | 132 errorNode, MessageKind.PATCH_RETURN_TYPE_MISMATCH, { |
| 119 'methodName': origin.name, | 133 'methodName': origin.name, |
| 120 'originReturnType': originSignature.type.returnType, | 134 'originReturnType': originSignature.type.returnType, |
| 121 'patchReturnType': patchSignature.type.returnType | 135 'patchReturnType': patchSignature.type.returnType |
| 122 }); | 136 }); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 'originParameterCount': originSignature.optionalParameterCount, | 171 'originParameterCount': originSignature.optionalParameterCount, |
| 158 'patchParameterCount': patchSignature.optionalParameterCount | 172 'patchParameterCount': patchSignature.optionalParameterCount |
| 159 }); | 173 }); |
| 160 }); | 174 }); |
| 161 } else { | 175 } else { |
| 162 checkMatchingPatchParameters(origin, originSignature.optionalParameters, | 176 checkMatchingPatchParameters(origin, originSignature.optionalParameters, |
| 163 patchSignature.optionalParameters); | 177 patchSignature.optionalParameters); |
| 164 } | 178 } |
| 165 } | 179 } |
| 166 } | 180 } |
| OLD | NEW |