From 3a84364db0c301da0622695a133ca497b0af0e11 Mon Sep 17 00:00:00 2001 From: Fred Snyder Date: Sun, 26 Apr 2020 06:33:09 -0400 Subject: [PATCH] RubyVM super node handling. --- lib/solargraph/parser/legacy/node_chainer.rb | 1 - lib/solargraph/parser/rubyvm/node_chainer.rb | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/solargraph/parser/legacy/node_chainer.rb b/lib/solargraph/parser/legacy/node_chainer.rb index 6fb877271..0422c2373 100644 --- a/lib/solargraph/parser/legacy/node_chainer.rb +++ b/lib/solargraph/parser/legacy/node_chainer.rb @@ -76,7 +76,6 @@ def generate_links n elsif n.type == :zsuper result.push Chain::ZSuper.new('super', @in_block || block_passed?(n)) elsif n.type == :super - # elsif [:super, :zsuper].include?(n.type) args = n.children.map { |c| NodeChainer.chain(c) } result.push Chain::Call.new('super', args, @in_block || block_passed?(n)) elsif n.type == :const diff --git a/lib/solargraph/parser/rubyvm/node_chainer.rb b/lib/solargraph/parser/rubyvm/node_chainer.rb index 5dd71240d..dbb26fccb 100644 --- a/lib/solargraph/parser/rubyvm/node_chainer.rb +++ b/lib/solargraph/parser/rubyvm/node_chainer.rb @@ -69,8 +69,10 @@ def generate_links n result.push Chain::Call.new(n.children[0].to_s, node_to_argchains(n.children[1]), @in_block || block_passed?(n)) elsif n.type == :SELF result.push Chain::Head.new('self') - elsif [:SUPER, :ZSUPER].include?(n.type) - result.push Chain::Head.new('super') + elsif n.type == :ZSUPER + result.push Chain::ZSuper.new('super', @in_block || block_passed?(n)) + elsif n.type == :SUPER + result.push Chain::Call.new('super', node_to_argchains(n.children.last), @in_block || block_passed?(n)) elsif [:COLON2, :COLON3, :CONST].include?(n.type) const = unpack_name(n) result.push Chain::Constant.new(const)