rename method to typed_method

This commit is contained in:
Torsten Ruger
2016-12-12 23:38:55 +02:00
parent 4ff684b6a4
commit 17023fdeb1
16 changed files with 27 additions and 22 deletions

View File

@ -29,7 +29,7 @@ module Parfait
end
def add_instance_method method
raise "not a method #{method.class} #{method.inspect}" unless method.is_a? Method
raise "not a method #{method.class} #{method.inspect}" unless method.is_a? TypedMethod
raise "syserr #{method.name.class}" unless method.name.is_a? Symbol
if self.is_a?(Class) and (method.for_class != self)
raise "Adding to wrong class, should be #{method.for_class}"

View File

@ -49,7 +49,7 @@ module Parfait
clazz = instance_type().object_class()
raise "??? #{method_name}" unless clazz
#puts "Self: #{self.class} clazz: #{clazz.name}"
add_instance_method Method.new( clazz , method_name , arguments )
add_instance_method TypedMethod.new( clazz , method_name , arguments )
end
# this needs to be done during booting as we can't have all the classes and superclassses

View File

@ -60,7 +60,7 @@ module Parfait
def create_instance_method method_name , arguments
raise "create_instance_method #{method_name}.#{method_name.class}" unless method_name.is_a?(Symbol)
log.debug "Add_method: #{method_name} clazz: #{self.name}"
add_instance_method Method.new( self , method_name , arguments )
add_instance_method TypedMethod.new( self , method_name , arguments )
end

View File

@ -1,5 +1,10 @@
# A Method (at runtime , sis in Parfait) is static object that primarily holds the executable
# code.
# A TypedMethod is static object that primarily holds the executable code.
# It is called typed, because all arguments and variables it uses are typed.
# (Type means basic type, ie integer or reference)
# It's relation to the method a ruby programmer knows (called RubyMethod) is many to one,
# meaning one RubyMethod (untyped) has many TypedMethod implementations.
# The RubyMethod only holds ruby code, no binary.
# For reflection also holds arguments and such
@ -13,10 +18,10 @@ module Parfait
# known local variable names
# executable code
# ps, the compiler injects its own info, see Register::MethodSource
# ps, the compiler injects its own info
class Method < Object
class TypedMethod < Object
attributes [:name , :source , :instructions , :binary ,:arguments , :for_class, :locals ]
# not part of the parfait model, hence ruby accessor