Renaming Vool exppressions rightly
Class, Method and Lambda (was block) are expressions. Just making things clearer, especially for the blocks (ahem, lambdas) is matters. wip
This commit is contained in:
@ -2,7 +2,7 @@ module Ruby
|
||||
class ClassMethodStatement < MethodStatement
|
||||
|
||||
def to_vool
|
||||
Vool::ClassMethodStatement.new( @name , @args.dup , @body.to_vool)
|
||||
Vool::ClassMethodExpression.new( @name , @args.dup , @body.to_vool)
|
||||
end
|
||||
|
||||
def to_s(depth = 0)
|
||||
|
@ -29,7 +29,7 @@ module Ruby
|
||||
meths += transform_statement(meth)
|
||||
end
|
||||
end
|
||||
Vool::ClassStatement.new(@name , @super_class_name, Vool::Statements.new(meths) )
|
||||
Vool::ClassExpression.new(@name , @super_class_name, Vool::Statements.new(meths) )
|
||||
end
|
||||
|
||||
# We rewrite certain send statements (so raise error for all else)
|
||||
|
@ -14,7 +14,7 @@ module Ruby
|
||||
else
|
||||
@body = replace_return( @body )
|
||||
end
|
||||
Vool::MethodStatement.new( @name , @args.dup , @body.to_vool)
|
||||
Vool::MethodExpression.new( @name , @args.dup , @body.to_vool)
|
||||
end
|
||||
|
||||
def replace_return(statement)
|
||||
|
@ -5,7 +5,7 @@ module Ruby
|
||||
attr_reader :return_value
|
||||
|
||||
def initialize(value)
|
||||
@return_value = value || NilConstant.new
|
||||
@return_value = value || NilConstant.new
|
||||
end
|
||||
|
||||
def to_vool
|
||||
|
@ -20,7 +20,7 @@ module Ruby
|
||||
#
|
||||
def to_vool
|
||||
block_name = "implicit_block_#{object_id}".to_sym
|
||||
block = Vool::LambdaStatement.new( @args.dup , @body.to_vool)
|
||||
block = Vool::LambdaExpression.new( @args.dup , @body.to_vool)
|
||||
assign = Vool::LocalAssignment.new( block_name , block)
|
||||
sendd = @send.to_vool
|
||||
if(sendd.is_a?(Vool::Statements))
|
||||
|
@ -10,7 +10,7 @@ module Ruby
|
||||
# Many statements exist in the vool layer in quite a similar arrangement
|
||||
# Especially for different types of assignment we can abstract the creation
|
||||
# of the vool, by using the right class to instantiate, the "vool_brother"
|
||||
# Ie same class_name, but in the Vool module
|
||||
# Ie same class_name, but in the Vool module
|
||||
def vool_brother
|
||||
eval "Vool::#{class_name}"
|
||||
end
|
||||
|
@ -34,11 +34,12 @@ module Ruby
|
||||
self
|
||||
end
|
||||
def to_vool
|
||||
if( single? )
|
||||
first.to_vool
|
||||
else
|
||||
vool_brother.new(@statements.collect{|s| s.to_vool})
|
||||
return first.to_vool if( single? )
|
||||
brother = vool_brother.new(nil)
|
||||
@statements.each do |s|
|
||||
brother << s.to_vool
|
||||
end
|
||||
brother
|
||||
end
|
||||
|
||||
def to_s(depth = 0)
|
||||
|
Reference in New Issue
Block a user