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

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

Issue 141823002: Use Object as supertype in face of invalid supertypes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comment. Created 6 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
« no previous file with comments | « no previous file | tests/language/language_dart2js.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 get currentElement; 8 Element get currentElement;
9 Setlet<Node> get superUses; 9 Setlet<Node> get superUses;
10 10
(...skipping 3643 matching lines...) Expand 10 before | Expand all | Expand 10 after
3654 final TypeDeclarationElement enclosingElement; 3654 final TypeDeclarationElement enclosingElement;
3655 TypeDeclarationElement get element => enclosingElement; 3655 TypeDeclarationElement get element => enclosingElement;
3656 3656
3657 TypeDefinitionVisitor(Compiler compiler, 3657 TypeDefinitionVisitor(Compiler compiler,
3658 TypeDeclarationElement element, 3658 TypeDeclarationElement element,
3659 TreeElementMapping mapping) 3659 TreeElementMapping mapping)
3660 : this.enclosingElement = element, 3660 : this.enclosingElement = element,
3661 scope = Scope.buildEnclosingScope(element), 3661 scope = Scope.buildEnclosingScope(element),
3662 super(compiler, mapping); 3662 super(compiler, mapping);
3663 3663
3664 DartType get objectType => compiler.objectClass.rawType;
3665
3664 void resolveTypeVariableBounds(NodeList node) { 3666 void resolveTypeVariableBounds(NodeList node) {
3665 if (node == null) return; 3667 if (node == null) return;
3666 3668
3667 var nameSet = new Setlet<String>(); 3669 var nameSet = new Setlet<String>();
3668 // Resolve the bounds of type variables. 3670 // Resolve the bounds of type variables.
3669 Link<DartType> typeLink = element.typeVariables; 3671 Link<DartType> typeLink = element.typeVariables;
3670 Link<Node> nodeLink = node.nodes; 3672 Link<Node> nodeLink = node.nodes;
3671 while (!nodeLink.isEmpty) { 3673 while (!nodeLink.isEmpty) {
3672 TypeVariableType typeVariable = typeLink.head; 3674 TypeVariableType typeVariable = typeLink.head;
3673 String typeName = typeVariable.name; 3675 String typeName = typeVariable.name;
(...skipping 25 matching lines...) Expand all
3699 {'typeVariableName': variableElement.name}); 3701 {'typeVariableName': variableElement.name});
3700 } 3702 }
3701 break; 3703 break;
3702 } 3704 }
3703 seenTypeVariables = seenTypeVariables.prepend(element); 3705 seenTypeVariables = seenTypeVariables.prepend(element);
3704 bound = element.bound; 3706 bound = element.bound;
3705 } 3707 }
3706 } 3708 }
3707 addDeferredAction(element, checkTypeVariableBound); 3709 addDeferredAction(element, checkTypeVariableBound);
3708 } else { 3710 } else {
3709 variableElement.bound = compiler.objectClass.computeType(compiler); 3711 variableElement.bound = objectType;
3710 } 3712 }
3711 nodeLink = nodeLink.tail; 3713 nodeLink = nodeLink.tail;
3712 typeLink = typeLink.tail; 3714 typeLink = typeLink.tail;
3713 } 3715 }
3714 assert(typeLink.isEmpty); 3716 assert(typeLink.isEmpty);
3715 } 3717 }
3716 } 3718 }
3717 3719
3718 class TypedefResolverVisitor extends TypeDefinitionVisitor { 3720 class TypedefResolverVisitor extends TypeDefinitionVisitor {
3719 TypedefElement get element => enclosingElement; 3721 TypedefElement get element => enclosingElement;
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
4113 4115
4114 DartType resolveType(TypeAnnotation node) { 4116 DartType resolveType(TypeAnnotation node) {
4115 return typeResolver.resolveTypeAnnotation(this, node); 4117 return typeResolver.resolveTypeAnnotation(this, node);
4116 } 4118 }
4117 4119
4118 DartType resolveSupertype(ClassElement cls, TypeAnnotation superclass) { 4120 DartType resolveSupertype(ClassElement cls, TypeAnnotation superclass) {
4119 DartType supertype = resolveType(superclass); 4121 DartType supertype = resolveType(superclass);
4120 if (supertype != null) { 4122 if (supertype != null) {
4121 if (identical(supertype.kind, TypeKind.MALFORMED_TYPE)) { 4123 if (identical(supertype.kind, TypeKind.MALFORMED_TYPE)) {
4122 compiler.reportError(superclass, MessageKind.CANNOT_EXTEND_MALFORMED); 4124 compiler.reportError(superclass, MessageKind.CANNOT_EXTEND_MALFORMED);
4123 return null; 4125 return objectType;
4124 } else if (!identical(supertype.kind, TypeKind.INTERFACE)) { 4126 } else if (!identical(supertype.kind, TypeKind.INTERFACE)) {
4125 compiler.reportError(superclass.typeName, 4127 compiler.reportError(superclass.typeName,
4126 MessageKind.CLASS_NAME_EXPECTED); 4128 MessageKind.CLASS_NAME_EXPECTED);
4127 return null; 4129 return objectType;
4128 } else if (isBlackListed(supertype)) { 4130 } else if (isBlackListed(supertype)) {
4129 compiler.reportError(superclass, MessageKind.CANNOT_EXTEND, 4131 compiler.reportError(superclass, MessageKind.CANNOT_EXTEND,
4130 {'type': supertype}); 4132 {'type': supertype});
4131 return null; 4133 return objectType;
4132 } 4134 }
4133 } 4135 }
4134 return supertype; 4136 return supertype;
4135 } 4137 }
4136 4138
4137 Link<DartType> resolveInterfaces(NodeList interfaces, Node superclass) { 4139 Link<DartType> resolveInterfaces(NodeList interfaces, Node superclass) {
4138 Link<DartType> result = const Link<DartType>(); 4140 Link<DartType> result = const Link<DartType>();
4139 if (interfaces == null) return result; 4141 if (interfaces == null) return result;
4140 for (Link<Node> link = interfaces.nodes; !link.isEmpty; link = link.tail) { 4142 for (Link<Node> link = interfaces.nodes; !link.isEmpty; link = link.tail) {
4141 DartType interfaceType = resolveType(link.head); 4143 DartType interfaceType = resolveType(link.head);
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
4562 return finishConstructorReference(visit(expression), 4564 return finishConstructorReference(visit(expression),
4563 expression, expression); 4565 expression, expression);
4564 } 4566 }
4565 } 4567 }
4566 4568
4567 /// Looks up [name] in [scope] and unwraps the result. 4569 /// Looks up [name] in [scope] and unwraps the result.
4568 Element lookupInScope(Compiler compiler, Node node, 4570 Element lookupInScope(Compiler compiler, Node node,
4569 Scope scope, String name) { 4571 Scope scope, String name) {
4570 return Elements.unwrap(scope.lookup(name), compiler, node); 4572 return Elements.unwrap(scope.lookup(name), compiler, node);
4571 } 4573 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698