Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 12210013: Implement subtype for type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 operator[](Node node); 8 Element operator[](Node node);
9 Selector getSelector(Send send); 9 Selector getSelector(Send send);
10 DartType getType(Node node); 10 DartType getType(Node node);
(...skipping 2767 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 TypeVariableElement variableElement = typeVariable.element; 2778 TypeVariableElement variableElement = typeVariable.element;
2779 if (typeNode.bound != null) { 2779 if (typeNode.bound != null) {
2780 DartType boundType = typeResolver.resolveTypeAnnotation( 2780 DartType boundType = typeResolver.resolveTypeAnnotation(
2781 typeNode.bound, scope, element, onFailure: warning); 2781 typeNode.bound, scope, element, onFailure: warning);
2782 if (boundType != null && boundType.element == variableElement) { 2782 if (boundType != null && boundType.element == variableElement) {
2783 // TODO(johnniwinther): Check for more general cycles, like 2783 // TODO(johnniwinther): Check for more general cycles, like
2784 // [: <A extends B, B extends C, C extends B> :]. 2784 // [: <A extends B, B extends C, C extends B> :].
2785 warning(node, MessageKind.CYCLIC_TYPE_VARIABLE, 2785 warning(node, MessageKind.CYCLIC_TYPE_VARIABLE,
2786 {'typeVariableName': variableElement.name}); 2786 {'typeVariableName': variableElement.name});
2787 } else if (boundType != null) { 2787 } else if (boundType != null) {
2788 variableElement.bound = boundType; 2788 variableElement.upperBound = boundType;
2789 } else { 2789 } else {
2790 // TODO(johnniwinther): Should be an erroneous type. 2790 // TODO(johnniwinther): Should be an erroneous type.
2791 variableElement.bound = compiler.objectClass.computeType(compiler); 2791 variableElement.upperBound = compiler.objectClass.computeType(compiler );
2792 } 2792 }
2793 } else { 2793 } else {
2794 variableElement.bound = compiler.objectClass.computeType(compiler); 2794 variableElement.upperBound = compiler.objectClass.computeType(compiler);
2795 } 2795 }
2796 nodeLink = nodeLink.tail; 2796 nodeLink = nodeLink.tail;
2797 typeLink = typeLink.tail; 2797 typeLink = typeLink.tail;
2798 } 2798 }
2799 assert(typeLink.isEmpty); 2799 assert(typeLink.isEmpty);
2800 } 2800 }
2801 } 2801 }
2802 2802
2803 class TypedefResolverVisitor extends TypeDefinitionVisitor { 2803 class TypedefResolverVisitor extends TypeDefinitionVisitor {
2804 TypedefElement get element => super.element; 2804 TypedefElement get element => super.element;
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
3624 return e; 3624 return e;
3625 } 3625 }
3626 3626
3627 /// Assumed to be called by [resolveRedirectingFactory]. 3627 /// Assumed to be called by [resolveRedirectingFactory].
3628 Element visitReturn(Return node) { 3628 Element visitReturn(Return node) {
3629 Node expression = node.expression; 3629 Node expression = node.expression;
3630 return finishConstructorReference(visit(expression), 3630 return finishConstructorReference(visit(expression),
3631 expression, expression); 3631 expression, expression);
3632 } 3632 }
3633 } 3633 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698