diff --git a/lib/syntax_tree/visitor/compiler.rb b/lib/syntax_tree/visitor/compiler.rb index 780495d2..c56e553d 100644 --- a/lib/syntax_tree/visitor/compiler.rb +++ b/lib/syntax_tree/visitor/compiler.rb @@ -1541,6 +1541,17 @@ def visit_string_literal(node) end end + def visit_super(node) + builder.putself + visit(node.arguments) + builder.invokesuper( + nil, + argument_parts(node.arguments).length, + VM_CALL_FCALL | VM_CALL_ARGS_SIMPLE | VM_CALL_SUPER, + nil + ) + end + def visit_symbol_literal(node) builder.putobject(node.accept(RubyVisitor.new)) end diff --git a/test/compiler_test.rb b/test/compiler_test.rb index 85d62b5b..1c6cde38 100644 --- a/test/compiler_test.rb +++ b/test/compiler_test.rb @@ -281,6 +281,8 @@ class CompilerTest < Minitest::Test "undef foo, bar, baz", "undef :foo, :bar, :baz", "super", + "super(1)", + "super(1, 2, 3)", # defined? usage "defined?(foo)", "defined?(\"foo\")",