fix dynamic resolve
patch more like, real resolve method will have to be written and put in there
This commit is contained in:
@ -18,6 +18,10 @@ module Mom
|
||||
flat
|
||||
end
|
||||
|
||||
def <<(o)
|
||||
@statements << o
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -167,7 +167,7 @@ module Risc
|
||||
end
|
||||
|
||||
obj = space.get_class_by_name(:Word)
|
||||
[:putstring , :get_internal_byte , :set_internal_byte ].each do |f|
|
||||
[:putstring , :get_internal_byte , :set_internal_byte , :resolve_method].each do |f|
|
||||
obj.instance_type.add_method Builtin::Word.send(f , nil)
|
||||
end
|
||||
|
||||
|
@ -45,6 +45,21 @@ module Risc
|
||||
return compiler.method
|
||||
end
|
||||
|
||||
# resolve the method name of self, on the given object
|
||||
# may seem wrong way around at first sight, but we know the type of string And
|
||||
# thus resolving this method happens at compile time, whereas any method on an
|
||||
# unknown self (the object given) needs resolving and that is just what we are doing
|
||||
# ( ie the snake bites it's tail)
|
||||
# This method is just a placeholder until boot is over and the real method is
|
||||
# parsed.
|
||||
def resolve_method context
|
||||
compiler = compiler_for(:Word, :resolve_method , {:value => :Object} )
|
||||
args = compiler.method.arguments
|
||||
len = args.instance_length
|
||||
raise "Compiler arg number mismatch, method=#{args} " if len != 3
|
||||
return compiler.method
|
||||
end
|
||||
|
||||
end
|
||||
extend ClassMethods
|
||||
end
|
||||
|
@ -11,6 +11,10 @@ module Vool
|
||||
def create_objects
|
||||
@statements.each{ |s| s.create_objects }
|
||||
end
|
||||
|
||||
def <<(o)
|
||||
@statements << o
|
||||
end
|
||||
end
|
||||
|
||||
class ScopeStatement < Statements
|
||||
|
Reference in New Issue
Block a user