public void SetJumpReplacing(int Label, InstructionContainer InsContainer) { if (ReplaceJumps == null) { ReplaceJumps = new Dictionary <int, InstructionContainer>(); } ReplaceJumps.Add(Label, InsContainer); }
public InstructionContainer ExecuteOnTempInsContainer(Action Action) { var InsContainer = new InstructionContainer(); var OldInsContainer = this.InsContainer; this.InsContainer = InsContainer; Action(); this.InsContainer = OldInsContainer; return(InsContainer); }
public void Add(InstructionContainer InsContainer) { var Count = Instructions.Count; Instructions.AddRange(InsContainer.Instructions); if (InsContainer.LabelPositions != null) { foreach (var e in InsContainer.LabelPositions) { LabelPositions.Add(e.Key, e.Value + Count); } } }
public void Insert(int Index, InstructionContainer InsContainer) { var P = InsContainer.Instructions.Count - 1; if (LabelPositions != null) { foreach (var e in LabelPositions.Keys.ToArray()) { if (LabelPositions[e] >= Index) { LabelPositions[e] += P; } } } Instructions.InsertRange(Index, InsContainer.Instructions); if (InsContainer.LabelPositions != null) { foreach (var e in InsContainer.LabelPositions) { LabelPositions.Add(e.Key, e.Value + Index); } } }
public CodeGenerator(CompilerState State) { this.State = State; this.InsContainer = new InstructionContainer(); }