| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 abstract class TreeElements { | 7 abstract class TreeElements { |
| 8 Element get currentElement; | 8 Element get currentElement; |
| 9 Setlet<Node> get superUses; | 9 Setlet<Node> get superUses; |
| 10 | 10 |
| (...skipping 3861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3872 } | 3872 } |
| 3873 | 3873 |
| 3874 if (element.interfaces == null) { | 3874 if (element.interfaces == null) { |
| 3875 element.interfaces = resolveInterfaces(node.interfaces, node.superclass); | 3875 element.interfaces = resolveInterfaces(node.interfaces, node.superclass); |
| 3876 } else { | 3876 } else { |
| 3877 assert(invariant(element, element.hasIncompleteHierarchy)); | 3877 assert(invariant(element, element.hasIncompleteHierarchy)); |
| 3878 } | 3878 } |
| 3879 calculateAllSupertypes(element); | 3879 calculateAllSupertypes(element); |
| 3880 | 3880 |
| 3881 if (!element.hasConstructor) { | 3881 if (!element.hasConstructor) { |
| 3882 Element superMember = | 3882 Element superMember = element.superclass.localLookup(''); |
| 3883 element.superclass.localLookup(''); | |
| 3884 if (superMember == null || !superMember.isGenerativeConstructor()) { | 3883 if (superMember == null || !superMember.isGenerativeConstructor()) { |
| 3885 DualKind kind = MessageKind.CANNOT_FIND_CONSTRUCTOR; | 3884 DualKind kind = MessageKind.CANNOT_FIND_CONSTRUCTOR; |
| 3886 Map arguments = {'constructorName': ''}; | 3885 Map arguments = {'constructorName': ''}; |
| 3887 // TODO(ahe): Why is this a compile-time error? Or if it is an error, | 3886 // TODO(ahe): Why is this a compile-time error? Or if it is an error, |
| 3888 // why do we bother to registerThrowNoSuchMethod below? | 3887 // why do we bother to registerThrowNoSuchMethod below? |
| 3889 compiler.reportError(node, kind.error, arguments); | 3888 compiler.reportError(node, kind.error, arguments); |
| 3890 superMember = new ErroneousElementX( | 3889 superMember = new ErroneousElementX( |
| 3891 kind.error, arguments, '', element); | 3890 kind.error, arguments, '', element); |
| 3892 compiler.backend.registerThrowNoSuchMethod(mapping); | 3891 compiler.backend.registerThrowNoSuchMethod(mapping); |
| 3892 } else { |
| 3893 Selector callToMatch = new Selector.call("", element.getLibrary(), 0); |
| 3894 if (!callToMatch.applies(superMember, compiler)) { |
| 3895 MessageKind kind = MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT; |
| 3896 compiler.reportError(node, kind); |
| 3897 superMember = new ErroneousElementX(kind, {}, '', element); |
| 3898 } |
| 3893 } | 3899 } |
| 3894 FunctionElement constructor = | 3900 FunctionElement constructor = |
| 3895 new SynthesizedConstructorElementX.forDefault(superMember, element); | 3901 new SynthesizedConstructorElementX.forDefault(superMember, element); |
| 3896 element.setDefaultConstructor(constructor, compiler); | 3902 element.setDefaultConstructor(constructor, compiler); |
| 3897 } | 3903 } |
| 3898 return element.computeType(compiler); | 3904 return element.computeType(compiler); |
| 3899 } | 3905 } |
| 3900 | 3906 |
| 3901 /// Resolves the mixed type for [mixinNode] and checks that the the mixin type | 3907 /// Resolves the mixed type for [mixinNode] and checks that the the mixin type |
| 3902 /// is a valid, non-blacklisted interface type. The mixin type is returned. | 3908 /// is a valid, non-blacklisted interface type. The mixin type is returned. |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4530 return finishConstructorReference(visit(expression), | 4536 return finishConstructorReference(visit(expression), |
| 4531 expression, expression); | 4537 expression, expression); |
| 4532 } | 4538 } |
| 4533 } | 4539 } |
| 4534 | 4540 |
| 4535 /// Looks up [name] in [scope] and unwraps the result. | 4541 /// Looks up [name] in [scope] and unwraps the result. |
| 4536 Element lookupInScope(Compiler compiler, Node node, | 4542 Element lookupInScope(Compiler compiler, Node node, |
| 4537 Scope scope, String name) { | 4543 Scope scope, String name) { |
| 4538 return Elements.unwrap(scope.lookup(name), compiler, node); | 4544 return Elements.unwrap(scope.lookup(name), compiler, node); |
| 4539 } | 4545 } |
| OLD | NEW |