Chromium Code Reviews| 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(''); | 3883 FunctionElement constructor = |
| 3884 new SynthesizedConstructorElementX.forDefault(superMember, element); | |
| 3885 element.setDefaultConstructor(constructor, compiler); | |
| 3884 if (superMember == null || !superMember.isGenerativeConstructor()) { | 3886 if (superMember == null || !superMember.isGenerativeConstructor()) { |
| 3885 DualKind kind = MessageKind.CANNOT_FIND_CONSTRUCTOR; | 3887 DualKind kind = MessageKind.CANNOT_FIND_CONSTRUCTOR; |
| 3886 Map arguments = {'constructorName': ''}; | 3888 Map arguments = {'constructorName': ''}; |
| 3887 // TODO(ahe): Why is this a compile-time error? Or if it is an error, | 3889 // TODO(ahe): Why is this a compile-time error? Or if it is an error, |
| 3888 // why do we bother to registerThrowNoSuchMethod below? | 3890 // why do we bother to registerThrowNoSuchMethod below? |
| 3889 compiler.reportError(node, kind.error, arguments); | 3891 compiler.reportError(node, kind.error, arguments); |
| 3890 superMember = new ErroneousElementX( | 3892 superMember = new ErroneousElementX( |
| 3891 kind.error, arguments, '', element); | 3893 kind.error, arguments, '', element); |
| 3892 compiler.backend.registerThrowNoSuchMethod(mapping); | 3894 compiler.backend.registerThrowNoSuchMethod(mapping); |
| 3895 } else { | |
| 3896 Selector callToMatch = new Selector.call( | |
| 3897 "", | |
|
karlklose
2014/02/12 12:51:58
Can you fit the arguments on one line?
floitsch
2014/02/12 14:04:52
Done.
| |
| 3898 element.getLibrary(), | |
| 3899 0); | |
| 3900 if (!callToMatch.applies(superMember, compiler)) { | |
| 3901 MessageKind kind = MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT; | |
| 3902 compiler.reportError(node, kind); | |
| 3903 } | |
| 3893 } | 3904 } |
| 3894 FunctionElement constructor = | |
|
floitsch
2014/02/11 19:30:31
Moved these lines before the tests. Could move the
| |
| 3895 new SynthesizedConstructorElementX.forDefault(superMember, element); | |
| 3896 element.setDefaultConstructor(constructor, compiler); | |
| 3897 } | 3905 } |
| 3898 return element.computeType(compiler); | 3906 return element.computeType(compiler); |
| 3899 } | 3907 } |
| 3900 | 3908 |
| 3901 /// Resolves the mixed type for [mixinNode] and checks that the the mixin type | 3909 /// 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. | 3910 /// is a valid, non-blacklisted interface type. The mixin type is returned. |
| 3903 DartType checkMixinType(TypeAnnotation mixinNode) { | 3911 DartType checkMixinType(TypeAnnotation mixinNode) { |
| 3904 DartType mixinType = resolveType(mixinNode); | 3912 DartType mixinType = resolveType(mixinNode); |
| 3905 if (isBlackListed(mixinType)) { | 3913 if (isBlackListed(mixinType)) { |
| 3906 compiler.reportError(mixinNode, | 3914 compiler.reportError(mixinNode, |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4530 return finishConstructorReference(visit(expression), | 4538 return finishConstructorReference(visit(expression), |
| 4531 expression, expression); | 4539 expression, expression); |
| 4532 } | 4540 } |
| 4533 } | 4541 } |
| 4534 | 4542 |
| 4535 /// Looks up [name] in [scope] and unwraps the result. | 4543 /// Looks up [name] in [scope] and unwraps the result. |
| 4536 Element lookupInScope(Compiler compiler, Node node, | 4544 Element lookupInScope(Compiler compiler, Node node, |
| 4537 Scope scope, String name) { | 4545 Scope scope, String name) { |
| 4538 return Elements.unwrap(scope.lookup(name), compiler, node); | 4546 return Elements.unwrap(scope.lookup(name), compiler, node); |
| 4539 } | 4547 } |
| OLD | NEW |