| Index: sdk/lib/_internal/compiler/implementation/tree/nodes.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/tree/nodes.dart b/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
|
| index 99d3a88876f3758fd7586a1f1e29827a5afd3189..f2a2d955c92734c730da37bf9113f7e350d7388f 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
|
| @@ -466,6 +466,54 @@ class NodeList extends Node implements Iterable<Node> {
|
| }
|
| return beginToken;
|
| }
|
| +
|
| + // ------------------- Iterable methods -------------------------------------
|
| + //
|
| + // TODO(floitsch): these functions should be pulled in through a mixin
|
| + // mechanism.
|
| + Collection mappedBy(f(Node element)) {
|
| + List result = [];
|
| + for (Node element in this) result.add(f(element));
|
| + return result;
|
| + }
|
| +
|
| + Collection<Node> where(bool f(Node element)) {
|
| + List result = <Node>[];
|
| + for (Node element in this) if (f(element)) result.add(element);
|
| + return result;
|
| + }
|
| +
|
| + bool contains(Node element) {
|
| + for (Node e in this) {
|
| + if (e == element) return true;
|
| + }
|
| + return false;
|
| + }
|
| +
|
| + void forEach(void f(Node element)) {
|
| + for (Node element in this) f(element);
|
| + }
|
| +
|
| + dynamic reduce(var initialValue,
|
| + dynamic combine(var previousValue, Node element)) {
|
| + var value = initialValue;
|
| + for (Node element in this) value = combine(value, element);
|
| + return value;
|
| + }
|
| +
|
| + bool every(bool f(Node element)) {
|
| + for (Node element in this) {
|
| + if (!f(element)) return false;
|
| + }
|
| + return true;
|
| + }
|
| +
|
| + bool some(bool f(Node element)) {
|
| + for (Node element in this) {
|
| + if (f(element)) return true;
|
| + }
|
| + return false;
|
| + }
|
| }
|
|
|
| class Block extends Statement {
|
|
|