diff --git a/lib/yard/parser/ruby/ast_node.rb b/lib/yard/parser/ruby/ast_node.rb index 61c941c95..123ac87db 100644 --- a/lib/yard/parser/ruby/ast_node.rb +++ b/lib/yard/parser/ruby/ast_node.rb @@ -412,7 +412,14 @@ def unnamed_end_params def double_splat_param return nil unless YARD.ruby2? - self[-2] if self[-2].is_a?(AstNode) && self[-2].type == :ident + if (node = self[-2]).is_a?(AstNode) + if node.type == :ident + node + elsif node.type == :kwrest_param + # See https://bugs.ruby-lang.org/issues/12387 + node.last + end + end end def block_param diff --git a/lib/yard/rubygems/specification.rb b/lib/yard/rubygems/specification.rb index 16bbb7eac..905ba067a 100644 --- a/lib/yard/rubygems/specification.rb +++ b/lib/yard/rubygems/specification.rb @@ -35,8 +35,16 @@ def _dump_with_rdoc(limit) alias _dump_without_rdoc _dump alias _dump _dump_with_rdoc - @@default_value[:has_rdoc] = true if defined?(@@default_value) - @@attributes << 'has_rdoc' if defined?(@@attributes) - @@nil_attributes << 'has_rdoc' if defined?(@@nil_attributes) + if class_variable_defined?(:@@default_value) + if @@default_value.frozen? + t = @@default_value.dup + t[:has_rdoc] = true + @@default_value = t.freeze + else + @@default_value[:has_rdoc] = true + end + end + @@attributes << 'has_rdoc' if class_variable_defined?(:@@attributes) + @@nil_attributes << 'has_rdoc' if class_variable_defined?(:@@nil_attributes) end end