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 { | 5 class LocalPlaceholder { |
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 get hashCode => identifier.hashCode; | 9 int get hashCode => identifier.hashCode; |
10 String toString() => | 10 String toString() => |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // Another ugly case: <lib prefix>.<top level> is represented as | 127 // Another ugly case: <lib prefix>.<top level> is represented as |
128 // receiver: lib prefix, selector: top level. | 128 // receiver: lib prefix, selector: top level. |
129 if (element.isTopLevel() && node.receiver != null) { | 129 if (element.isTopLevel() && node.receiver != null) { |
130 assert(elements[node.receiver].isPrefix()); | 130 assert(elements[node.receiver].isPrefix()); |
131 // Hack: putting null into map overrides receiver of original node. | 131 // Hack: putting null into map overrides receiver of original node. |
132 collector.makeNullPlaceholder(node.receiver); | 132 collector.makeNullPlaceholder(node.receiver); |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 internalError(String reason, {Node node}) { | 136 internalError(String reason, {Node node}) { |
137 collector.internalError(reason, node); | 137 collector.internalError(reason, node: node); |
| 138 } |
| 139 |
| 140 visitTypeReferenceSend(Send node) { |
| 141 ClassElement element = elements[node]; |
| 142 collector.makeElementPlaceholder(node.selector, element); |
138 } | 143 } |
139 } | 144 } |
140 | 145 |
141 class PlaceholderCollector extends Visitor { | 146 class PlaceholderCollector extends Visitor { |
142 final Compiler compiler; | 147 final Compiler compiler; |
143 final Set<String> fixedMemberNames; // member names which cannot be renamed. | 148 final Set<String> fixedMemberNames; // member names which cannot be renamed. |
144 final Map<Element, ElementAst> elementAsts; | 149 final Map<Element, ElementAst> elementAsts; |
145 final Set<Node> nullNodes; // Nodes that should not be in output. | 150 final Set<Node> nullNodes; // Nodes that should not be in output. |
146 final Set<Identifier> unresolvedNodes; | 151 final Set<Identifier> unresolvedNodes; |
147 final Map<Element, Set<Identifier>> elementNodes; | 152 final Map<Element, Set<Identifier>> elementNodes; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 LocalPlaceholder localPlaceholder = new LocalPlaceholder(name); | 366 LocalPlaceholder localPlaceholder = new LocalPlaceholder(name); |
362 currentFunctionScope.localPlaceholders.add(localPlaceholder); | 367 currentFunctionScope.localPlaceholders.add(localPlaceholder); |
363 return localPlaceholder; | 368 return localPlaceholder; |
364 }); | 369 }); |
365 } | 370 } |
366 | 371 |
367 getLocalPlaceholder().nodes.add(identifier); | 372 getLocalPlaceholder().nodes.add(identifier); |
368 } | 373 } |
369 | 374 |
370 void internalError(String reason, {Node node}) { | 375 void internalError(String reason, {Node node}) { |
371 compiler.cancel(reason: reason, node: node); | 376 compiler.cancel(reason, node: node); |
372 } | 377 } |
373 | 378 |
374 void unreachable() { internalError('Unreachable case'); } | 379 void unreachable() { internalError('Unreachable case'); } |
375 | 380 |
376 visit(Node node) => (node == null) ? null : node.accept(this); | 381 visit(Node node) => (node == null) ? null : node.accept(this); |
377 | 382 |
378 visitNode(Node node) { node.visitChildren(this); } // We must go deeper. | 383 visitNode(Node node) { node.visitChildren(this); } // We must go deeper. |
379 | 384 |
380 visitSend(Send send) { | 385 visitSend(Send send) { |
381 new SendVisitor(this, treeElements).visitSend(send); | 386 new SendVisitor(this, treeElements).visitSend(send); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 | 641 |
637 visitBlock(Block node) { | 642 visitBlock(Block node) { |
638 for (Node statement in node.statements.nodes) { | 643 for (Node statement in node.statements.nodes) { |
639 if (statement is VariableDefinitions) { | 644 if (statement is VariableDefinitions) { |
640 makeVarDeclarationTypePlaceholder(statement); | 645 makeVarDeclarationTypePlaceholder(statement); |
641 } | 646 } |
642 } | 647 } |
643 node.visitChildren(this); | 648 node.visitChildren(this); |
644 } | 649 } |
645 } | 650 } |
OLD | NEW |