Representation of shift expression, e.g., a >> b.
| 28 | * Representation of shift expression, e.g., a >> b. |
| 29 | */ |
| 30 | public class ShiftExp extends AbstractBinaryExp { |
| 31 | |
| 32 | public enum Op implements BinaryExp.Op { |
| 33 | |
| 34 | SHL("<<"), |
| 35 | SHR(">>"), |
| 36 | USHR(">>>"), |
| 37 | ; |
| 38 | |
| 39 | private final String symbol; |
| 40 | |
| 41 | Op(String symbol) { |
| 42 | this.symbol = symbol; |
| 43 | } |
| 44 | |
| 45 | @Override |
| 46 | public String toString() { |
| 47 | return symbol; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | private final Op op; |
| 52 | |
| 53 | public ShiftExp(Op op, Var value1, Var value2) { |
| 54 | super(value1, value2); |
| 55 | this.op = op; |
| 56 | } |
| 57 | |
| 58 | @Override |
| 59 | protected void validate() { |
| 60 | assert Exps.holdsInteger(operand1) && Exps.holdsInt(operand2); |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public Op getOperator() { |
| 65 | return op; |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public PrimitiveType getType() { |
| 70 | return (PrimitiveType) operand1.getType(); |
| 71 | } |
| 72 | |
| 73 | @Override |
| 74 | public <T> T accept(ExpVisitor<T> visitor) { |
| 75 | return visitor.visit(this); |
| 76 | } |
| 77 | } |
nothing calls this directly
no outgoing calls
no test coverage detected