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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 if (type == null) { | 514 if (type == null) { |
515 type = new MalformedType(error, null); | 515 type = new MalformedType(error, null); |
516 } | 516 } |
517 return new ConstructorResult.forError(resultKind, error, type); | 517 return new ConstructorResult.forError(resultKind, error, type); |
518 } | 518 } |
519 | 519 |
520 ConstructorResult resolveConstructor(PrefixElement prefix, InterfaceType type, | 520 ConstructorResult resolveConstructor(PrefixElement prefix, InterfaceType type, |
521 Node diagnosticNode, String constructorName) { | 521 Node diagnosticNode, String constructorName) { |
522 ClassElement cls = type.element; | 522 ClassElement cls = type.element; |
523 cls.ensureResolved(resolution); | 523 cls.ensureResolved(resolution); |
524 ConstructorElement constructor = findConstructor( | 524 ConstructorElement constructor = |
525 context.library, cls, constructorName); | 525 findConstructor(context.library, cls, constructorName); |
526 if (constructor == null) { | 526 if (constructor == null) { |
527 MessageKind kind = constructorName.isEmpty | 527 MessageKind kind = constructorName.isEmpty |
528 ? MessageKind.CANNOT_FIND_UNNAMED_CONSTRUCTOR | 528 ? MessageKind.CANNOT_FIND_UNNAMED_CONSTRUCTOR |
529 : MessageKind.CANNOT_FIND_CONSTRUCTOR; | 529 : MessageKind.CANNOT_FIND_CONSTRUCTOR; |
530 return reportAndCreateErroneousConstructorElement( | 530 return reportAndCreateErroneousConstructorElement( |
531 diagnosticNode, | 531 diagnosticNode, |
532 ConstructorResultKind.UNRESOLVED_CONSTRUCTOR, | 532 ConstructorResultKind.UNRESOLVED_CONSTRUCTOR, |
533 type, | 533 type, |
534 constructorName, | 534 constructorName, |
535 kind, | 535 kind, |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 // constructors. | 879 // constructors. |
880 return null; | 880 return null; |
881 } | 881 } |
882 // TODO(johnniwinther): Use [Name] for lookup. | 882 // TODO(johnniwinther): Use [Name] for lookup. |
883 ConstructorElement constructor = cls.lookupConstructor(constructorName); | 883 ConstructorElement constructor = cls.lookupConstructor(constructorName); |
884 if (constructor != null) { | 884 if (constructor != null) { |
885 constructor = constructor.declaration; | 885 constructor = constructor.declaration; |
886 } | 886 } |
887 return constructor; | 887 return constructor; |
888 } | 888 } |
OLD | NEW |