ruby/lib/prism
Kevin Newton 51d3d6ac8c [ruby/prism] Support forwarding flags on scopes
When parent scopes around an eval are forwarding parameters (like
*, **, &, or ...) we need to know that information when we are in
the parser. As such, we need to support passing that information
into the scopes option. In order to do this, unfortunately we need
a bunch of changes.

The scopes option was previously an array of array of strings.
These corresponded to the names of the locals in the parent scopes.
We still support this, but now additionally support passing in a
Prism::Scope instance at each index in the array. This Prism::Scope
class holds both the names of the locals as well as an array of
forwarding parameter names (symbols corresponding to the forwarding
parameters). There is convenience function on the Prism module that
creates a Prism::Scope object using Prism.scope.

In JavaScript, we now additionally support an object much the same
as the Ruby side. In Java, we now have a ParsingOptions.Scope class
that holds that information. In the dump APIs, these objects in all
3 languages will add an additional byte for the forwarding flags in
the middle of the scopes serialization.

All of this is in service of properly parsing the following code:

```ruby
def foo(*) = eval("bar(*)")
```

21abb6b7c4
2025-01-14 20:31:38 +00:00
..
parse_result [ruby/prism] Bump typechecking deps 2024-12-11 19:50:20 +00:00
polyfill [ruby/prism] Prism::Location#adjoin 2024-05-03 19:14:03 +00:00
translation [ruby/prism] Fix block parameters and it for RubyParser 2025-01-14 15:33:02 +00:00
desugar_compiler.rb [PRISM] Field renaming 2024-08-28 15:06:53 -04:00
ffi.rb [ruby/prism] Support forwarding flags on scopes 2025-01-14 20:31:38 +00:00
lex_compat.rb [ruby/prism] Fix up lex difference when ~ heredoc with 0 dedent and line continuation 2024-09-25 18:35:05 +00:00
node_ext.rb [ruby/prism] Reverse-sync ruby/ruby and deprecate old fields 2024-08-28 19:07:16 +00:00
pack.rb [ruby/prism] Resync RBI and test it in CI 2024-02-29 16:29:16 +00:00
parse_result.rb [ruby/prism] Support forwarding flags on scopes 2025-01-14 20:31:38 +00:00
pattern.rb [ruby/prism] Prism::Node#tunnel 2024-05-03 18:37:19 +00:00
prism.gemspec [ruby/prism] Bump to v1.3.0 2025-01-11 19:09:05 -05:00
relocation.rb [ruby/prism] Bump typechecking deps 2024-12-11 19:50:20 +00:00
string_query.rb [ruby/prism] Prism::StringQuery 2024-10-11 19:34:57 +00:00
translation.rb [ruby/prism] Support Ruby 3.5 for Prism::Translation::Parser 2024-12-26 14:15:00 +00:00