| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 visitClosureSend(Send node) { | 69 visitClosureSend(Send node) { |
| 70 final element = elements[node]; | 70 final element = elements[node]; |
| 71 if (element != null) { | 71 if (element != null) { |
| 72 collector.tryMakeLocalPlaceholder(element, node.selector); | 72 collector.tryMakeLocalPlaceholder(element, node.selector); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 visitGetterSend(Send node) { | 76 visitGetterSend(Send node) { |
| 77 final element = elements[node]; | 77 final element = elements[node]; |
| 78 // element === null means dynamic property access. | 78 // element == null means dynamic property access. |
| 79 if (element == null) { | 79 if (element == null) { |
| 80 collector.tryMakeMemberPlaceholder(node.selector); | 80 collector.tryMakeMemberPlaceholder(node.selector); |
| 81 } else if (element.isErroneous()) { | 81 } else if (element.isErroneous()) { |
| 82 return; | 82 return; |
| 83 } else if (element.isPrefix()) { | 83 } else if (element.isPrefix()) { |
| 84 // Node is prefix part in case of source 'lib.somesetter = 5;' | 84 // Node is prefix part in case of source 'lib.somesetter = 5;' |
| 85 collector.makeNullPlaceholder(node); | 85 collector.makeNullPlaceholder(node); |
| 86 } else if (Elements.isStaticOrTopLevel(element)) { | 86 } else if (Elements.isStaticOrTopLevel(element)) { |
| 87 // Unqualified or prefixed top level or static. | 87 // Unqualified or prefixed top level or static. |
| 88 collector.makeElementPlaceholder(node.selector, element); | 88 collector.makeElementPlaceholder(node.selector, element); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 this.topmostEnclosingFunction = null; | 204 this.topmostEnclosingFunction = null; |
| 205 final ElementAst elementAst = elementAsts[element]; | 205 final ElementAst elementAst = elementAsts[element]; |
| 206 this.treeElements = elementAst.treeElements; | 206 this.treeElements = elementAst.treeElements; |
| 207 Node elementNode = elementAst.ast; | 207 Node elementNode = elementAst.ast; |
| 208 if (element is FunctionElement) { | 208 if (element is FunctionElement) { |
| 209 collectFunctionDeclarationPlaceholders(element, elementNode); | 209 collectFunctionDeclarationPlaceholders(element, elementNode); |
| 210 } else if (element is VariableListElement) { | 210 } else if (element is VariableListElement) { |
| 211 VariableDefinitions definitions = elementNode; | 211 VariableDefinitions definitions = elementNode; |
| 212 for (Node definition in definitions.definitions) { | 212 for (Node definition in definitions.definitions) { |
| 213 final definitionElement = treeElements[definition]; | 213 final definitionElement = treeElements[definition]; |
| 214 // definitionElement === null if variable is actually unused. | 214 // definitionElement == null if variable is actually unused. |
| 215 if (definitionElement == null) continue; | 215 if (definitionElement == null) continue; |
| 216 collectFieldDeclarationPlaceholders(definitionElement, definition); | 216 collectFieldDeclarationPlaceholders(definitionElement, definition); |
| 217 } | 217 } |
| 218 makeVarDeclarationTypePlaceholder(definitions); | 218 makeVarDeclarationTypePlaceholder(definitions); |
| 219 } else { | 219 } else { |
| 220 assert(element is ClassElement || element is TypedefElement); | 220 assert(element is ClassElement || element is TypedefElement); |
| 221 } | 221 } |
| 222 currentLocalPlaceholders = new Map<String, LocalPlaceholder>(); | 222 currentLocalPlaceholders = new Map<String, LocalPlaceholder>(); |
| 223 compiler.withCurrentElement(element, () { | 223 compiler.withCurrentElement(element, () { |
| 224 elementNode.accept(this); | 224 elementNode.accept(this); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 | 605 |
| 606 visitBlock(Block node) { | 606 visitBlock(Block node) { |
| 607 for (Node statement in node.statements.nodes) { | 607 for (Node statement in node.statements.nodes) { |
| 608 if (statement is VariableDefinitions) { | 608 if (statement is VariableDefinitions) { |
| 609 makeVarDeclarationTypePlaceholder(statement); | 609 makeVarDeclarationTypePlaceholder(statement); |
| 610 } | 610 } |
| 611 } | 611 } |
| 612 node.visitChildren(this); | 612 node.visitChildren(this); |
| 613 } | 613 } |
| 614 } | 614 } |
| OLD | NEW |