Closed presidentbeef closed 3 years ago
This looks like the right mechanism, but prolly needs to be expanded to deal with different types of locals?
lib/ruby_lexer.rb
331: def is_local_id id
337: # TODO: (dyna_in_block? && dvar_defined?(id)) || local_id?(id)
963: tok_id = :tIDENTIFIER if tok_id == :tCONSTANT && is_local_id(token)
@zenspider Thoughts?
@presidentbeef @zenspider any news on that PR?
I overhauled this a bit: (https://github.com/seattlerb/ruby_parser/commit/731b4b749bed27ece3fd4f3c987e86cc3b23f455)
call_arg
and arg
to have cleaner parser-side impl.f(x, ...)
(why?!?).Gist is the same.
P.S. I kinda hate s(:forward_args)
... was seriously tempted to do s(:"...")
but I also hate quoted syms.
P.P.S. Why does that sym need quoting?
Adds support for argument forwarding from Ruby 2.7.
However, it needs to be a syntax error if the triple-dot argument forwarding is used anywhere but inside a method definition that sets argument forwarding (i.e.,
def x(...); end
).Looks like in MRI they set some special argument variables to do the forwarding and check for their existence in the parser. (The current parser has abstracted this out into helper methods.)
Open to suggestions on how/where to track that information.