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

Class Old

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

Represents an old expression of the form " old(e) ". This can only appear in specification elements (i.e. it is a ghost expression), and signals that the given expression should be evaluated in the heap as it was on entry to the function or method. @author David J. Pearce

Source from the content-addressed store, hash-verified

2950 *
2951 */
2952 public static class Old extends AbstractExpr implements Expr, UnaryOperator {
2953 public Old(Type type, Expr expr) {
2954 super(EXPR_old, type, expr);
2955 }
2956
2957 @Override
2958 public Type getType() {
2959 return (Type) operands[0];
2960 }
2961
2962 @Override
2963 public void setType(Type type) {
2964 operands[0] = type;
2965 }
2966
2967 @Override
2968 public Expr getOperand() {
2969 return (Expr) get(1);
2970 }
2971
2972 @Override
2973 public Old clone(Syntactic.Item[] operands) {
2974 return new Old((Type) operands[0], (Expr) operands[1]);
2975 }
2976
2977 @Override
2978 public String toString() {
2979 return "old(" + getOperand() + ")";
2980 }
2981
2982 public static final Descriptor DESCRIPTOR_0 = new Descriptor(Operands.TWO, Data.ZERO, "EXPR_old") {
2983 @Override
2984 public Syntactic.Item construct(int opcode, Syntactic.Item[] operands, byte[] data) {
2985 return new Old((Type) operands[0], (Expr) operands[1]);
2986 }
2987 };
2988 }
2989
2990
2991 /**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected