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

Class Is

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

Represents a type test expression of the form " e is T " where e is the test expression and T is the test type . @author David J. Pearce

Source from the content-addressed store, hash-verified

2778 *
2779 */
2780 public static class Is extends AbstractItem implements Expr, UnaryOperator {
2781 public Is(Expr lhs, Type rhs) {
2782 super(EXPR_is, lhs, rhs);
2783 }
2784
2785 @Override
2786 public Type getType() {
2787 return Type.Bool;
2788 }
2789
2790 @Override
2791 public void setType(Type type) {
2792 if(!type.equals(Type.Bool)) {
2793 throw new IllegalArgumentException();
2794 }
2795 }
2796
2797 @Override
2798 public Expr getOperand() {
2799 return (Expr) get(0);
2800 }
2801
2802 public Type getTestType() {
2803 return (Type) get(1);
2804 }
2805
2806 @Override
2807 public Is clone(Syntactic.Item[] operands) {
2808 return new Is((Expr) operands[0], (Type) operands[1]);
2809 }
2810
2811 @Override
2812 public String toString() {
2813 return getOperand() + " is " + getTestType();
2814 }
2815
2816 public static final Descriptor DESCRIPTOR_0 = new Descriptor(Operands.TWO, Data.ZERO, "EXPR_is") {
2817 @Override
2818 public Syntactic.Item construct(int opcode, Syntactic.Item[] operands, byte[] data) {
2819 return new Is((Expr) operands[0], (Type) operands[1]);
2820 }
2821 };
2822 }
2823
2824 /**
2825 * Represents an invocation of the form "<code>x.y.f(e1,..en)</code>". Here,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected