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 library dart2js.resolution.constructors; | 5 library dart2js.resolution.constructors; |
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 '../constants/constructors.dart' | 9 import '../constants/constructors.dart' |
10 show | 10 show |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 result = reportAndCreateErroneousConstructor(node, constructorName, kind, | 268 result = reportAndCreateErroneousConstructor(node, constructorName, kind, |
269 {'constructorName': fullConstructorName}); | 269 {'constructorName': fullConstructorName}); |
270 } else if (!lookedupConstructor.isGenerativeConstructor) { | 270 } else if (!lookedupConstructor.isGenerativeConstructor) { |
271 MessageKind kind = isThisCall | 271 MessageKind kind = isThisCall |
272 ? MessageKind.THIS_CALL_TO_FACTORY | 272 ? MessageKind.THIS_CALL_TO_FACTORY |
273 : MessageKind.SUPER_CALL_TO_FACTORY; | 273 : MessageKind.SUPER_CALL_TO_FACTORY; |
274 result = | 274 result = |
275 reportAndCreateErroneousConstructor(node, constructorName, kind, {}); | 275 reportAndCreateErroneousConstructor(node, constructorName, kind, {}); |
276 } else { | 276 } else { |
277 lookedupConstructor.computeType(visitor.resolution); | 277 lookedupConstructor.computeType(visitor.resolution); |
278 if (!callStructure.signatureApplies(lookedupConstructor.type)) { | 278 if (!callStructure |
| 279 .signatureApplies(lookedupConstructor.parameterStructure)) { |
279 MessageKind kind = isImplicitSuperCall | 280 MessageKind kind = isImplicitSuperCall |
280 ? MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT | 281 ? MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT |
281 : MessageKind.NO_MATCHING_CONSTRUCTOR; | 282 : MessageKind.NO_MATCHING_CONSTRUCTOR; |
282 result = reportAndCreateErroneousConstructor( | 283 result = reportAndCreateErroneousConstructor( |
283 node, constructorName, kind, {}); | 284 node, constructorName, kind, {}); |
284 } else if (constructor.isConst && !lookedupConstructor.isConst) { | 285 } else if (constructor.isConst && !lookedupConstructor.isConst) { |
285 MessageKind kind = isImplicitSuperCall | 286 MessageKind kind = isImplicitSuperCall |
286 ? MessageKind.CONST_CALLS_NON_CONST_FOR_IMPLICIT | 287 ? MessageKind.CONST_CALLS_NON_CONST_FOR_IMPLICIT |
287 : MessageKind.CONST_CALLS_NON_CONST; | 288 : MessageKind.CONST_CALLS_NON_CONST; |
288 result = reportAndCreateErroneousConstructor( | 289 result = reportAndCreateErroneousConstructor( |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 // constructors. | 885 // constructors. |
885 return null; | 886 return null; |
886 } | 887 } |
887 // TODO(johnniwinther): Use [Name] for lookup. | 888 // TODO(johnniwinther): Use [Name] for lookup. |
888 ConstructorElement constructor = cls.lookupConstructor(constructorName); | 889 ConstructorElement constructor = cls.lookupConstructor(constructorName); |
889 if (constructor != null) { | 890 if (constructor != null) { |
890 constructor = constructor.declaration; | 891 constructor = constructor.declaration; |
891 } | 892 } |
892 return constructor; | 893 return constructor; |
893 } | 894 } |
OLD | NEW |