push the callable into the callable compiler
thus generalizing for .callable access keep block and method aliases for destinction in derived classes
This commit is contained in:
@ -22,7 +22,6 @@ module Vool
|
||||
def to_mom( compiler )
|
||||
parfait_block = self.parfait_block(compiler)
|
||||
block_compiler = Risc::BlockCompiler.new( parfait_block , compiler.get_method )
|
||||
compiler.add_block_compiler(block_compiler)
|
||||
head = body.to_mom( block_compiler )
|
||||
block_compiler.add_mom(head)
|
||||
block_compiler
|
||||
|
@ -1,19 +1,19 @@
|
||||
module Vool
|
||||
class MethodStatement < Statement
|
||||
attr_reader :name, :args , :body , :clazz
|
||||
attr_reader :name, :args , :body
|
||||
|
||||
def initialize( name , args , body , clazz = nil)
|
||||
def initialize( name , args , body )
|
||||
@name , @args , @body = name , args , body
|
||||
raise "no bod" unless @body
|
||||
@clazz = clazz
|
||||
end
|
||||
|
||||
def to_mom(clazz)
|
||||
@clazz = clazz || raise( "no class in #{self}")
|
||||
method = @clazz.add_method_for(name , make_arg_type , make_frame , body )
|
||||
raise( "no class in #{self}") unless clazz
|
||||
method = clazz.add_method_for(name , make_arg_type , make_frame , body )
|
||||
compiler = method.compiler_for(clazz.instance_type)
|
||||
each do |node| ## TODO: must account for nested blocks (someday)
|
||||
node.to_mom(compiler) if node.is_a?(BlockStatement)
|
||||
next unless node.is_a?(BlockStatement)
|
||||
compiler.block_compilers << node.to_mom(compiler)
|
||||
end
|
||||
compiler
|
||||
end
|
||||
|
Reference in New Issue
Block a user