Ruby 4.1 リファレンスマニュアル

instance method RubyVM::InstructionSequence#node_id

node_id -> IntegerRuby 4.1 から[permalink][rdoc][edit]

self のコンパイル元になった抽象構文木(AST)のノードの node_id を返します。

RubyVM::InstructionSequence#syntax_tree は、この値と RubyVM::InstructionSequence#source_hash を使って、再度パースし直したソースから対応するノードを探します。

iseq = RubyVM::InstructionSequence.compile("1 + 2")
p iseq.node_id.is_a?(Integer) # => true

[SEE_ALSO] RubyVM::InstructionSequence#source_hash, RubyVM::InstructionSequence#syntax_tree