| 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 Set<Node> get superUses; | 9 Set<Node> get superUses; |
| 10 | 10 |
| (...skipping 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3200 Link<Node> link = superMixin.mixins.nodes; | 3200 Link<Node> link = superMixin.mixins.nodes; |
| 3201 while (!link.isEmpty) { | 3201 while (!link.isEmpty) { |
| 3202 supertype = applyMixin(supertype, resolveType(link.head)); | 3202 supertype = applyMixin(supertype, resolveType(link.head)); |
| 3203 link = link.tail; | 3203 link = link.tail; |
| 3204 } | 3204 } |
| 3205 element.supertype = supertype; | 3205 element.supertype = supertype; |
| 3206 } else { | 3206 } else { |
| 3207 element.supertype = resolveSupertype(element, node.superclass); | 3207 element.supertype = resolveSupertype(element, node.superclass); |
| 3208 } | 3208 } |
| 3209 } | 3209 } |
| 3210 | 3210 // If the super type isn't specified, we provide a default. The language |
| 3211 // If the super type isn't specified, we make it Object. | 3211 // specifies [Object] but the backend can pick a specific 'implementation' |
| 3212 final objectElement = compiler.objectClass; | 3212 // of Object - the JavaScript backend chooses between Object and |
| 3213 if (!identical(element, objectElement) && element.supertype == null) { | 3213 // Interceptor. |
| 3214 if (objectElement == null) { | 3214 if (element.supertype == null) { |
| 3215 compiler.internalError("Internal error: cannot resolve Object", | 3215 ClassElement superElement = compiler.backend.defaultSuperclass(element); |
| 3216 node: node); | 3216 // Avoid making the superclass (usually Object) extend itself. |
| 3217 } else { | 3217 if (element != superElement) { |
| 3218 objectElement.ensureResolved(compiler); | 3218 if (superElement == null) { |
| 3219 compiler.internalError( |
| 3220 "Cannot resolve default superclass for $element", |
| 3221 node: node); |
| 3222 } else { |
| 3223 superElement.ensureResolved(compiler); |
| 3224 } |
| 3225 element.supertype = superElement.computeType(compiler); |
| 3219 } | 3226 } |
| 3220 element.supertype = objectElement.computeType(compiler); | |
| 3221 } | 3227 } |
| 3222 | 3228 |
| 3223 assert(element.interfaces == null); | 3229 assert(element.interfaces == null); |
| 3224 element.interfaces = resolveInterfaces(node.interfaces, node.superclass); | 3230 element.interfaces = resolveInterfaces(node.interfaces, node.superclass); |
| 3225 calculateAllSupertypes(element); | 3231 calculateAllSupertypes(element); |
| 3226 | 3232 |
| 3227 if (node.defaultClause != null) { | 3233 if (node.defaultClause != null) { |
| 3228 element.defaultClass = visit(node.defaultClause); | 3234 element.defaultClass = visit(node.defaultClause); |
| 3229 } | 3235 } |
| 3230 element.addDefaultConstructorIfNeeded(compiler); | 3236 element.addDefaultConstructorIfNeeded(compiler); |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3980 return e; | 3986 return e; |
| 3981 } | 3987 } |
| 3982 | 3988 |
| 3983 /// Assumed to be called by [resolveRedirectingFactory]. | 3989 /// Assumed to be called by [resolveRedirectingFactory]. |
| 3984 Element visitReturn(Return node) { | 3990 Element visitReturn(Return node) { |
| 3985 Node expression = node.expression; | 3991 Node expression = node.expression; |
| 3986 return finishConstructorReference(visit(expression), | 3992 return finishConstructorReference(visit(expression), |
| 3987 expression, expression); | 3993 expression, expression); |
| 3988 } | 3994 } |
| 3989 } | 3995 } |
| OLD | NEW |