start on __init__
This commit is contained in:
parent
cb727c658e
commit
3d66ffcc17
@ -12,6 +12,12 @@ module Builtin
|
|||||||
# so it is responsible for initial setup (and relocation)
|
# so it is responsible for initial setup (and relocation)
|
||||||
def __init__ context
|
def __init__ context
|
||||||
function = Virtual::CompiledMethod.new(:__init__ , [] , Virtual::Integer)
|
function = Virtual::CompiledMethod.new(:__init__ , [] , Virtual::Integer)
|
||||||
|
clazz = Virtual::BootSpace.space.get_or_create_class :Kernel
|
||||||
|
method = clazz.resolve_method :main
|
||||||
|
me = Virtual::Self.new(Virtual::Reference)
|
||||||
|
code = Virtual::Set.new(Virtual::NewSelf.new(me.type), me)
|
||||||
|
function.add_code(code)
|
||||||
|
function.add_code Virtual::FunctionCall.new(method)
|
||||||
return function
|
return function
|
||||||
end
|
end
|
||||||
def putstring context
|
def putstring context
|
||||||
|
@ -27,15 +27,16 @@ module Virtual
|
|||||||
end
|
end
|
||||||
|
|
||||||
# get the method and if not found, try superclasses. raise error if not found
|
# get the method and if not found, try superclasses. raise error if not found
|
||||||
def resolve_method name
|
def resolve_method m_name
|
||||||
fun = get_instance_method name
|
method = get_instance_method(m_name)
|
||||||
unless fun or name == :Object
|
unless method
|
||||||
supr = @context.object_space.get_or_create_class(@super_class_name)
|
unless( @name == :Object)
|
||||||
fun = supr.get_method name
|
supr = BootSpace.space.get_or_create_class(@super_class_name)
|
||||||
puts "#{supr.methods.collect(&:name)} for #{name} GOT #{fun.class}" if name == :index_of
|
method = supr.resolve_method(m_name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
raise "Method not found :#{name}, for #{inspect}" unless fun
|
raise "Method not found #{m_name}, for #{@name}" unless method
|
||||||
fun
|
method
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
|
Loading…
Reference in New Issue
Block a user