From 21425163ddf28b3954d6a2f55ff762c1e055176d Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Sun, 8 Oct 2017 10:50:34 -0500 Subject: [PATCH] Fixes for trunk as of svn 60140 2017-10-08 --- lib/yard/parser/ruby/ast_node.rb | 9 ++++++++- lib/yard/rubygems/specification.rb | 14 +++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) 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