| 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 tree; | 5 part of tree; |
| 6 | 6 |
| 7 abstract class Visitor<R> { | 7 abstract class Visitor<R> { |
| 8 const Visitor(); | 8 const Visitor(); |
| 9 | 9 |
| 10 R visitNode(Node node); | 10 R visitNode(Node node); |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 | 565 |
| 566 bool get isConst { | 566 bool get isConst { |
| 567 return newToken == null || identical(newToken.stringValue, 'const'); | 567 return newToken == null || identical(newToken.stringValue, 'const'); |
| 568 } | 568 } |
| 569 | 569 |
| 570 Token getBeginToken() => newToken != null ? newToken : send.getBeginToken(); | 570 Token getBeginToken() => newToken != null ? newToken : send.getBeginToken(); |
| 571 | 571 |
| 572 Token getEndToken() => send.getEndToken(); | 572 Token getEndToken() => send.getEndToken(); |
| 573 } | 573 } |
| 574 | 574 |
| 575 class NodeList extends Node { | 575 class NodeList extends Node with IterableMixin<Node> { |
| 576 final Link<Node> nodes; | 576 final Link<Node> nodes; |
| 577 final Token beginToken; | 577 final Token beginToken; |
| 578 final Token endToken; | 578 final Token endToken; |
| 579 final String delimiter; | 579 final String delimiter; |
| 580 bool get isEmpty => nodes.isEmpty; | 580 bool get isEmpty => nodes.isEmpty; |
| 581 | 581 |
| 582 NodeList([this.beginToken, this.nodes, this.endToken, this.delimiter]); | 582 NodeList([this.beginToken, this.nodes, this.endToken, this.delimiter]); |
| 583 | 583 |
| 584 Iterator<Node> get iterator => nodes.iterator; | 584 Iterator<Node> get iterator => nodes.iterator; |
| 585 | 585 |
| 586 NodeList.singleton(Node node) : this(null, const Link<Node>().prepend(node)); | 586 NodeList.singleton(Node node) : this(null, const Link<Node>().prepend(node)); |
| 587 NodeList.empty() : this(null, const Link<Node>()); | 587 NodeList.empty() : this(null, const Link<Node>()); |
| 588 | 588 |
| 589 NodeList asNodeList() => this; | 589 NodeList asNodeList() => this; |
| 590 | 590 |
| 591 // Override [IterableMixin.toString] with same code as [Node.toString]. |
| 592 toString() => unparse(this); |
| 593 |
| 594 get length { |
| 595 throw new UnsupportedError('use slowLength() instead of get:length'); |
| 596 } |
| 597 |
| 591 int slowLength() { | 598 int slowLength() { |
| 592 int result = 0; | 599 int result = 0; |
| 593 for (Link<Node> cursor = nodes; !cursor.isEmpty; cursor = cursor.tail) { | 600 for (Link<Node> cursor = nodes; !cursor.isEmpty; cursor = cursor.tail) { |
| 594 result++; | 601 result++; |
| 595 } | 602 } |
| 596 return result; | 603 return result; |
| 597 } | 604 } |
| 598 | 605 |
| 599 accept(Visitor visitor) => visitor.visitNodeList(this); | 606 accept(Visitor visitor) => visitor.visitNodeList(this); |
| 600 | 607 |
| (...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 | 2488 |
| 2482 // VariableDefinitions. | 2489 // VariableDefinitions. |
| 2483 get metadata => null; | 2490 get metadata => null; |
| 2484 get type => null; | 2491 get type => null; |
| 2485 | 2492 |
| 2486 // Typedef. | 2493 // Typedef. |
| 2487 get typeParameters => null; | 2494 get typeParameters => null; |
| 2488 get formals => null; | 2495 get formals => null; |
| 2489 get typedefKeyword => null; | 2496 get typedefKeyword => null; |
| 2490 } | 2497 } |
| OLD | NEW |