lib/rbi/parser.rb in rbi-0.0.11 vs lib/rbi/parser.rb in rbi-0.0.12

- old
+ new

@@ -287,11 +287,18 @@ Helper.new(method_name.to_s.delete_suffix("!"), loc: loc, comments: comments) when :mixes_in_class_methods names = node.children[2..-1].map { |child| parse_name(child) } MixesInClassMethods.new(*names, loc: loc, comments: comments) when :public, :protected, :private - visibility = Visibility.new(method_name, loc: loc) + visibility = case method_name + when :protected + Protected.new(loc: loc) + when :private + Private.new(loc: loc) + else + Public.new(loc: loc) + end nested_node = node.children[2] case nested_node&.type when :def, :defs method = parse_def(nested_node) method.visibility = visibility @@ -559,11 +566,11 @@ extend T::Sig sig { params(node: AST::Node).returns(Sig) } def self.build(node) v = SigBuilder.new - v.visit_all(node.children[2..-1]) + v.visit_all(node.children) v.current end sig { returns(Sig) } attr_accessor :current @@ -586,9 +593,12 @@ sig { params(node: AST::Node).void } def visit_send(node) visit(node.children[0]) if node.children[0] name = node.children[1] case name + when :sig + arg = node.children[2] + @current.is_final = arg && arg.children[0] == :final when :abstract @current.is_abstract = true when :override @current.is_override = true when :overridable