/// <summary> /// Creates new instruction block for given instruction. /// </summary> /// <param name="instruction">The instruction.</param> private void setNewBlock(InstructionBase instruction) { var newExecutedBlock = new ExecutedBlock(instruction.Info, this); CurrentBlock.NextBlock = newExecutedBlock; CurrentBlock = newExecutedBlock; }
/// <summary> /// Get next available instrution. /// </summary> /// <returns>Instruction that is on turn to be processed, if end of execution returns null</returns> internal InstructionBase NextInstruction() { InstructionBase instrution = null; while (!IsExecutionEnd && (instrution = CurrentCall.NextInstrution()) == null) { popContext(); } return(instrution); }
/// <summary> /// Prepare instruction to be processed /// </summary> /// <param name="instruction">Prepared instruction</param> internal void Prepare(InstructionBase instruction) { var call = instruction as Call; if (call == null) { //only calls will have edits provider if (!(instruction is DirectInvoke)) { //Direct invoke shares edits provider (because we want to get edits on call place) Edits = null; } } else { Edits = new EditsProvider(call.TransformProvider, CurrentCall.CurrentBlock); } }
/// <summary> /// Add given instruction into generated program /// <remarks> /// All instructions are assigned into current instruction block /// </remarks>. /// </summary> /// <param name="instruction">Added instruction.</param> private void emitInstruction(InstructionBase instruction) { instruction.Info = _currentBlockInfo; _instructions.Add(instruction); }