| 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 '../compiler.dart' show | 8 import '../compiler.dart' show |
| 9 Compiler; | 9 Compiler; |
| 10 import '../core_types.dart' show | 10 import '../core_types.dart' show |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 if (element.interfaces == null) { | 187 if (element.interfaces == null) { |
| 188 element.interfaces = resolveInterfaces(node.interfaces, node.superclass); | 188 element.interfaces = resolveInterfaces(node.interfaces, node.superclass); |
| 189 } else { | 189 } else { |
| 190 assert(invariant(element, element.hasIncompleteHierarchy)); | 190 assert(invariant(element, element.hasIncompleteHierarchy)); |
| 191 } | 191 } |
| 192 calculateAllSupertypes(element); | 192 calculateAllSupertypes(element); |
| 193 | 193 |
| 194 if (!element.hasConstructor) { | 194 if (!element.hasConstructor) { |
| 195 Element superMember = element.superclass.localLookup(''); | 195 Element superMember = element.superclass.localLookup(''); |
| 196 if (superMember == null || !superMember.isGenerativeConstructor) { | 196 if (superMember == null) { |
| 197 MessageKind kind = MessageKind.CANNOT_FIND_CONSTRUCTOR; | 197 MessageKind kind = MessageKind.CANNOT_FIND_UNNAMED_CONSTRUCTOR; |
| 198 Map arguments = {'constructorName': ''}; | 198 Map arguments = {'className': element.superclass.name}; |
| 199 // TODO(ahe): Why is this a compile-time error? Or if it is an error, | 199 // TODO(ahe): Why is this a compile-time error? Or if it is an error, |
| 200 // why do we bother to registerThrowNoSuchMethod below? | 200 // why do we bother to registerThrowNoSuchMethod below? |
| 201 reporter.reportErrorMessage(node, kind, arguments); | 201 reporter.reportErrorMessage(node, kind, arguments); |
| 202 superMember = new ErroneousElementX( | 202 superMember = new ErroneousElementX( |
| 203 kind, arguments, '', element); | 203 kind, arguments, '', element); |
| 204 registry.registerThrowNoSuchMethod(); | 204 registry.registerThrowNoSuchMethod(); |
| 205 } else if (!superMember.isGenerativeConstructor) { |
| 206 MessageKind kind = MessageKind.SUPER_CALL_TO_FACTORY; |
| 207 Map arguments = {'className': element.superclass.name}; |
| 208 // TODO(ahe): Why is this a compile-time error? Or if it is an error, |
| 209 // why do we bother to registerThrowNoSuchMethod below? |
| 210 reporter.reportErrorMessage(node, kind, arguments); |
| 211 superMember = new ErroneousElementX( |
| 212 kind, arguments, '', element); |
| 213 registry.registerThrowNoSuchMethod(); |
| 205 } else { | 214 } else { |
| 206 ConstructorElement superConstructor = superMember; | 215 ConstructorElement superConstructor = superMember; |
| 207 superConstructor.computeType(resolution); | 216 superConstructor.computeType(resolution); |
| 208 if (!CallStructure.NO_ARGS.signatureApplies( | 217 if (!CallStructure.NO_ARGS.signatureApplies( |
| 209 superConstructor.functionSignature)) { | 218 superConstructor.functionSignature)) { |
| 210 MessageKind kind = MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT; | 219 MessageKind kind = MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT; |
| 211 reporter.reportErrorMessage(node, kind); | 220 reporter.reportErrorMessage(node, kind); |
| 212 superMember = new ErroneousElementX(kind, {}, '', element); | 221 superMember = new ErroneousElementX(kind, {}, '', element); |
| 213 } | 222 } |
| 214 } | 223 } |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 if (e == null || !e.impliesType) { | 716 if (e == null || !e.impliesType) { |
| 708 reporter.reportErrorMessage( | 717 reporter.reportErrorMessage( |
| 709 node.selector, | 718 node.selector, |
| 710 MessageKind.CANNOT_RESOLVE_TYPE, | 719 MessageKind.CANNOT_RESOLVE_TYPE, |
| 711 {'typeName': node.selector}); | 720 {'typeName': node.selector}); |
| 712 return; | 721 return; |
| 713 } | 722 } |
| 714 loadSupertype(e, node); | 723 loadSupertype(e, node); |
| 715 } | 724 } |
| 716 } | 725 } |
| OLD | NEW |