| 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 dart_backend; | 5 part of dart_backend; |
| 6 | 6 |
| 7 class LocalPlaceholder { | 7 class LocalPlaceholder { |
| 8 final String identifier; | 8 final String identifier; |
| 9 final Set<Node> nodes; | 9 final Set<Node> nodes; |
| 10 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); | 10 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 class DeclarationTypePlaceholder { | 38 class DeclarationTypePlaceholder { |
| 39 final TypeAnnotation typeNode; | 39 final TypeAnnotation typeNode; |
| 40 final bool requiresVar; | 40 final bool requiresVar; |
| 41 DeclarationTypePlaceholder(this.typeNode, this.requiresVar); | 41 DeclarationTypePlaceholder(this.typeNode, this.requiresVar); |
| 42 } | 42 } |
| 43 | 43 |
| 44 class SendVisitor extends ResolvedVisitor { | 44 class SendVisitor extends ResolvedVisitor { |
| 45 final PlaceholderCollector collector; | 45 final PlaceholderCollector collector; |
| 46 | 46 |
| 47 get compiler => collector.compiler; | 47 SendVisitor(collector, TreeElements elements) |
| 48 | 48 : this.collector = collector, |
| 49 SendVisitor(this.collector, TreeElements elements) : super(elements); | 49 super(elements, collector.compiler); |
| 50 | 50 |
| 51 visitOperatorSend(Send node) { | 51 visitOperatorSend(Send node) { |
| 52 } | 52 } |
| 53 | 53 |
| 54 visitForeignSend(Send node) {} | 54 visitForeignSend(Send node) {} |
| 55 | 55 |
| 56 visitSuperSend(Send node) { | 56 visitSuperSend(Send node) { |
| 57 Element element = elements[node]; | 57 Element element = elements[node]; |
| 58 if (element != null && element.isConstructor()) { | 58 if (element != null && element.isConstructor()) { |
| 59 collector.makeRedirectingConstructorPlaceholder(node.selector, element); | 59 collector.makeRedirectingConstructorPlaceholder(node.selector, element); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // in case of A(int this.f()); | 97 // in case of A(int this.f()); |
| 98 if (node.selector is Identifier) { | 98 if (node.selector is Identifier) { |
| 99 collector.tryMakeLocalPlaceholder(element, node.selector); | 99 collector.tryMakeLocalPlaceholder(element, node.selector); |
| 100 } else { | 100 } else { |
| 101 assert(node.selector is FunctionExpression); | 101 assert(node.selector is FunctionExpression); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 visitAssert(node) { |
| 108 visitStaticSend(node); |
| 109 } |
| 110 |
| 107 visitStaticSend(Send node) { | 111 visitStaticSend(Send node) { |
| 108 final element = elements[node]; | 112 final element = elements[node]; |
| 109 collector.backend.registerStaticSend(element, node); | 113 collector.backend.registerStaticSend(element, node); |
| 110 | 114 |
| 111 if (Elements.isUnresolved(element) | 115 if (Elements.isUnresolved(element) |
| 112 || identical(element, compiler.assertMethod)) { | 116 || identical(element, compiler.assertMethod)) { |
| 113 return; | 117 return; |
| 114 } | 118 } |
| 115 if (element.isConstructor() || element.isFactoryConstructor()) { | 119 if (element.isConstructor() || element.isFactoryConstructor()) { |
| 116 // Rename named constructor in redirection position: | 120 // Rename named constructor in redirection position: |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 626 |
| 623 visitBlock(Block node) { | 627 visitBlock(Block node) { |
| 624 for (Node statement in node.statements.nodes) { | 628 for (Node statement in node.statements.nodes) { |
| 625 if (statement is VariableDefinitions) { | 629 if (statement is VariableDefinitions) { |
| 626 makeVarDeclarationTypePlaceholder(statement); | 630 makeVarDeclarationTypePlaceholder(statement); |
| 627 } | 631 } |
| 628 } | 632 } |
| 629 node.visitChildren(this); | 633 node.visitChildren(this); |
| 630 } | 634 } |
| 631 } | 635 } |
| OLD | NEW |