diff options
| author | eileencodes <eileencodes@gmail.com> | 2024-01-16 15:10:39 -0500 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2024-01-17 10:17:59 -0500 |
| commit | 0c814092ee1268562b4ba42973ea754e0dcf1bd0 (patch) | |
| tree | 7b1ef1d7570f85e4cfff6b044bd827ee02ee5772 | |
| parent | 3a7ad808b135bace484038e4ba0549796d98d872 (diff) | |
[Prism] Implement defined for PM_NEXT_NODE
Ruby code:
```ruby
defined?(next)
```
Instructions
```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,15)>
0000 putobject "expression" ( 59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,15)>
0000 putobject "expression" ( 58)[Li]
0002 leave
```
Related: ruby/prism#2188
| -rw-r--r-- | prism_compile.c | 1 | ||||
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/prism_compile.c b/prism_compile.c index 55bc348492..80101e5b66 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -2471,6 +2471,7 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *co case PM_KEYWORD_HASH_NODE: case PM_LAMBDA_NODE: case PM_MATCH_PREDICATE_NODE: + case PM_NEXT_NODE: case PM_OR_NODE: case PM_RANGE_NODE: case PM_REGULAR_EXPRESSION_NODE: diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 9b4e998b27..18ad6d1c08 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -218,6 +218,8 @@ module Prism defined?(PrismDefinedNode.new.m1) RUBY + + assert_prism_eval("defined?(next)") end def test_GlobalVariableReadNode |
