minor
This commit is contained in:
parent
18faeeb042
commit
1e866ae0ae
@ -1,47 +1,8 @@
|
|||||||
module Vm
|
module Vm
|
||||||
class Integer
|
class Integer < Value
|
||||||
|
|
||||||
def less_or_equal block , right
|
def initialize
|
||||||
block.cmp( self , right )
|
|
||||||
Virtual::BranchCondition.new :le
|
|
||||||
end
|
|
||||||
def greater_or_equal block , right
|
|
||||||
block.cmp( self , right )
|
|
||||||
Virtual::BranchCondition.new :ge
|
|
||||||
end
|
|
||||||
def greater_than block , right
|
|
||||||
block.cmp( self , right )
|
|
||||||
Virtual::BranchCondition.new :gt
|
|
||||||
end
|
|
||||||
def less_than block , right
|
|
||||||
block.cmp( self , right )
|
|
||||||
Virtual::BranchCondition.new :lt
|
|
||||||
end
|
|
||||||
def plus block , first , right
|
|
||||||
block.add( self , left , right )
|
|
||||||
self
|
|
||||||
end
|
|
||||||
def minus block , left , right
|
|
||||||
block.sub( self , left , right )
|
|
||||||
self
|
|
||||||
end
|
|
||||||
def left_shift block , left , right
|
|
||||||
block.mov( self , left , shift_lsr: right )
|
|
||||||
self
|
|
||||||
end
|
|
||||||
def equals block , right
|
|
||||||
block.cmp( self , right )
|
|
||||||
Virtual::BranchCondition.new :eq
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_true? function
|
|
||||||
function.cmp( self , 0 )
|
|
||||||
Virtual::BranchCondition.new :ne
|
|
||||||
end
|
|
||||||
|
|
||||||
def move block , right
|
|
||||||
block.mov( self , right )
|
|
||||||
self
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -6,10 +6,10 @@ module Virtual
|
|||||||
# functions on these classes express their functionality as function objects
|
# functions on these classes express their functionality as function objects
|
||||||
class Object
|
class Object
|
||||||
def initialize
|
def initialize
|
||||||
@layout = Layout.new([:layout])
|
@layout = Layout.new( attributes )
|
||||||
end
|
end
|
||||||
def attributes
|
def attributes
|
||||||
raise "abstract #{self}"
|
[:layout]
|
||||||
end
|
end
|
||||||
def == other
|
def == other
|
||||||
return false unless other.class == self.class
|
return false unless other.class == self.class
|
||||||
@ -28,7 +28,7 @@ module Virtual
|
|||||||
@members = members
|
@members = members
|
||||||
end
|
end
|
||||||
def attributes
|
def attributes
|
||||||
[:members]
|
super << :members
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
module Vm
|
module Vm
|
||||||
class Reference
|
class Reference < Value
|
||||||
|
|
||||||
def initialize clazz = nil
|
def initialize clazz = nil
|
||||||
@clazz = clazz
|
@clazz = clazz
|
||||||
|
Loading…
x
Reference in New Issue
Block a user