MCPcopy Create free account
hub / github.com/LFYSec/MScan / AbstractBinaryExp

Class AbstractBinaryExp

src/main/java/pascal/taie/ir/exp/AbstractBinaryExp.java:33–72  ·  view source on GitHub ↗

Provides common functionalities for BinaryExp implementations.

Source from the content-addressed store, hash-verified

31 * Provides common functionalities for {@link BinaryExp} implementations.
32 */
33abstract class AbstractBinaryExp implements BinaryExp {
34
35 protected final Var operand1;
36
37 protected final Var operand2;
38
39 protected AbstractBinaryExp(Var operand1, Var operand2) {
40 this.operand1 = operand1;
41 this.operand2 = operand2;
42 validate();
43 }
44
45 /**
46 * Validates type correctness of the two values of this expression.
47 */
48 protected void validate() {
49 }
50
51 @Override
52 public Var getOperand1() {
53 return operand1;
54 }
55
56 @Override
57 public Var getOperand2() {
58 return operand2;
59 }
60
61 @Override
62 public Set<RValue> getUses() {
63 Set<RValue> uses = new ArraySet<>(2);
64 Collections.addAll(uses, operand1, operand2);
65 return uses;
66 }
67
68 @Override
69 public String toString() {
70 return operand1 + " " + getOperator() + " " + operand2;
71 }
72}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected