start on blocks

This commit is contained in:
Torsten Ruger
2018-06-26 20:28:27 +03:00
parent 4103da7490
commit c6a903073a
5 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,29 @@
module Vool
class BlockStatement < Statement
attr_reader :args , :body , :clazz
def initialize( args , body , clazz = nil)
@args , @body = args , body
raise "no bod" unless @body
@clazz = clazz
end
def to_mom( _ )
raise "should not be called (call create_objects)"
end
def each(&block)
block.call(self)
@body.each(&block)
end
def normalize
BlockStatement.new( @args , @body.normalize)
end
def create_objects(clazz)
end
end
end

View File

@ -10,13 +10,17 @@ module Vool
# As cache key we must use the type of the object (which is the first word of _every_ object)
# as that is constant, and function implementations depend on the type (not class)
class SendStatement < Statement
attr_reader :name , :receiver , :arguments
attr_reader :name , :receiver , :arguments , :block
def initialize(name , receiver , arguments )
@name , @receiver , @arguments = name , receiver , arguments
@arguments ||= []
end
def block=( block )
@block = block
end
def normalize
statements = Statements.new([])
arguments = []