package org.yinwang.pysonar.ast;
import org.jetbrains.annotations.NotNull;
import org.yinwang.pysonar.State;
import org.yinwang.pysonar.types.TupleType;
import org.yinwang.pysonar.types.Type;
import java.util.List;
public class Tuple extends Sequence {
public Tuple(List<Node> elts, String file, int start, int end) {
super(elts, file, start, end);
}
@NotNull
@Override
public Type transform(State s) {
TupleType t = new TupleType();
for (Node e : elts) {
t.add(transformExpr(e, s));
}
return t;
}
@NotNull
@Override
public String toString() {
return "<Tuple:" + start + ":" + elts + ">";
}
@NotNull
@Override
public String toDisplay() {
StringBuilder sb = new StringBuilder();
sb.append("(");
int idx = 0;
for (Node n : elts) {
if (idx != 0) {
sb.append(", ");
}
idx++;
sb.append(n.toDisplay());
}
sb.append(")");
return sb.toString();
}
}