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 Set<Node> get superUses; | 9 Set<Node> get superUses; |
| 10 | 10 |
| (...skipping 3170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3181 Link<Node> link = superMixin.mixins.nodes; | 3181 Link<Node> link = superMixin.mixins.nodes; |
| 3182 while (!link.isEmpty) { | 3182 while (!link.isEmpty) { |
| 3183 supertype = applyMixin(supertype, resolveType(link.head)); | 3183 supertype = applyMixin(supertype, resolveType(link.head)); |
| 3184 link = link.tail; | 3184 link = link.tail; |
| 3185 } | 3185 } |
| 3186 element.supertype = supertype; | 3186 element.supertype = supertype; |
| 3187 } else { | 3187 } else { |
| 3188 element.supertype = resolveSupertype(element, node.superclass); | 3188 element.supertype = resolveSupertype(element, node.superclass); |
| 3189 } | 3189 } |
| 3190 } | 3190 } |
| 3191 | |
| 3192 // If the super type isn't specified, we make it Object. | 3191 // If the super type isn't specified, we make it Object. |
|
karlklose
2013/04/24 14:27:28
Please update the comment.
sra1
2013/04/24 17:32:43
Done.
| |
| 3193 final objectElement = compiler.objectClass; | 3192 if (element.supertype == null && element != compiler.objectClass) { |
|
ngeoffray
2013/04/24 06:58:13
This code looks kind of convoluted. I'd prefer hav
sra1
2013/04/24 17:32:43
Since this is the resolver we should use the backe
| |
| 3194 if (!identical(element, objectElement) && element.supertype == null) { | 3193 final superElement = compiler.backend.defaultSuperclass(element); |
|
ngeoffray
2013/04/24 06:58:13
final -> ClassElement
sra1
2013/04/24 17:32:43
Done.
| |
| 3195 if (objectElement == null) { | 3194 if (element != superElement) { // I.e. don't make Object extend Object. |
|
ngeoffray
2013/04/24 06:58:13
You already made that test (don't make Object exte
sra1
2013/04/24 17:32:43
Not quite true. I'll clarify the comment. We dont
| |
| 3196 compiler.internalError("Internal error: cannot resolve Object", | 3195 if (superElement == null) { |
| 3197 node: node); | 3196 compiler.internalError("Internal error: cannot resolve Object", |
| 3198 } else { | 3197 node: node); |
| 3199 objectElement.ensureResolved(compiler); | 3198 } else { |
| 3199 superElement.ensureResolved(compiler); | |
| 3200 } | |
| 3201 element.supertype = superElement.computeType(compiler); | |
| 3200 } | 3202 } |
| 3201 element.supertype = objectElement.computeType(compiler); | |
| 3202 } | 3203 } |
| 3203 | 3204 |
| 3204 assert(element.interfaces == null); | 3205 assert(element.interfaces == null); |
| 3205 element.interfaces = resolveInterfaces(node.interfaces, node.superclass); | 3206 element.interfaces = resolveInterfaces(node.interfaces, node.superclass); |
| 3206 calculateAllSupertypes(element); | 3207 calculateAllSupertypes(element); |
| 3207 | 3208 |
| 3208 if (node.defaultClause != null) { | 3209 if (node.defaultClause != null) { |
| 3209 element.defaultClass = visit(node.defaultClause); | 3210 element.defaultClass = visit(node.defaultClause); |
| 3210 } | 3211 } |
| 3211 element.addDefaultConstructorIfNeeded(compiler); | 3212 element.addDefaultConstructorIfNeeded(compiler); |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3960 return e; | 3961 return e; |
| 3961 } | 3962 } |
| 3962 | 3963 |
| 3963 /// Assumed to be called by [resolveRedirectingFactory]. | 3964 /// Assumed to be called by [resolveRedirectingFactory]. |
| 3964 Element visitReturn(Return node) { | 3965 Element visitReturn(Return node) { |
| 3965 Node expression = node.expression; | 3966 Node expression = node.expression; |
| 3966 return finishConstructorReference(visit(expression), | 3967 return finishConstructorReference(visit(expression), |
| 3967 expression, expression); | 3968 expression, expression); |
| 3968 } | 3969 } |
| 3969 } | 3970 } |
| OLD | NEW |