| 29 | import java.util.Set; |
| 30 | |
| 31 | abstract class AbstractStmt implements Stmt { |
| 32 | |
| 33 | protected int index = -1; |
| 34 | |
| 35 | protected int lineNumber = -1; |
| 36 | |
| 37 | @Override |
| 38 | public int getIndex() { |
| 39 | return index; |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public void setIndex(int index) { |
| 44 | if (this.index != -1) { |
| 45 | throw new IllegalStateException("index already set"); |
| 46 | } |
| 47 | this.index = index; |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public int getLineNumber() { |
| 52 | return lineNumber; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public void setLineNumber(int lineNumber) { |
| 57 | this.lineNumber = lineNumber; |
| 58 | } |
| 59 | |
| 60 | // Following three methods provide default behaviors for the three |
| 61 | // implemented APIs (declared in Stmt). The subclasses of this class |
| 62 | // should override these APIs iff their behaviors are different from |
| 63 | // the default ones. |
| 64 | |
| 65 | @Override |
| 66 | public Optional<LValue> getDef() { |
| 67 | return Optional.empty(); |
| 68 | } |
| 69 | |
| 70 | @Override |
| 71 | public Set<RValue> getUses() { |
| 72 | return Set.of(); |
| 73 | } |
| 74 | |
| 75 | @Override |
| 76 | public boolean canFallThrough() { |
| 77 | return true; |
| 78 | } |
| 79 | } |
nothing calls this directly
no outgoing calls
no test coverage detected