2016-12-20 19:02:20 +01:00
|
|
|
module Melon
|
|
|
|
|
|
|
|
class RubyMethod
|
|
|
|
|
2017-01-13 21:16:06 +01:00
|
|
|
attr_reader :name , :args_type , :locals_type , :source
|
2016-12-21 10:30:35 +01:00
|
|
|
|
2017-01-13 21:16:06 +01:00
|
|
|
def initialize(name , args_type , locals_type , source )
|
|
|
|
@name , @args_type , @locals_type , @source = name , args_type, locals_type , source
|
2016-12-20 19:02:20 +01:00
|
|
|
end
|
|
|
|
|
2017-01-14 19:30:19 +01:00
|
|
|
def normalize_source
|
|
|
|
@source = yield @source
|
|
|
|
end
|
2017-01-15 11:10:37 +01:00
|
|
|
|
|
|
|
def create_vm_method( type )
|
|
|
|
raise "create_method #{type.inspect} is not a Type" unless type.is_a? Parfait::Type
|
|
|
|
type.create_method( @name , @args_type )#FIXME, @locals_type)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2016-12-20 19:02:20 +01:00
|
|
|
end
|
|
|
|
end
|