Representation of negation expression, e.g., -o;
| 29 | * Representation of negation expression, e.g., -o; |
| 30 | */ |
| 31 | public class NegExp implements UnaryExp { |
| 32 | |
| 33 | private final Var value; |
| 34 | |
| 35 | public NegExp(Var value) { |
| 36 | this.value = value; |
| 37 | assert value.getType() instanceof PrimitiveType; |
| 38 | } |
| 39 | |
| 40 | public Var getValue() { |
| 41 | return value; |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public Var getOperand() { |
| 46 | return value; |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public PrimitiveType getType() { |
| 51 | PrimitiveType type = (PrimitiveType) value.getType(); |
| 52 | return type.asInt() ? PrimitiveType.INT : type; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public <T> T accept(ExpVisitor<T> visitor) { |
| 57 | return visitor.visit(this); |
| 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public String toString() { |
| 62 | return "-" + value; |
| 63 | } |
| 64 | } |
nothing calls this directly
no outgoing calls
no test coverage detected