| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 class InitializerResolver { | 7 class InitializerResolver { |
| 8 final ResolverVisitor visitor; | 8 final ResolverVisitor visitor; |
| 9 final Map<Element, Node> initialized; | 9 final Map<Element, Node> initialized; |
| 10 Link<Node> initializers; | 10 Link<Node> initializers; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 | 165 |
| 166 void verifyThatConstructorMatchesCall( | 166 void verifyThatConstructorMatchesCall( |
| 167 FunctionElement caller, | 167 FunctionElement caller, |
| 168 ConstructorElementX lookedupConstructor, | 168 ConstructorElementX lookedupConstructor, |
| 169 CallStructure call, | 169 CallStructure call, |
| 170 bool isImplicitSuperCall, | 170 bool isImplicitSuperCall, |
| 171 Node diagnosticNode, | 171 Node diagnosticNode, |
| 172 String className, | 172 String className, |
| 173 Selector constructorSelector) { | 173 Selector constructorSelector) { |
| 174 if (lookedupConstructor == null | 174 if (lookedupConstructor == null || |
| 175 || !lookedupConstructor.isGenerativeConstructor) { | 175 !lookedupConstructor.isGenerativeConstructor) { |
| 176 String fullConstructorName = Elements.constructorNameForDiagnostics( | 176 String fullConstructorName = Elements.constructorNameForDiagnostics( |
| 177 className, | 177 className, |
| 178 constructorSelector.name); | 178 constructorSelector.name); |
| 179 MessageKind kind = isImplicitSuperCall | 179 MessageKind kind = isImplicitSuperCall |
| 180 ? MessageKind.CANNOT_RESOLVE_CONSTRUCTOR_FOR_IMPLICIT | 180 ? MessageKind.CANNOT_RESOLVE_CONSTRUCTOR_FOR_IMPLICIT |
| 181 : MessageKind.CANNOT_RESOLVE_CONSTRUCTOR; | 181 : MessageKind.CANNOT_RESOLVE_CONSTRUCTOR; |
| 182 visitor.compiler.reportError( | 182 visitor.compiler.reportError( |
| 183 diagnosticNode, kind, {'constructorName': fullConstructorName}); | 183 diagnosticNode, kind, {'constructorName': fullConstructorName}); |
| 184 } else { | 184 } else { |
| 185 lookedupConstructor.computeSignature(visitor.compiler); | 185 lookedupConstructor.computeSignature(visitor.compiler); |
| 186 if (!call.signatureApplies(lookedupConstructor)) { | 186 if (!call.signatureApplies(lookedupConstructor.functionSignature)) { |
| 187 MessageKind kind = isImplicitSuperCall | 187 MessageKind kind = isImplicitSuperCall |
| 188 ? MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT | 188 ? MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT |
| 189 : MessageKind.NO_MATCHING_CONSTRUCTOR; | 189 : MessageKind.NO_MATCHING_CONSTRUCTOR; |
| 190 visitor.compiler.reportError(diagnosticNode, kind); | 190 visitor.compiler.reportError(diagnosticNode, kind); |
| 191 } else if (caller.isConst | 191 } else if (caller.isConst |
| 192 && !lookedupConstructor.isConst) { | 192 && !lookedupConstructor.isConst) { |
| 193 MessageKind kind = isImplicitSuperCall | 193 MessageKind kind = isImplicitSuperCall |
| 194 ? MessageKind.CONST_CALLS_NON_CONST_FOR_IMPLICIT | 194 ? MessageKind.CONST_CALLS_NON_CONST_FOR_IMPLICIT |
| 195 : MessageKind.CONST_CALLS_NON_CONST; | 195 : MessageKind.CONST_CALLS_NON_CONST; |
| 196 visitor.compiler.reportError(diagnosticNode, kind); | 196 visitor.compiler.reportError(diagnosticNode, kind); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 return element; | 468 return element; |
| 469 } | 469 } |
| 470 | 470 |
| 471 /// Assumed to be called by [resolveRedirectingFactory]. | 471 /// Assumed to be called by [resolveRedirectingFactory]. |
| 472 Element visitRedirectingFactoryBody(RedirectingFactoryBody node) { | 472 Element visitRedirectingFactoryBody(RedirectingFactoryBody node) { |
| 473 Node constructorReference = node.constructorReference; | 473 Node constructorReference = node.constructorReference; |
| 474 return finishConstructorReference(visit(constructorReference), | 474 return finishConstructorReference(visit(constructorReference), |
| 475 constructorReference, node); | 475 constructorReference, node); |
| 476 } | 476 } |
| 477 } | 477 } |
| OLD | NEW |