diff options
| author | Jemma Issroff <jemmaissroff@gmail.com> | 2023-12-08 16:17:07 -0500 |
|---|---|---|
| committer | Jemma Issroff <jemmaissroff@gmail.com> | 2023-12-11 09:47:59 -0500 |
| commit | c69d1367a7994c70f956fc6486568823e8fa5812 (patch) | |
| tree | f99454c8f4f8adb452e2538c34ec2bfcc2c4c4ed /test/ruby | |
| parent | 0562c246ebdf071dfb85b2f7904574d38fee14f7 (diff) | |
[PRISM] Fix ElseNode within CaseNode
The logic within the consequent for the CaseNodes in popped cases
was incorrect as it wouldn't emit consequent instructions for a
popped CaseNode. This commit fixes that.
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 13dd866313..4b08d9eecc 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -701,6 +701,17 @@ module Prism assert_prism_eval("case; when :a, :b; 1; else; 2 end") assert_prism_eval("case :a; when :b; else; end") assert_prism_eval("b = 1; case :a; when b; else; end") + assert_prism_eval(<<-CODE) + def self.prism_test_case_node + case :a + when :b + else + return 2 + end + 1 + end + prism_test_case_node + CODE end def test_ElseNode |
