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

Class Cast

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

Represents a cast expression of the form " (T) e " where T is the cast type and e the casted expression . @author David J. Pearce

Source from the content-addressed store, hash-verified

2671 *
2672 */
2673 public static class Cast extends AbstractExpr implements Expr, UnaryOperator {
2674 public Cast(Type type, Expr rhs) {
2675 super(EXPR_cast, type, rhs);
2676 }
2677
2678 @Override
2679 public Expr getOperand() {
2680 return (Expr) super.get(1);
2681 }
2682
2683 @Override
2684 public Cast clone(Syntactic.Item[] operands) {
2685 return new Cast((Type) operands[0], (Expr) operands[1]);
2686 }
2687
2688 @Override
2689 public String toString() {
2690 return "(" + getType() + ") " + getOperand();
2691 }
2692
2693 public static final Descriptor DESCRIPTOR_0 = new Descriptor(Operands.TWO, Data.ZERO, "EXPR_cast") {
2694 @Override
2695 public Syntactic.Item construct(int opcode, Syntactic.Item[] operands, byte[] data) {
2696 return new Cast((Type) operands[0], (Expr) operands[1]);
2697 }
2698 };
2699 }
2700
2701 /**
2702 * Represents the use of a constant within some expression. For example, in

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected