From c7550537f11dcf6450a9d3df3af3fa1f4fe05b15 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Thu, 30 Sep 2021 16:58:46 +0900 Subject: `RubyVM.keep_script_lines` `RubyVM.keep_script_lines` enables to keep script lines for each ISeq and AST. This feature is for debugger/REPL support. ```ruby RubyVM.keep_script_lines = true RubyVM::keep_script_lines = true eval("def foo = nil\ndef bar = nil") pp RubyVM::InstructionSequence.of(method(:foo)).script_lines ``` --- compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 71e078d20c..055d4e85f5 100644 --- a/compile.c +++ b/compile.c @@ -1328,7 +1328,7 @@ new_child_iseq(rb_iseq_t *iseq, const NODE *const node, ast.root = node; ast.compile_option = 0; - ast.script_lines = INT2FIX(-1); + ast.script_lines = iseq->body->variable.script_lines; debugs("[new_child_iseq]> ---------------------------------------\n"); int isolated_depth = ISEQ_COMPILE_DATA(iseq)->isolated_depth; -- cgit v1.2.1