diff options
| author | Jemma Issroff <jemmaissroff@gmail.com> | 2023-12-13 16:41:45 -0500 |
|---|---|---|
| committer | Jemma Issroff <jemmaissroff@gmail.com> | 2023-12-14 11:46:54 -0500 |
| commit | e71f0117137c30db1dd694aa2c91c82174fa05df (patch) | |
| tree | bcddb48a50fe4b059ec15491a7ea531307dd6b35 /test | |
| parent | 3658798dbb60fe55beaebc157ba43c8fe617c4a0 (diff) | |
[PRISM] Fix bugs in compiling optional keyword parameters
This PR fixes two bugs when compiling optional keyword parameters:
- It moves keyword parameter compilation to STEP 5 in the parameters
sequence, where the rest of compilation happens. This is important
because keyword parameter compilation relies on the value of
body->param.keyword->bits_start which gets set in an earlier step
- It compiles array and hash values for keyword parameters, which
it didn't previously
Diffstat (limited to 'test')
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 7bd63eb611..f89aabfc0e 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1178,6 +1178,12 @@ module Prism end prism_test_def_node(10, b: 3) CODE + assert_prism_eval(<<-CODE) + def self.prism_test_def_node(a: []) + a + end + prism_test_def_node + CODE # block arguments assert_prism_eval("def self.prism_test_def_node(&block) block end; prism_test_def_node{}.class") |
