Actions
Bug #21014
closedPrism doesn't set node_id on iseqs correctly
Description
Given this code:
f = proc { <<END }
heredoc
END
iseq = RubyVM::InstructionSequence.of(f)
p iseq.to_a[4][:node_id]
Output on parse.y:
$ ./miniruby --parser=parse.y test.rb
3
Output on Prism:
$ ./miniruby test.rb
-1
I don't expect node IDs on Prism to match parse.y, but I do expect the node id to be a legitimate node id. For example, this program should work:
f = proc { <<END }
heredoc
END
iseq = RubyVM::InstructionSequence.of(f)
require "prism"
node_id = iseq.to_a[4][:node_id]
ast = Prism.parse(File.binread(__FILE__))
p ast.value.breadth_first_search { |node| node.node_id == node_id }
Actions
Like0
Like0Like0