| 692 | return stmt; |
| 693 | } |
| 694 | virtual RefPtr<StatementSyntaxNode> VisitForStatement(ForStatementSyntaxNode* stmt) override |
| 695 | { |
| 696 | RefPtr<ForInstruction> instr = new ForInstruction(); |
| 697 | variables.PushScope(); |
| 698 | if (auto initStmt = stmt->InitialStatement.Ptr()) |
| 699 | { |
| 700 | // TODO(tfoley): any of this push-pop malarky needed here? |
| 701 | initStmt->Accept(this); |
| 702 | } |
| 703 | if (stmt->PredicateExpression) |
| 704 | { |
| 705 | codeWriter.PushNode(); |
| 706 | stmt->PredicateExpression->Accept(this); |
| 707 | PopStack(); |
| 708 | instr->ConditionCode = codeWriter.PopNode(); |
| 709 | } |
| 710 | |
| 711 | if (stmt->SideEffectExpression) |
| 712 | { |
| 713 | codeWriter.PushNode(); |
| 714 | stmt->SideEffectExpression->Accept(this); |
| 715 | PopStack(); |
| 716 | instr->SideEffectCode = codeWriter.PopNode(); |
| 717 | } |
| 718 | |
| 719 | codeWriter.PushNode(); |
| 720 | stmt->Statement->Accept(this); |
| 721 | instr->BodyCode = codeWriter.PopNode(); |
| 722 | codeWriter.Insert(instr.Release()); |
| 723 | variables.PopScope(); |
| 724 | return stmt; |
| 725 | } |
| 726 | virtual RefPtr<StatementSyntaxNode> VisitIfStatement(IfStatementSyntaxNode* stmt) override |
| 727 | { |
| 728 | RefPtr<IfInstruction> instr = new IfInstruction(); |