module Compiler.ResolveLabels.Step2Real (step2Real) where
import Data.Text (Text)
import Compiler.Instruction (Instruction, instructionSize)
step2Real :: [Instruction] -> Int -> Instruction ->
Either Text ([Instruction], Int)
step2Real :: [Instruction]
-> Int -> Instruction -> Either Text ([Instruction], Int)
step2Real [Instruction]
out Int
idx Instruction
instr = ([Instruction], Int) -> Either Text ([Instruction], Int)
forall a b. b -> Either a b
Right ([Instruction]
out [Instruction] -> [Instruction] -> [Instruction]
forall a. [a] -> [a] -> [a]
++ [Instruction
instr], Int
idx Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Instruction -> Int
instructionSize Instruction
instr)