MCPcopy Create free account
hub / github.com/Whiley/WhileyCompiler / TupleInitialiser

Class TupleInitialiser

src/main/java/wyil/lang/WyilFile.java:4823–4859  ·  view source on GitHub ↗

Represents a tuple initialiser expression of the form " (e1,..,en) ". This returns a new tuple where each element holds the value resulting from its corresponding expression. @author David J. Pearce

Source from the content-addressed store, hash-verified

4821 *
4822 */
4823 public static class TupleInitialiser extends AbstractExpr implements Expr, LVal, NaryOperator {
4824 public TupleInitialiser(Type type, Tuple<Expr> operands) {
4825 super(EXPR_tupleinitialiser, type, operands);
4826 }
4827
4828 @Override
4829 public Syntactic.Item clone(Syntactic.Item[] operands) {
4830 return new TupleInitialiser((Type) operands[0], (Tuple<Expr>) operands[1]);
4831 }
4832
4833 @Override
4834 public Tuple<Expr> getOperands() {
4835 return (Tuple<Expr>) operands[1];
4836 }
4837
4838 @Override
4839 public String toString() {
4840 String r = "";
4841 //
4842 for (int i = 0; i != size(); ++i) {
4843 if (i != 0) {
4844 r += ",";
4845 }
4846 r += get(i).toString();
4847 }
4848 //
4849 return "(" + r + ")";
4850 }
4851
4852 public static final Descriptor DESCRIPTOR_0 = new Descriptor(Operands.TWO, Data.ZERO, "EXPR_tupleinitialiser") {
4853 @SuppressWarnings("unchecked")
4854 @Override
4855 public Syntactic.Item construct(int opcode, Syntactic.Item[] operands, byte[] data) {
4856 return new TupleInitialiser((Type) operands[0], (Tuple<Expr>) operands[1]);
4857 }
4858 };
4859 }
4860
4861 /**
4862 * Represents a <i>record initialiser</i> expression of the form

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected