blob: b1889a74e91797e5b08a0d37c9febc96db01939c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package org.zwobble.couscous.backends.python.ast;
import java.util.Iterator;
import java.util.List;
import com.google.common.collect.ImmutableList;
import static java.util.Arrays.asList;
import static org.zwobble.couscous.util.ExtraLists.list;
public class PythonBlock implements Iterable<PythonStatementNode> {
private final List<PythonStatementNode> statements;
public PythonBlock(List<? extends PythonStatementNode> statements) {
if (statements.isEmpty()) {
this.statements = list(PythonPassNode.PASS);
} else {
this.statements = ImmutableList.copyOf(statements);
}
}
@Override
public Iterator<PythonStatementNode> iterator() {
return statements.iterator();
}
}
|