| 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 if (node.name !== null) { | 432 if (node.name !== null) { |
| 433 assert(node.name is Identifier); | 433 assert(node.name is Identifier); |
| 434 tryMakeLocalPlaceholder(element, node.name); | 434 tryMakeLocalPlaceholder(element, node.name); |
| 435 } | 435 } |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 node.visitChildren(this); | 438 node.visitChildren(this); |
| 439 } | 439 } |
| 440 | 440 |
| 441 visitClassNode(ClassNode node) { | 441 visitClassNode(ClassNode node) { |
| 442 assert(currentElement is ClassElement); | 442 ClassElement classElement = currentElement; |
| 443 makeElementPlaceholder(node.name, currentElement); | 443 makeElementPlaceholder(node.name, classElement); |
| 444 node.visitChildren(this); | 444 node.visitChildren(this); |
| 445 if (node.typeParameters !== null) { | 445 if (node.typeParameters !== null) { |
| 446 // Another poor man resolution. | 446 // Another poor man resolution. |
| 447 final typeVariableTypes = | 447 final typeVariableTypes = |
| 448 new List<Type>.from(currentElement.typeVariables); | 448 new List<Type>.from(classElement.typeVariables); |
| 449 int i = 0; | 449 int i = 0; |
| 450 for (TypeVariable typeVariable in node.typeParameters) { | 450 for (TypeVariable typeVariable in node.typeParameters) { |
| 451 makeTypePlaceholder(typeVariable.name, typeVariableTypes[i]); | 451 makeTypePlaceholder(typeVariable.name, typeVariableTypes[i]); |
| 452 i++; | 452 i++; |
| 453 } | 453 } |
| 454 } | 454 } |
| 455 if (node.defaultClause !== null) { | 455 if (node.defaultClause !== null) { |
| 456 // Can't just visit class node's default clause because of the bug in the | 456 // Can't just visit class node's default clause because of the bug in the |
| 457 // resolver, it just crashes when it meets type variable. | 457 // resolver, it just crashes when it meets type variable. |
| 458 Type defaultType = (currentElement as ClassElement).defaultClass; | 458 Type defaultType = classElement.defaultClass; |
| 459 assert(defaultType !== null); | 459 assert(defaultType !== null); |
| 460 makeTypePlaceholder(node.defaultClause.typeName, defaultType); | 460 makeTypePlaceholder(node.defaultClause.typeName, defaultType); |
| 461 visit(node.defaultClause.typeArguments); | 461 visit(node.defaultClause.typeArguments); |
| 462 } | 462 } |
| 463 } | 463 } |
| 464 | 464 |
| 465 visitTypedef(Typedef node) { | 465 visitTypedef(Typedef node) { |
| 466 assert(currentElement is TypedefElement); | 466 assert(currentElement is TypedefElement); |
| 467 makeElementPlaceholder(node.name, currentElement); | 467 makeElementPlaceholder(node.name, currentElement); |
| 468 node.visitChildren(this); | 468 node.visitChildren(this); |
| 469 } | 469 } |
| 470 } | 470 } |
| OLD | NEW |