Unify instruction namings also dirs
Was getting confused myself, where it was instruction or instructions, when if the base class was inside or out of dir. Now dirs are plural, and base class is inside.
This commit is contained in:
20
lib/slot_machine/instructions/jump.rb
Normal file
20
lib/slot_machine/instructions/jump.rb
Normal file
@ -0,0 +1,20 @@
|
||||
module SlotMachine
|
||||
|
||||
# Branch jump to the Label given
|
||||
# Eg used at the end of while or end of if_true branch
|
||||
#
|
||||
# Risc equivalent is the same really, called Branch there.
|
||||
#
|
||||
class Jump < Instruction
|
||||
attr_reader :label
|
||||
|
||||
def initialize(label)
|
||||
@label = label
|
||||
end
|
||||
def to_risc(compiler)
|
||||
compiler.add_code Risc::Branch.new(self , @label.risc_label(compiler))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
Reference in New Issue
Block a user