minor
This commit is contained in:
parent
18faeeb042
commit
1e866ae0ae
@ -1,47 +1,8 @@
|
||||
module Vm
|
||||
class Integer
|
||||
class Integer < Value
|
||||
|
||||
def less_or_equal block , right
|
||||
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
|
||||
def initialize
|
||||
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
|
||||
|
@ -6,10 +6,10 @@ module Virtual
|
||||
# functions on these classes express their functionality as function objects
|
||||
class Object
|
||||
def initialize
|
||||
@layout = Layout.new([:layout])
|
||||
@layout = Layout.new( attributes )
|
||||
end
|
||||
def attributes
|
||||
raise "abstract #{self}"
|
||||
[:layout]
|
||||
end
|
||||
def == other
|
||||
return false unless other.class == self.class
|
||||
@ -28,7 +28,7 @@ module Virtual
|
||||
@members = members
|
||||
end
|
||||
def attributes
|
||||
[:members]
|
||||
super << :members
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
module Vm
|
||||
class Reference
|
||||
class Reference < Value
|
||||
|
||||
def initialize clazz = nil
|
||||
@clazz = clazz
|
||||
|
Loading…
x
Reference in New Issue
Block a user