Skip to content

Commit

Permalink
fix order in while
Browse files Browse the repository at this point in the history
  • Loading branch information
GustavoOS committed May 7, 2019
1 parent 70e52ae commit 6150ff1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Binary file modified .vscode/ipch/1061bd209ddfc186/intermediate.ipch
Binary file not shown.
9 changes: 5 additions & 4 deletions intermediate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,15 @@ void IntermediateCodeGenerator::generateWhile(TreeNode *node)
{
std::string _whileStartLabel = counter.getNextLabel(), _whileExitLabel = counter.getNextLabel();

// Condition
generate(node->child[0]);

// Evaluation
// Evaluation label
insertQuadruple(
newQuadruple()
->withLabel(_whileStartLabel));

// Condition check
generate(node->child[0]);

// Branch
insertQuadruple(
newQuadruple()
->withOperation("if_false")
Expand Down

0 comments on commit 6150ff1

Please sign in to comment.