Representation of cast expression, e.g., (T) o.
| 30 | * Representation of cast expression, e.g., (T) o. |
| 31 | */ |
| 32 | public class CastExp implements RValue { |
| 33 | |
| 34 | /** |
| 35 | * The value to be casted. |
| 36 | */ |
| 37 | private final Var value; |
| 38 | |
| 39 | private final Type castType; |
| 40 | |
| 41 | public CastExp(Var value, Type castType) { |
| 42 | this.value = value; |
| 43 | this.castType = castType; |
| 44 | } |
| 45 | |
| 46 | public Var getValue() { |
| 47 | return value; |
| 48 | } |
| 49 | |
| 50 | public Type getCastType() { |
| 51 | return castType; |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public Type getType() { |
| 56 | return castType; |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public Set<RValue> getUses() { |
| 61 | return Set.of(value); |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public <T> T accept(ExpVisitor<T> visitor) { |
| 66 | return visitor.visit(this); |
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public String toString() { |
| 71 | return String.format("(%s) %s", castType, value); |
| 72 | } |
| 73 | } |
nothing calls this directly
no outgoing calls
no test coverage detected