set up ivar_assignment correctly
for statement tests and write mom tests also implement to_mom and fix local (self) bug
This commit is contained in:
@ -129,7 +129,7 @@ module Vool
|
||||
def on_ivasgn expression
|
||||
name = expression.children[0]
|
||||
value = process(expression.children[1])
|
||||
InstanceAssignment.new(instance_name(name),value)
|
||||
IvarAssignment.new(instance_name(name),value)
|
||||
end
|
||||
|
||||
def on_return statement
|
||||
|
@ -51,11 +51,11 @@ end
|
||||
|
||||
|
||||
require_relative "statements/array_statement"
|
||||
require_relative "statements/assignment_statement"
|
||||
require_relative "statements/basic_values"
|
||||
require_relative "statements/class_statement"
|
||||
require_relative "statements/hash_statement"
|
||||
require_relative "statements/if_statement"
|
||||
require_relative "statements/ivar_statement"
|
||||
require_relative "statements/logical_statement"
|
||||
require_relative "statements/local_statement"
|
||||
require_relative "statements/method_statement"
|
||||
|
@ -1,4 +1,5 @@
|
||||
module Vool
|
||||
|
||||
class Assignment < Statement
|
||||
attr_reader :name , :value
|
||||
def initialize(name , value )
|
||||
@ -10,10 +11,15 @@ module Vool
|
||||
end
|
||||
end
|
||||
|
||||
class InstanceAssignment < Assignment
|
||||
class IvarAssignment < Assignment
|
||||
# used to collect type information
|
||||
def add_ivar( array )
|
||||
array << @name
|
||||
end
|
||||
|
||||
def to_mom( method )
|
||||
Mom::SlotConstant.new([:message , :self , @name] , @value)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -7,7 +7,7 @@ module Vool
|
||||
end
|
||||
|
||||
def to_mom( method )
|
||||
Mom::SlotConstant.new([:message , :self , @name] , @value)
|
||||
Mom::SlotConstant.new([:message , :frame , @name] , @value)
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user