private void PerformIdentificationOnIfElseCommand(IfElseCommandNode ifElseCommandNode) { PerformIdentification(ifElseCommandNode.Expression); PerformIdentification(ifElseCommandNode.ThenCommand); PerformIdentification(ifElseCommandNode.ElseCommand); // PerformIdentification(ifElseCommandNode.EndIfCommand); }
/// <summary> /// Generates code for an ifelse command node /// </summary> /// <param name="ifElseCommand">The node to generate code for</param> private void GenerateCodeForIfElseCommand(IfElseCommandNode ifElseCommand) { Debugger.Write("Generating code for IfElse Command"); GenerateCodeFor(ifElseCommand.Expression); Address ifJumpAddress = code.NextAddress; code.AddInstruction(OpCode.JUMPIF, Register.CB, FalseValue, 0); GenerateCodeFor(ifElseCommand.ThenCommand); Address thenJumpAddress = code.NextAddress; code.AddInstruction(OpCode.JUMP, Register.CB, 0, 0); code.PatchInstructionToJumpHere(ifJumpAddress); GenerateCodeFor(ifElseCommand.ElseCommand); code.PatchInstructionToJumpHere(thenJumpAddress); }