From c4dfd0ccfbc325d3231de655f9f0dfc4cdfc8593 Mon Sep 17 00:00:00 2001 From: rhe Date: Fri, 21 Jul 2017 04:29:46 +0000 Subject: ripper: add kwrest_param parser event * parse.y (f_kwrest): Dispatch kwrest_param event. This is especially useful for unnamed kwrest parameter for which we expose the internal ID currently. [ruby-core:75528] [Feature #12387] * test/ripper/dummyparser.rb (on_kwrest_param): Add handler for kwrest_param parser event. * test/ripper/test_parser_events.rb (test_params): Adapt to the change in DummyParser. (test_kwrest_param): Test that kwrest_param event handler is called. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 58cec8961d..0a1910e880 100644 --- a/parse.y +++ b/parse.y @@ -4492,12 +4492,20 @@ kwrest_mark : tPOW f_kwrest : kwrest_mark tIDENTIFIER { shadowing_lvar(get_id($2)); + /*%%%*/ $$ = $2; + /*% + $$ = dispatch1(kwrest_param, $2); + %*/ } | kwrest_mark { + /*%%%*/ $$ = internal_id(); arg_var($$); + /*% + $$ = dispatch1(kwrest_param, Qnil); + %*/ } ; -- cgit v1.2.3