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.class_hierarchy; | 5 library dart2js.resolution.class_hierarchy; |
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 '../core_types.dart' show CoreClasses, CoreTypes; | 9 import '../core_types.dart' show CoreClasses, CoreTypes; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 475 } |
476 | 476 |
477 Link<DartType> resolveInterfaces(NodeList interfaces, Node superclass) { | 477 Link<DartType> resolveInterfaces(NodeList interfaces, Node superclass) { |
478 Link<DartType> result = const Link<DartType>(); | 478 Link<DartType> result = const Link<DartType>(); |
479 if (interfaces == null) return result; | 479 if (interfaces == null) return result; |
480 for (Link<Node> link = interfaces.nodes; !link.isEmpty; link = link.tail) { | 480 for (Link<Node> link = interfaces.nodes; !link.isEmpty; link = link.tail) { |
481 DartType interfaceType = resolveType(link.head); | 481 DartType interfaceType = resolveType(link.head); |
482 if (interfaceType != null) { | 482 if (interfaceType != null) { |
483 if (interfaceType.isMalformed) { | 483 if (interfaceType.isMalformed) { |
484 reporter.reportErrorMessage( | 484 reporter.reportErrorMessage( |
485 superclass, | 485 link.head, |
486 MessageKind.CANNOT_IMPLEMENT_MALFORMED, | 486 MessageKind.CANNOT_IMPLEMENT_MALFORMED, |
487 {'className': element.name, 'malformedType': interfaceType}); | 487 {'className': element.name, 'malformedType': interfaceType}); |
488 } else if (interfaceType.isEnumType) { | 488 } else if (interfaceType.isEnumType) { |
489 reporter.reportErrorMessage( | 489 reporter.reportErrorMessage( |
490 superclass, | 490 link.head, |
491 MessageKind.CANNOT_IMPLEMENT_ENUM, | 491 MessageKind.CANNOT_IMPLEMENT_ENUM, |
492 {'className': element.name, 'enumType': interfaceType}); | 492 {'className': element.name, 'enumType': interfaceType}); |
493 } else if (!interfaceType.isInterfaceType) { | 493 } else if (!interfaceType.isInterfaceType) { |
494 // TODO(johnniwinther): Handle dynamic. | 494 // TODO(johnniwinther): Handle dynamic. |
495 TypeAnnotation typeAnnotation = link.head; | 495 TypeAnnotation typeAnnotation = link.head; |
496 reporter.reportErrorMessage( | 496 reporter.reportErrorMessage( |
497 typeAnnotation.typeName, MessageKind.CLASS_NAME_EXPECTED); | 497 typeAnnotation.typeName, MessageKind.CLASS_NAME_EXPECTED); |
498 } else { | 498 } else { |
499 if (interfaceType == element.supertype) { | 499 if (interfaceType == element.supertype) { |
500 reporter.reportErrorMessage( | 500 reporter.reportErrorMessage( |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 Identifier selector = node.selector.asIdentifier(); | 645 Identifier selector = node.selector.asIdentifier(); |
646 var e = prefixElement.lookupLocalMember(selector.source); | 646 var e = prefixElement.lookupLocalMember(selector.source); |
647 if (e == null || !e.impliesType) { | 647 if (e == null || !e.impliesType) { |
648 reporter.reportErrorMessage(node.selector, | 648 reporter.reportErrorMessage(node.selector, |
649 MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node.selector}); | 649 MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node.selector}); |
650 return; | 650 return; |
651 } | 651 } |
652 loadSupertype(e, node); | 652 loadSupertype(e, node); |
653 } | 653 } |
654 } | 654 } |
OLD | NEW |