| 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 SendVisitor extends ResolvedVisitor { | 5 class SendVisitor extends ResolvedVisitor { |
| 6 final PlaceholderCollector collector; | 6 final PlaceholderCollector collector; |
| 7 | 7 |
| 8 SendVisitor(this.collector, TreeElements elements) : super(elements); | 8 SendVisitor(this.collector, TreeElements elements) : super(elements); |
| 9 | 9 |
| 10 visitSuperSend(Send node) {} | 10 visitSuperSend(Send node) {} |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (element is FunctionElement) { | 138 if (element is FunctionElement) { |
| 139 currentElement = element; | 139 currentElement = element; |
| 140 elementNode = currentElement.parseNode(compiler); | 140 elementNode = currentElement.parseNode(compiler); |
| 141 collectFunctionDeclarationPlaceholders(element, elementNode); | 141 collectFunctionDeclarationPlaceholders(element, elementNode); |
| 142 } else if (element.isField()) { | 142 } else if (element.isField()) { |
| 143 // TODO(smok): In the future make sure we don't process same | 143 // TODO(smok): In the future make sure we don't process same |
| 144 // variable list element twice, better merge this with emitter logic. | 144 // variable list element twice, better merge this with emitter logic. |
| 145 currentElement = element.variables; | 145 currentElement = element.variables; |
| 146 elementNode = currentElement.parseNode(compiler); | 146 elementNode = currentElement.parseNode(compiler); |
| 147 collectFieldDeclarationPlaceholders(element, elementNode); | 147 collectFieldDeclarationPlaceholders(element, elementNode); |
| 148 } else if (element is ClassElement || element is TypedefElement) { |
| 149 currentElement = element; |
| 150 elementNode = currentElement.parseNode(compiler); |
| 148 } else { | 151 } else { |
| 149 assert(false); // Unreachable. | 152 assert(false); // Unreachable. |
| 150 } | 153 } |
| 151 elementNode.accept(this); | 154 elementNode.accept(this); |
| 152 } | 155 } |
| 153 | 156 |
| 154 Type resolveType(TypeAnnotation typeAnnotation) { | 157 Type resolveType(TypeAnnotation typeAnnotation) { |
| 155 if (treeElements === null) return null; | 158 if (treeElements === null) return null; |
| 156 var result = treeElements.getType(typeAnnotation); | 159 var result = treeElements.getType(typeAnnotation); |
| 157 // TODO: Have better type resolution. | 160 // TODO: Have better type resolution. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 185 } | 188 } |
| 186 | 189 |
| 187 void internalError(String reason, [Node node]) { | 190 void internalError(String reason, [Node node]) { |
| 188 compiler.cancel(reason: reason, node: node); | 191 compiler.cancel(reason: reason, node: node); |
| 189 } | 192 } |
| 190 | 193 |
| 191 visit(Node node) => (node === null) ? null : node.accept(this); | 194 visit(Node node) => (node === null) ? null : node.accept(this); |
| 192 | 195 |
| 193 visitNode(Node node) { node.visitChildren(this); } // We must go deeper. | 196 visitNode(Node node) { node.visitChildren(this); } // We must go deeper. |
| 194 | 197 |
| 195 visitClassNode(ClassNode node) { | |
| 196 internalError('Should never meet ClassNode', node); | |
| 197 } | |
| 198 | |
| 199 visitSend(Send send) { | 198 visitSend(Send send) { |
| 200 new SendVisitor(this, treeElements).visitSend(send); | 199 new SendVisitor(this, treeElements).visitSend(send); |
| 201 send.visitChildren(this); | 200 send.visitChildren(this); |
| 202 } | 201 } |
| 203 | 202 |
| 204 visitSendSet(SendSet send) { | 203 visitSendSet(SendSet send) { |
| 205 final element = treeElements[send]; | 204 final element = treeElements[send]; |
| 206 if (element !== null && element.isInstanceMember()) { | 205 if (element !== null && element.isInstanceMember()) { |
| 207 tryMakePrivateIdentifier(send.selector.asIdentifier()); | 206 tryMakePrivateIdentifier(send.selector.asIdentifier()); |
| 208 } | 207 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 219 final send = node.typeName.asSend(); | 218 final send = node.typeName.asSend(); |
| 220 final hasPrefix = element.lookupConstructor( | 219 final hasPrefix = element.lookupConstructor( |
| 221 send.receiver.source, send.selector.source) === null; | 220 send.receiver.source, send.selector.source) === null; |
| 222 if (!hasPrefix) target = send.receiver; | 221 if (!hasPrefix) target = send.receiver; |
| 223 } | 222 } |
| 224 } | 223 } |
| 225 makeTypePlaceholder(target, type); | 224 makeTypePlaceholder(target, type); |
| 226 node.visitChildren(this); | 225 node.visitChildren(this); |
| 227 } | 226 } |
| 228 } | 227 } |
| OLD | NEW |