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 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 for (Node definition in node.definitions) { | 168 for (Node definition in node.definitions) { |
| 169 if (definition is Identifier) { | 169 if (definition is Identifier) { |
| 170 tryMakePrivateIdentifier(definition.asIdentifier()); | 170 tryMakePrivateIdentifier(definition.asIdentifier()); |
| 171 } else if (definition is SendSet) { | 171 } else if (definition is SendSet) { |
| 172 tryMakePrivateIdentifier( | 172 tryMakePrivateIdentifier( |
| 173 definition.asSendSet().selector.asIdentifier()); | 173 definition.asSendSet().selector.asIdentifier()); |
| 174 } else { | 174 } else { |
| 175 internalError('Unreachable case'); | 175 internalError('Unreachable case'); |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 } else if (element.isTopLevel()) { | |
| 179 Node fieldNode = element.parseNode(compiler); | |
| 180 if (fieldNode is Identifier) { | |
| 181 makeElementPlaceholder(fieldNode, element); | |
| 182 } else if (fieldNode is SendSet) { | |
| 183 makeElementPlaceholder(fieldNode.selector, element); | |
| 184 } else { | |
| 185 assert(false); // Unreachable. | |
|
Anton Muhin
2012/08/16 11:05:48
nit: internalError, please
Roman
2012/08/16 11:46:09
Done.
| |
| 186 } | |
| 178 } | 187 } |
| 179 } | 188 } |
| 180 | 189 |
| 181 void collect(Element element, TreeElements elements) { | 190 void collect(Element element, TreeElements elements) { |
| 182 treeElements = elements; | 191 treeElements = elements; |
| 183 Node elementNode; | 192 Node elementNode; |
| 184 if (element is FunctionElement) { | 193 if (element is FunctionElement) { |
| 185 currentElement = element; | 194 currentElement = element; |
| 186 elementNode = currentElement.parseNode(compiler); | 195 elementNode = currentElement.parseNode(compiler); |
| 187 collectFunctionDeclarationPlaceholders(element, elementNode); | 196 collectFunctionDeclarationPlaceholders(element, elementNode); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 } | 406 } |
| 398 node.visitChildren(this); | 407 node.visitChildren(this); |
| 399 } | 408 } |
| 400 | 409 |
| 401 visitClassNode(ClassNode node) { | 410 visitClassNode(ClassNode node) { |
| 402 assert(currentElement is ClassElement); | 411 assert(currentElement is ClassElement); |
| 403 makeElementPlaceholder(node.name, currentElement); | 412 makeElementPlaceholder(node.name, currentElement); |
| 404 node.visitChildren(this); | 413 node.visitChildren(this); |
| 405 } | 414 } |
| 406 } | 415 } |
| OLD | NEW |