MCPcopy Create free account
hub / github.com/csyonghe/Spire / VisitIfStatement

Method VisitIfStatement

Source/SpireCore/CodeGenerator.cpp:726–744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724 return stmt;
725 }
726 virtual RefPtr<StatementSyntaxNode> VisitIfStatement(IfStatementSyntaxNode* stmt) override
727 {
728 RefPtr<IfInstruction> instr = new IfInstruction();
729 variables.PushScope();
730 stmt->Predicate->Accept(this);
731 instr->Operand = PopStack();
732 codeWriter.PushNode();
733 stmt->PositiveStatement->Accept(this);
734 instr->TrueCode = codeWriter.PopNode();
735 if (stmt->NegativeStatement)
736 {
737 codeWriter.PushNode();
738 stmt->NegativeStatement->Accept(this);
739 instr->FalseCode = codeWriter.PopNode();
740 }
741 codeWriter.Insert(instr.Release());
742 variables.PopScope();
743 return stmt;
744 }
745 virtual RefPtr<StatementSyntaxNode> VisitReturnStatement(ReturnStatementSyntaxNode* stmt) override
746 {
747 returnRegister = nullptr;

Callers

nothing calls this directly

Calls 7

PushNodeMethod · 0.80
PopNodeMethod · 0.80
PushScopeMethod · 0.45
AcceptMethod · 0.45
InsertMethod · 0.45
ReleaseMethod · 0.45
PopScopeMethod · 0.45

Tested by

no test coverage detected