Redoing ruby block conversion
Since the block is actually a constant, it does not need assignment or special hoisting Just use the send and stick the lambda in as last arg
This commit is contained in:
@ -11,26 +11,13 @@ module Ruby
|
||||
case value
|
||||
when Variable , Constant
|
||||
return self.vool_brother.new(name,@value.to_vool)
|
||||
when SendStatement , YieldStatement
|
||||
when SendStatement , YieldStatement , RubyBlockStatement
|
||||
return normalize_send
|
||||
when RubyBlockStatement
|
||||
return normalize_block
|
||||
else
|
||||
raise "unsupported right #{value}"
|
||||
end
|
||||
end
|
||||
|
||||
# Ruby BlockStatements have the block and the send. Normalize the send
|
||||
# and assign it (it is the last in the list)
|
||||
def normalize_block
|
||||
statements = value.to_vool
|
||||
index = statements.length - 1
|
||||
snd = statements.statements[index]
|
||||
raise "Expecting Send #{snd.class}:#{snd}" unless snd.is_a?( Vool::SendStatement)
|
||||
statements.statements[index] = assignment( snd )
|
||||
statements
|
||||
end
|
||||
|
||||
# sends may have complex args that get hoisted in vool:ing them
|
||||
# in which case we have to assign the simplified, otherwise the
|
||||
# plain send
|
||||
|
Reference in New Issue
Block a user