Skip to content

Commit

Permalink
WhileLoopInstruction
Browse files Browse the repository at this point in the history
- Added ability to set a flag for whether or not something is a do while loop
  • Loading branch information
deavmi committed May 18, 2024
1 parent ebefcd5 commit 75a953c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/tlang/compiler/codegen/instruction.d
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,12 @@ public final class IfStatementInstruction : Instruction
public final class WhileLoopInstruction : Instruction
{
private BranchInstruction branchInstruction;
private bool isDoWhile;

this(BranchInstruction branchInstruction)
this(BranchInstruction branchInstruction, bool isDoWhile = false)
{
this.branchInstruction = branchInstruction;
this.isDoWhile = isDoWhile;

addInfo = "Branch: "~to!(string)(branchInstruction);
}
Expand All @@ -417,6 +419,12 @@ public final class WhileLoopInstruction : Instruction
{
return branchInstruction;
}

public bool isDoWhileLoop()
{
return this.isDoWhile;
}

}

public final class ForLoopInstruction : Instruction
Expand Down

0 comments on commit 75a953c

Please sign in to comment.