/// <summary> /// Adds an instruction to the builder using the current line number /// </summary> /// <param name="instruction">instruction to add</param> /// <param name="label">label to jump to</param> private void AddInstruction(JumpCall instruction, string label) { builder.AddWithFixup(instruction, label, tokenizer.Current.LineNumber); }
/// <summary> /// Adds a jump / call instruction with a label fixup /// </summary> /// <param name="instruction">instruction to add</param> /// <param name="label">label to fixup</param> /// <param name="line">optional line number for this instruction</param> /// <remarks> /// <para>This method allows you to defer the resolving of labels until after all the /// instructions have been generated.</para> /// <para>If a jump instruction does not need fixing up, you can just use /// <see cref="Add"/> instead</para> /// </remarks> public void AddWithFixup(JumpCall instruction, string label, int? line = null) { // Add instruction and fixup fixups.Add(Tuple.Create(this.Address, label)); Add(instruction, line); }