Skip to content

Commit

Permalink
refactor: removed terminal() in favor of toString()
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewKosloski committed Sep 25, 2021
1 parent 8370df7 commit 90f1876
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public IRBinaryInst(TokenType tokType, IRAddress arg1, IRAddress arg2)
*/
public String toString()
{
return String.format("%s = %s %s %s", result, arg1,
opType.terminal(), arg2);
return String.format("%s = %s %s %s", result, arg1, opType, arg2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public IRCallInst(IRNameAddress procName, IRConstAddress numParams)
*/
public String toString()
{
return String.format("%s %s, %s", opType.terminal(), arg1, arg2);
return String.format("%s %s, %s", opType, arg1, arg2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public IRCopyInst(IRTempAddress lhs, IRAddress rhs)

public String toString()
{
return String.format("%s %s %s", result, opType.terminal(), arg1);
return String.format("%s %s %s", result, opType, arg1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public IRGotoInst(IRLabelAddress label)
*/
public String toString()
{
return String.format("%s %s", opType.terminal(), result);
return String.format("%s %s", opType, result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public String toString()
{
if (arg1 != null && arg2 != null && result != null && opType != null)
return String.format("if %s %s %s goto %s", arg1,
opType.terminal(), arg2, result);
opType, arg2, result);
return String.format("if %s goto %s", arg1, result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public IRLabelInst(IRLabelAddress label)
*/
public String toString()
{
return String.format("%s %s:", opType.terminal(), arg1);
return String.format("%s %s:", opType, arg1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public IRParamInst(IRAddress addr)
*/
public String toString()
{
return String.format("%s %s", opType.terminal(), arg1);
return String.format("%s %s", opType, arg1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public IRUnaryInst(TokenType tokType, IRAddress arg)
*/
public String toString()
{
return String.format("%s = %s %s", result, opType.terminal(), arg1);
return String.format("%s = %s %s", result, opType, arg1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@ private OpType(String terminalSymbol)
this.terminalSymbol = terminalSymbol;
}

/**
* Returns the terminal symbol of this IR operator.
*
* @return An IR terminal symbol.
*/
public String terminal()
{
return terminalSymbol;
}

/**
* Gets the binary IR operator type corresponding
* to the given Torrey token type.
Expand Down

0 comments on commit 90f1876

Please sign in to comment.