ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:120538] [Ruby master Bug#21014] Prism doesn't set node_id on iseqs correctly
@ 2025-01-08  0:35 tenderlovemaking (Aaron Patterson) via ruby-core
  2025-01-08  0:36 ` [ruby-core:120539] " tenderlovemaking (Aaron Patterson) via ruby-core
  0 siblings, 1 reply; 2+ messages in thread
From: tenderlovemaking (Aaron Patterson) via ruby-core @ 2025-01-08  0:35 UTC (permalink / raw)
  To: ruby-core; +Cc: tenderlovemaking (Aaron Patterson)

Issue #21014 has been reported by tenderlovemaking (Aaron Patterson).

----------------------------------------
Bug #21014: Prism doesn't set node_id on iseqs correctly
https://bugs.ruby-lang.org/issues/21014

* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Assignee: prism
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Given this code:

```ruby
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:

```ruby
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 }
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:120539] [Ruby master Bug#21014] Prism doesn't set node_id on iseqs correctly
  2025-01-08  0:35 [ruby-core:120538] [Ruby master Bug#21014] Prism doesn't set node_id on iseqs correctly tenderlovemaking (Aaron Patterson) via ruby-core
@ 2025-01-08  0:36 ` tenderlovemaking (Aaron Patterson) via ruby-core
  0 siblings, 0 replies; 2+ messages in thread
From: tenderlovemaking (Aaron Patterson) via ruby-core @ 2025-01-08  0:36 UTC (permalink / raw)
  To: ruby-core; +Cc: tenderlovemaking (Aaron Patterson)

Issue #21014 has been updated by tenderlovemaking (Aaron Patterson).


Fix sent here: https://github.com/ruby/ruby/pull/12527

----------------------------------------
Bug #21014: Prism doesn't set node_id on iseqs correctly
https://bugs.ruby-lang.org/issues/21014#change-111340

* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Assignee: prism
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Given this code:

```ruby
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:

```ruby
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 }
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-08  0:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-08  0:35 [ruby-core:120538] [Ruby master Bug#21014] Prism doesn't set node_id on iseqs correctly tenderlovemaking (Aaron Patterson) via ruby-core
2025-01-08  0:36 ` [ruby-core:120539] " tenderlovemaking (Aaron Patterson) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).