Skip to content

Commit

Permalink
fix: subi instead of pop in returnstmtNode
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielegenovese committed Jul 14, 2024
1 parent ce49d20 commit ed58dc2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ast/nodes/ReturnStmtNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public Type typeCheck() {
@Override
public String codeGeneration() {
String expS = exprList.codeGeneration();
for (int i = 0; i < localvar; i++) {
expS += "pop\n";
if(localvar > 0) {
expS += "subi SP " + localvar + "\n";
}
return expS +
"popr RA\n" +
Expand Down

0 comments on commit ed58dc2

Please sign in to comment.