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