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:
2019-08-19 11:33:12 +03:00
parent ae16551ed0
commit f87526f86f
44 changed files with 162 additions and 92 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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))

View File

@ -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

View File

@ -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)