summaryrefslogtreecommitdiff
path: root/tool/ruby_vm
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-02-24 08:48:26 -0500
committerPeter Zhu <peter@peterzhu.ca>2023-02-24 14:10:09 -0500
commitd2631c427ee723f6136ac1e08dd3c9c5b04c6725 (patch)
treebeb99c15953ee5f9585dad1af475c99ba6e5f193 /tool/ruby_vm
parent05f016cdad84481c084543c6fa8b32205c19431f (diff)
downloadruby-d2631c427ee723f6136ac1e08dd3c9c5b04c6725.tar.gz
Fix RubyVM::CExpr#inspect
@__LINE__ can be nil which causes the inspect method to fail.
Diffstat (limited to 'tool/ruby_vm')
-rw-r--r--tool/ruby_vm/models/c_expr.rb6
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