Initialize List with Iterable

Create issue
Issue #135 wontfix
Jesper Öqvist created an issue

Add a new constructor for the List node which takes an Iterable as argument:

List.List(Iterable<ASTNode> iterable) {
  for (ASTNode node : iterable) {
    addChild(node);
  }
}

This feature was suggested by Jesper Mattsson.

Comments (7)

  1. Görel Hedin

    Updated implementation to take a Collection instead of an Iterable. See commit 8d11f42. This is needed because ASTNodes are Iterables. And we don't want a call

    new List(new A())
    

    to add the children of A to the list. We want it to add A to the list.

  2. Log in to comment