| 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 3495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3506 : context = Scope.buildEnclosingScope(cls), | 3506 : context = Scope.buildEnclosingScope(cls), |
| 3507 this.classElement = cls, | 3507 this.classElement = cls, |
| 3508 super(compiler); | 3508 super(compiler); |
| 3509 | 3509 |
| 3510 void loadSupertype(ClassElement element, Node from) { | 3510 void loadSupertype(ClassElement element, Node from) { |
| 3511 compiler.resolver.loadSupertypes(element, from); | 3511 compiler.resolver.loadSupertypes(element, from); |
| 3512 element.ensureResolved(compiler); | 3512 element.ensureResolved(compiler); |
| 3513 } | 3513 } |
| 3514 | 3514 |
| 3515 void visitNodeList(NodeList node) { | 3515 void visitNodeList(NodeList node) { |
| 3516 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { | 3516 if (node != null) { |
| 3517 link.head.accept(this); | 3517 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { |
| 3518 link.head.accept(this); |
| 3519 } |
| 3518 } | 3520 } |
| 3519 } | 3521 } |
| 3520 | 3522 |
| 3521 void visitClassNode(ClassNode node) { | 3523 void visitClassNode(ClassNode node) { |
| 3522 if (node.superclass == null) { | 3524 if (node.superclass == null) { |
| 3523 if (!identical(classElement, compiler.objectClass)) { | 3525 if (!identical(classElement, compiler.objectClass)) { |
| 3524 loadSupertype(compiler.objectClass, node); | 3526 loadSupertype(compiler.objectClass, node); |
| 3525 } | 3527 } |
| 3526 } else { | 3528 } else { |
| 3527 node.superclass.accept(this); | 3529 node.superclass.accept(this); |
| 3528 } | 3530 } |
| 3529 visitNodeList(node.interfaces); | 3531 visitNodeList(node.interfaces); |
| 3530 } | 3532 } |
| 3531 | 3533 |
| 3532 void visitMixinApplication(MixinApplication node) { | 3534 void visitMixinApplication(MixinApplication node) { |
| 3533 node.superclass.accept(this); | 3535 node.superclass.accept(this); |
| 3534 visitNodeList(node.mixins); | 3536 visitNodeList(node.mixins); |
| 3535 } | 3537 } |
| 3536 | 3538 |
| 3539 void visitNamedMixinApplication(NamedMixinApplication node) { |
| 3540 node.superclass.accept(this); |
| 3541 visitNodeList(node.mixins); |
| 3542 visitNodeList(node.interfaces); |
| 3543 } |
| 3544 |
| 3537 void visitTypeAnnotation(TypeAnnotation node) { | 3545 void visitTypeAnnotation(TypeAnnotation node) { |
| 3538 node.typeName.accept(this); | 3546 node.typeName.accept(this); |
| 3539 } | 3547 } |
| 3540 | 3548 |
| 3541 void visitIdentifier(Identifier node) { | 3549 void visitIdentifier(Identifier node) { |
| 3542 Element element = context.lookup(node.source); | 3550 Element element = context.lookup(node.source); |
| 3543 if (element == null) { | 3551 if (element == null) { |
| 3544 error(node, MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node}); | 3552 error(node, MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node}); |
| 3545 } else if (!element.impliesType()) { | 3553 } else if (!element.impliesType()) { |
| 3546 error(node, MessageKind.NOT_A_TYPE, {'node': node}); | 3554 error(node, MessageKind.NOT_A_TYPE, {'node': node}); |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3986 return e; | 3994 return e; |
| 3987 } | 3995 } |
| 3988 | 3996 |
| 3989 /// Assumed to be called by [resolveRedirectingFactory]. | 3997 /// Assumed to be called by [resolveRedirectingFactory]. |
| 3990 Element visitReturn(Return node) { | 3998 Element visitReturn(Return node) { |
| 3991 Node expression = node.expression; | 3999 Node expression = node.expression; |
| 3992 return finishConstructorReference(visit(expression), | 4000 return finishConstructorReference(visit(expression), |
| 3993 expression, expression); | 4001 expression, expression); |
| 3994 } | 4002 } |
| 3995 } | 4003 } |
| OLD | NEW |