bit more method collector/creation testing
This commit is contained in:
@ -17,7 +17,7 @@ module Melon
|
||||
|
||||
def add_local(statement)
|
||||
var = statement.children[0]
|
||||
@locals[var] = :Object #guess, can maybe guess better
|
||||
@locals[var] = :Object #not really used right now
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -21,20 +21,16 @@ module Melon
|
||||
private
|
||||
|
||||
def make_type( statement )
|
||||
type = Parfait.object_space.get_class_by_name(:Message ).instance_type
|
||||
type_hash = {}
|
||||
statement.children.each do |arg|
|
||||
type = type.add_instance_variable( arg.children[0] , :Object )
|
||||
type_hash[arg.children[0]] = :Object
|
||||
end
|
||||
type
|
||||
Parfait::NamedList.type_for( type_hash )
|
||||
end
|
||||
|
||||
def make_locals(body)
|
||||
locals = LocalsCollector.new.collect(body)
|
||||
type = Parfait.object_space.get_class_by_name(:NamedList ).instance_type
|
||||
locals.each do |name , local_type |
|
||||
type = type.add_instance_variable( name , local_type )
|
||||
end
|
||||
type
|
||||
type_hash = LocalsCollector.new.collect(body)
|
||||
Parfait::NamedList.type_for( type_hash )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,10 +2,10 @@ module Melon
|
||||
|
||||
class RubyMethod
|
||||
|
||||
attr_reader :name , :args_type , :locals_type , :body
|
||||
attr_reader :name , :args_type , :locals_type , :source
|
||||
|
||||
def initialize(name , args_type , locals_type , body )
|
||||
@name , @args_type , @locals_type , @body = name , args_type, locals_type , body
|
||||
def initialize(name , args_type , locals_type , source )
|
||||
@name , @args_type , @locals_type , @source = name , args_type, locals_type , source
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user