| Index: dart/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
|
| diff --git a/dart/sdk/lib/_internal/compiler/implementation/tree/nodes.dart b/dart/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
|
| index 8099a56c4306542c52c68f827fc6e3056918bf13..7c7231b5182cbe68e7f3e1f4d70fe3bfacee82fe 100644
|
| --- a/dart/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
|
| +++ b/dart/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
|
| @@ -288,7 +288,9 @@ class Send extends Expression {
|
| if (argumentsNode != null) argumentsNode.accept(visitor);
|
| }
|
|
|
| - int argumentCount() => (argumentsNode == null) ? -1 : argumentsNode.length;
|
| + int argumentCount() {
|
| + return (argumentsNode == null) ? -1 : argumentsNode.slowLength();
|
| + }
|
|
|
| bool get isSuperCall {
|
| return receiver != null &&
|
| @@ -426,7 +428,7 @@ class NodeList extends Node implements Iterable<Node> {
|
|
|
| NodeList asNodeList() => this;
|
|
|
| - int get length {
|
| + int slowLength() {
|
| int result = 0;
|
| for (Link<Node> cursor = nodes; !cursor.isEmpty; cursor = cursor.tail) {
|
| result++;
|
| @@ -470,95 +472,122 @@ class NodeList extends Node implements Iterable<Node> {
|
| return beginToken;
|
| }
|
|
|
| - // ------------------- Iterable methods -------------------------------------
|
| - //
|
| - // TODO(floitsch): these functions should be pulled in through a mixin
|
| - // mechanism.
|
| - Iterable mappedBy(f(Node element)) => new MappedIterable(this, f);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + get length {
|
| + throw new UnsupportedError('get:length');
|
| + }
|
|
|
| - Iterable<Node> where(bool f(Node element))
|
| - => new WhereIterable<Node>(this, f);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + mappedBy(f) {
|
| + throw new UnsupportedError('mappedBy');
|
| + }
|
|
|
| - bool contains(Node element) {
|
| - for (Node e in this) {
|
| - if (e == element) return true;
|
| - }
|
| - return false;
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + where(f) {
|
| + throw new UnsupportedError('where');
|
| }
|
|
|
| - void forEach(void f(Node element)) {
|
| - for (Node element in this) f(element);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + contains(element) {
|
| + throw new UnsupportedError('contains');
|
| }
|
|
|
| - String join([String separator]) => Collections.join(this, separator);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + forEach(f) {
|
| + throw new UnsupportedError('forEach');
|
| + }
|
|
|
| - dynamic reduce(var initialValue,
|
| - dynamic combine(var previousValue, Node element)) {
|
| - var value = initialValue;
|
| - for (Node element in this) value = combine(value, element);
|
| - return value;
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + join([separator]) {
|
| + throw new UnsupportedError('join');
|
| }
|
|
|
| - bool every(bool f(Node element)) {
|
| - for (Node element in this) {
|
| - if (!f(element)) return false;
|
| - }
|
| - return true;
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + reduce(initialValue, combine) {
|
| + throw new UnsupportedError('reduce');
|
| }
|
|
|
| - bool any(bool f(Node element)) {
|
| - for (Node element in this) {
|
| - if (f(element)) return true;
|
| - }
|
| - return false;
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + every(f) {
|
| + throw new UnsupportedError('every');
|
| }
|
|
|
| - List<Node> toList() => new List<Node>.from(this);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + any(f) {
|
| + throw new UnsupportedError('any');
|
| + }
|
|
|
| - Set<Node> toSet() => new Set<Node>.from(this);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + toList() {
|
| + throw new UnsupportedError('toList');
|
| + }
|
|
|
| - Iterable<Node> take(int n) => new TakeIterable<Node>(this, n);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + toSet() {
|
| + throw new UnsupportedError('toSet');
|
| + }
|
|
|
| - Iterable<Node> takeWhile(bool test(Node value)) {
|
| - return new TakeWhileIterable<Node>(this, test);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + take(n) {
|
| + throw new UnsupportedError('take');
|
| }
|
|
|
| - Iterable<Node> skip(int n) => new SkipIterable<Node>(this, n);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + takeWhile(test) {
|
| + throw new UnsupportedError('takeWhile');
|
| + }
|
|
|
| - Iterable<Node> skipWhile(bool test(Node value)) {
|
| - return new SkipWhileIterable<Node>(this, test);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + skip(n) {
|
| + throw new UnsupportedError('skip');
|
| }
|
|
|
| - Node get first {
|
| - return Collections.first(this);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + skipWhile(test) {
|
| + throw new UnsupportedError('skipWhile');
|
| }
|
|
|
| - Node get last {
|
| - return Collections.last(this);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + get first {
|
| + throw new UnsupportedError('get:first');
|
| }
|
|
|
| - Node get single {
|
| - return Collections.single(this);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + get last {
|
| + throw new UnsupportedError('get:first');
|
| }
|
|
|
| - Node min([int compare(Node a, Node b)]) => Collections.min(this, compare);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + get single {
|
| + throw new UnsupportedError('get:single');
|
| + }
|
|
|
| - Node max([int compare(Node a, Node b)]) => Collections.max(this, compare);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + min([compare]) {
|
| + throw new UnsupportedError('min');
|
| + }
|
| +
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + max([compare]) {
|
| + throw new UnsupportedError('max');
|
| + }
|
|
|
| - Node firstMatching(bool test(Node value), {Node orElse()}) {
|
| - return Collections.firstMatching(this, test, orElse);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + firstMatching(test, {orElse}) {
|
| + throw new UnsupportedError('firstMatching');
|
| }
|
|
|
| - Node lastMatching(bool test(Node value), {Node orElse()}) {
|
| - return Collections.lastMatching(this, test, orElse);
|
| + // TODO(ahe): The method does not belong in the Iterable interface.
|
| + lastMatching(test, {orElse}) {
|
| + throw new UnsupportedError('lastMatching');
|
| }
|
|
|
| - Node singleMatching(bool test(Node value)) {
|
| - return Collections.singleMatching(this, test);
|
| + singleMatching(test) {
|
| + throw new UnsupportedError('singleMatching');
|
| }
|
|
|
| - Node elementAt(int index) {
|
| - return Collections.elementAt(this, index);
|
| + elementAt(index) {
|
| + throw new UnsupportedError('elementAt');
|
| }
|
| }
|
|
|
|
|