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 class LocalPlaceholder implements Hashable { | 5 class LocalPlaceholder implements Hashable { |
6 final String identifier; | 6 final String identifier; |
7 final Set<Node> nodes; | 7 final Set<Node> nodes; |
8 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); | 8 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); |
9 int hashCode() => identifier.hashCode(); | 9 int hashCode() => identifier.hashCode(); |
10 String toString() => | 10 String toString() => |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 class DeclarationTypePlaceholder { | 25 class DeclarationTypePlaceholder { |
26 final TypeAnnotation typeNode; | 26 final TypeAnnotation typeNode; |
27 final bool requiresVar; | 27 final bool requiresVar; |
28 DeclarationTypePlaceholder(this.typeNode, this.requiresVar); | 28 DeclarationTypePlaceholder(this.typeNode, this.requiresVar); |
29 } | 29 } |
30 | 30 |
31 class SendVisitor extends ResolvedVisitor { | 31 class SendVisitor extends ResolvedVisitor { |
32 final PlaceholderCollector collector; | 32 final PlaceholderCollector collector; |
33 | 33 |
| 34 get compiler => collector.compiler; |
| 35 |
34 SendVisitor(this.collector, TreeElements elements) : super(elements); | 36 SendVisitor(this.collector, TreeElements elements) : super(elements); |
35 | 37 |
36 visitOperatorSend(Send node) {} | 38 visitOperatorSend(Send node) {} |
37 visitForeignSend(Send node) {} | 39 visitForeignSend(Send node) {} |
38 | 40 |
39 visitSuperSend(Send node) { | 41 visitSuperSend(Send node) { |
40 collector.tryMakeMemberPlaceholder(node.selector); | 42 collector.tryMakeMemberPlaceholder(node.selector); |
41 } | 43 } |
42 | 44 |
43 visitDynamicSend(Send node) { | 45 visitDynamicSend(Send node) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 collector.tryMakeLocalPlaceholder(element, node.selector); | 79 collector.tryMakeLocalPlaceholder(element, node.selector); |
78 } else { | 80 } else { |
79 assert(node.selector is FunctionExpression); | 81 assert(node.selector is FunctionExpression); |
80 } | 82 } |
81 } | 83 } |
82 } | 84 } |
83 } | 85 } |
84 | 86 |
85 visitStaticSend(Send node) { | 87 visitStaticSend(Send node) { |
86 final element = elements[node]; | 88 final element = elements[node]; |
87 if (Elements.isUnresolved(element)) { | 89 if (Elements.isUnresolved(element) || element === compiler.assertMethod) { |
88 return; | 90 return; |
89 } | 91 } |
90 if (element.isConstructor() || element.isFactoryConstructor()) { | 92 if (element.isConstructor() || element.isFactoryConstructor()) { |
91 // Rename named constructor in redirection position: | 93 // Rename named constructor in redirection position: |
92 // class C { C.named(); C.redirecting() : this.named(); } | 94 // class C { C.named(); C.redirecting() : this.named(); } |
93 if (node.receiver is Identifier | 95 if (node.receiver is Identifier |
94 && node.receiver.asIdentifier().isThis()) { | 96 && node.receiver.asIdentifier().isThis()) { |
95 assert(node.selector is Identifier); | 97 assert(node.selector is Identifier); |
96 collector.tryMakeMemberPlaceholder(node.selector); | 98 collector.tryMakeMemberPlaceholder(node.selector); |
97 } | 99 } |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 570 |
569 visitBlock(Block node) { | 571 visitBlock(Block node) { |
570 for (Node statement in node.statements.nodes) { | 572 for (Node statement in node.statements.nodes) { |
571 if (statement is VariableDefinitions) { | 573 if (statement is VariableDefinitions) { |
572 makeVarDeclarationTypePlaceholder(statement); | 574 makeVarDeclarationTypePlaceholder(statement); |
573 } | 575 } |
574 } | 576 } |
575 node.visitChildren(this); | 577 node.visitChildren(this); |
576 } | 578 } |
577 } | 579 } |
OLD | NEW |