rename method
This commit is contained in:
@@ -4,28 +4,28 @@ module Boot
|
||||
# class is mainly a list of methods with a name (for now)
|
||||
# layout of object is seperated into Layout
|
||||
class BootClass < Virtual::ObjectConstant
|
||||
def initialize name , super_class = :Object
|
||||
def initialize name , super_class_name = :Object
|
||||
super()
|
||||
# class methods
|
||||
@methods = []
|
||||
@method_definitions = []
|
||||
@name = name.to_sym
|
||||
@super_class = super_class
|
||||
@super_class_name = super_class_name.to_sym
|
||||
@meta_class = MetaClass.new(self)
|
||||
end
|
||||
attr_reader :name , :methods , :meta_class , :context , :super_class
|
||||
def attributes
|
||||
[:name , :super_class]
|
||||
end
|
||||
def add_method method
|
||||
raise "not a method #{method}" unless method.is_a? Virtual::Method
|
||||
def add_method_definition method
|
||||
raise "not a method #{method}" unless method.is_a? Virtual::MethodDefinition
|
||||
raise "syserr " unless method.name.is_a? Symbol
|
||||
@methods << method
|
||||
@method_definitions << method
|
||||
end
|
||||
|
||||
def get_method fname
|
||||
def get_method_definition fname
|
||||
fname = fname.to_sym
|
||||
f = @methods.detect{ |f| f.name == fname }
|
||||
names = @methods.collect{|f| f.name }
|
||||
f = @method_definitions.detect{ |f| f.name == fname }
|
||||
names = @method_definitions.collect{|f| f.name }
|
||||
f
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ module Boot
|
||||
def resolve_method name
|
||||
fun = get_method name
|
||||
unless fun or name == :Object
|
||||
supr = @context.object_space.get_or_create_class(@super_class)
|
||||
supr = @context.object_space.get_or_create_class(@super_class_name)
|
||||
fun = supr.get_method name
|
||||
puts "#{supr.methods.collect(&:name)} for #{name} GOT #{fun.class}" if name == :index_of
|
||||
end
|
||||
|
Reference in New Issue
Block a user