diff options
| author | Aaron Patterson <tenderlove@ruby-lang.org> | 2025-01-07 16:14:18 -0800 |
|---|---|---|
| committer | Aaron Patterson <aaron.patterson@gmail.com> | 2025-01-07 17:08:43 -0800 |
| commit | 63723c8d5908569918fb27e070ae5bc9de33c8bd (patch) | |
| tree | a3682babb44b878ea1f074b106efbcd8392e82fd /test | |
| parent | 4a78d74039df3fc6870800596667a7b42522b032 (diff) | |
Correctly set node_id on iseq location
The iseq location object has a slot for node ids. parse.y was correctly
populating that field but Prism was not. This commit populates the field
with the ast node id for that iseq
[Bug #21014]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12527
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 546d549211..819d0d35aa 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -3,6 +3,12 @@ # This file is organized to match itemization in https://github.com/ruby/prism/issues/1335 module Prism class TestCompilePrism < Test::Unit::TestCase + def test_iseq_has_node_id + code = "proc { <<END }\n hello\nEND" + iseq = RubyVM::InstructionSequence.compile_prism(code) + assert_operator iseq.to_a[4][:node_id], :>, -1 + end + # Subclass is used for tests which need it class Subclass; end ############################################################################ |
