示例#1
0
 public void SetJumpReplacing(int Label, InstructionContainer InsContainer)
 {
     if (ReplaceJumps == null)
     {
         ReplaceJumps = new Dictionary <int, InstructionContainer>();
     }
     ReplaceJumps.Add(Label, InsContainer);
 }
示例#2
0
        public InstructionContainer ExecuteOnTempInsContainer(Action Action)
        {
            var InsContainer    = new InstructionContainer();
            var OldInsContainer = this.InsContainer;

            this.InsContainer = InsContainer;

            Action();
            this.InsContainer = OldInsContainer;
            return(InsContainer);
        }
示例#3
0
        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);
                }
            }
        }
示例#4
0
        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);
                }
            }
        }
示例#5
0
 public CodeGenerator(CompilerState State)
 {
     this.State        = State;
     this.InsContainer = new InstructionContainer();
 }