check for correct operator
was getting passed sol constants
This commit is contained in:
parent
e4a79aac50
commit
6366ede8ee
@ -1,10 +1,16 @@
|
|||||||
module SlotMachine
|
module SlotMachine
|
||||||
class Comparison < Macro
|
class Comparison < Macro
|
||||||
|
|
||||||
|
def self.operators
|
||||||
|
[:<, :>, :>=, :<=]
|
||||||
|
end
|
||||||
|
|
||||||
attr_reader :operator
|
attr_reader :operator
|
||||||
|
|
||||||
def initialize(name , operator)
|
def initialize(name , operator)
|
||||||
super(name)
|
super(name)
|
||||||
#TODO check operator to be in valid range
|
raise "unsuported operator :#{operator}:#{operator.class}:" unless self.class.operators.include?(operator)
|
||||||
@operator = operator.value
|
@operator = operator
|
||||||
end
|
end
|
||||||
|
|
||||||
# basically use subtract to subtract left from right (or right from left)
|
# basically use subtract to subtract left from right (or right from left)
|
||||||
|
@ -73,7 +73,7 @@ module Sol
|
|||||||
# for loading into a slot, return the "slot_definition" that can be passed to
|
# for loading into a slot, return the "slot_definition" that can be passed to
|
||||||
# SlotLoad.
|
# SlotLoad.
|
||||||
def to_slot(compiler)
|
def to_slot(compiler)
|
||||||
raise "not iplemented in #{self}"
|
raise "not implemented in #{self}:#{self.class}"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user