stash old vm
moving on to getting mom to work and can’t have both interpreter and elf broke, about 100 tests went
This commit is contained in:
27
stash/vm/method_compiler/field_access.rb
Normal file
27
stash/vm/method_compiler/field_access.rb
Normal file
@ -0,0 +1,27 @@
|
||||
module Vm
|
||||
module FieldAccess
|
||||
|
||||
def on_FieldAccess statement
|
||||
# receiver_ast , field_ast = *statement
|
||||
receiver = process(statement.receiver)
|
||||
|
||||
type = receiver.type
|
||||
if(type.is_a?(Symbol))
|
||||
type = Parfait.object_space.get_class_by_name(type).instance_type
|
||||
end
|
||||
field_name = statement.field.name
|
||||
|
||||
index = type.variable_index(field_name)
|
||||
raise "no such field:#{field_name} for class #{type.inspect}" unless index
|
||||
value = use_reg(type.type_at(index))
|
||||
|
||||
add_slot_to_reg(statement , receiver , index, value)
|
||||
|
||||
value
|
||||
end
|
||||
|
||||
def on_receiver expression
|
||||
process expression.first
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user