diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-02-24 08:48:26 -0500 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-02-24 14:10:09 -0500 |
commit | d2631c427ee723f6136ac1e08dd3c9c5b04c6725 (patch) | |
tree | beb99c15953ee5f9585dad1af475c99ba6e5f193 /tool | |
parent | 05f016cdad84481c084543c6fa8b32205c19431f (diff) | |
download | ruby-d2631c427ee723f6136ac1e08dd3c9c5b04c6725.tar.gz |
Fix RubyVM::CExpr#inspect
@__LINE__ can be nil which causes the inspect method to fail.
Diffstat (limited to 'tool')
-rw-r--r-- | tool/ruby_vm/models/c_expr.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tool/ruby_vm/models/c_expr.rb b/tool/ruby_vm/models/c_expr.rb index 073112f545..4b5aec58dd 100644 --- a/tool/ruby_vm/models/c_expr.rb +++ b/tool/ruby_vm/models/c_expr.rb @@ -36,6 +36,10 @@ class RubyVM::CExpr end def inspect - sprintf "#<%s:%d %s>", @__FILE__, @__LINE__, @expr + if @__LINE__ + sprintf "#<%s:%d %s>", @__FILE__, @__LINE__, @expr + else + sprintf "#<%s %s>", @__FILE__, @expr + end end end |