| 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } | 352 } |
| 353 final type = compiler.resolveTypeAnnotation(currentElement, node); | 353 final type = compiler.resolveTypeAnnotation(currentElement, node); |
| 354 if (type is InterfaceType || type is TypedefType) { | 354 if (type is InterfaceType || type is TypedefType) { |
| 355 var target = node.typeName; | 355 var target = node.typeName; |
| 356 if (node.typeName is Send) { | 356 if (node.typeName is Send) { |
| 357 final element = treeElements[node]; | 357 final element = treeElements[node]; |
| 358 if (element !== null) { | 358 if (element !== null) { |
| 359 final send = node.typeName.asSend(); | 359 final send = node.typeName.asSend(); |
| 360 Identifier receiver = send.receiver; | 360 Identifier receiver = send.receiver; |
| 361 Identifier selector = send.selector; | 361 Identifier selector = send.selector; |
| 362 final hasPrefix = element is TypedefElement || | 362 hasPrefix() { |
| 363 element.lookupConstructor(receiver.source, selector.source) | 363 if (element is TypedefElement) return true; |
| 364 === null; | 364 ClassElement classElement = element; |
| 365 if (!hasPrefix) target = send.receiver; | 365 final constructor = classElement.lookupConstructor( |
| 366 receiver.source, selector.source); |
| 367 return constructor === null; |
| 368 } |
| 369 if (!hasPrefix()) target = send.receiver; |
| 366 } | 370 } |
| 367 } | 371 } |
| 368 // TODO(antonm): is there a better way to detect unresolved types? | 372 // TODO(antonm): is there a better way to detect unresolved types? |
| 369 if (type.element !== compiler.types.dynamicType.element) { | 373 if (type.element !== compiler.types.dynamicType.element) { |
| 370 makeTypePlaceholder(target, type); | 374 makeTypePlaceholder(target, type); |
| 371 } else { | 375 } else { |
| 372 if (!isDynamicType(node)) makeUnresolvedPlaceholder(target); | 376 if (!isDynamicType(node)) makeUnresolvedPlaceholder(target); |
| 373 } | 377 } |
| 374 } | 378 } |
| 375 node.visitChildren(this); | 379 node.visitChildren(this); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 492 |
| 489 visitBlock(Block node) { | 493 visitBlock(Block node) { |
| 490 for (Node statement in node.statements.nodes) { | 494 for (Node statement in node.statements.nodes) { |
| 491 if (statement is VariableDefinitions) { | 495 if (statement is VariableDefinitions) { |
| 492 makeVarDeclarationTypePlaceholder(statement); | 496 makeVarDeclarationTypePlaceholder(statement); |
| 493 } | 497 } |
| 494 } | 498 } |
| 495 node.visitChildren(this); | 499 node.visitChildren(this); |
| 496 } | 500 } |
| 497 } | 501 } |
| OLD | NEW |