Fix super as statement

Super is a statement, a send really.
Not an expression (as maybe in c++)
The actual implementation will be a bit tricky, like raise, a bit of stack walking, but not impossible. Still, later
This commit is contained in:
2019-08-19 18:48:13 +03:00
parent 0e694a38f7
commit 57b0ad2c32
10 changed files with 47 additions and 38 deletions

View File

@ -74,6 +74,9 @@ module Ruby
def on_arg( arg )
arg.first
end
def on_optarg(arg)
arg.first
end
def on_block(block_node)
sendd = process(block_node.children[0])
@ -232,14 +235,14 @@ module Ruby
# this is a call to super without args (z = zero arity)
def on_zsuper exp
SendStatement.new( nil , SuperExpression.new , nil)
SuperStatement.new([])
end
# this is a call to super with args and
# same name as current method, which is set later
def on_super( statement )
arguments = process_all(statement.children)
SendStatement.new( nil , SuperExpression.new , arguments)
SuperStatement.new( arguments)
end
def on_assignment statement
@ -250,10 +253,6 @@ module Ruby
w
end
def handler_missing(node)
not_implemented(node)
end
private
def instance_name sym