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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 elementNode = currentElement.parseNode(compiler); | 215 elementNode = currentElement.parseNode(compiler); |
| 216 } else { | 216 } else { |
| 217 assert(false); // Unreachable. | 217 assert(false); // Unreachable. |
| 218 } | 218 } |
| 219 currentLocalPlaceholders = new Map<String, LocalPlaceholder>(); | 219 currentLocalPlaceholders = new Map<String, LocalPlaceholder>(); |
| 220 compiler.withCurrentElement(element, () { | 220 compiler.withCurrentElement(element, () { |
| 221 elementNode.accept(this); | 221 elementNode.accept(this); |
| 222 }); | 222 }); |
| 223 } | 223 } |
| 224 | 224 |
| 225 Type resolveType(TypeAnnotation typeAnnotation) { | |
|
Roman
2012/08/21 07:47:13
This method should be used in visitTypeAnnotation
Anton Muhin
2012/08/21 13:17:57
There are enough of hacks in visitTypeAnnotation,
| |
| 226 if (treeElements === null) return null; | |
| 227 var result = treeElements.getType(typeAnnotation); | |
| 228 // TODO: Have better type resolution. | |
| 229 if (result === null) { | |
| 230 result = compiler.resolveTypeAnnotation(currentElement, typeAnnotation); | |
| 231 } | |
| 232 return result; | |
| 233 } | |
| 234 | |
| 235 void tryMakePrivateIdentifier(Identifier identifier) { | 225 void tryMakePrivateIdentifier(Identifier identifier) { |
| 236 if (identifier.source.isPrivate()) makePrivateIdentifier(identifier); | 226 if (identifier.source.isPrivate()) makePrivateIdentifier(identifier); |
| 237 } | 227 } |
| 238 | 228 |
| 239 void tryMakeLocalPlaceholder(Element element, Identifier node) { | 229 void tryMakeLocalPlaceholder(Element element, Identifier node) { |
| 240 // TODO(smok): Maybe we should rename privates as well, their privacy | 230 // TODO(smok): Maybe we should rename privates as well, their privacy |
| 241 // should not matter if they are local vars. | 231 // should not matter if they are local vars. |
| 242 if (node.source.isPrivate()) return; | 232 if (node.source.isPrivate()) return; |
| 243 if (element.isVariable() | 233 if (element.isVariable() |
| 244 || (element.isFunction() && !Elements.isStaticOrTopLevel(element))) { | 234 || (element.isFunction() && !Elements.isStaticOrTopLevel(element))) { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 visit(node.defaultClause.typeArguments); | 413 visit(node.defaultClause.typeArguments); |
| 424 } | 414 } |
| 425 } | 415 } |
| 426 | 416 |
| 427 visitTypedef(Typedef node) { | 417 visitTypedef(Typedef node) { |
| 428 assert(currentElement is TypedefElement); | 418 assert(currentElement is TypedefElement); |
| 429 makeElementPlaceholder(node.name, currentElement); | 419 makeElementPlaceholder(node.name, currentElement); |
| 430 node.visitChildren(this); | 420 node.visitChildren(this); |
| 431 } | 421 } |
| 432 } | 422 } |
| OLD | NEW |