From 941e43aacf9299ffdeb3761a1625d76a4fcdc947 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 24 Aug 2002 06:32:40 +0000 Subject: [PATCH] * eval.c (call_trace_func): restore source file/line, as trace function installed in required library with -r option can be called while parsing. (ruby-bugs:PR#372) * eval.c (module_setup): unused variable. [ruby-core:00358] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ eval.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 203d126631..e7e7a39504 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sat Aug 24 15:32:16 2002 Nobuyoshi Nakada + + * eval.c (call_trace_func): restore source file/line, as trace + function installed in required library with -r option can be + called while parsing. (ruby-bugs:PR#372) + + * eval.c (module_setup): unused variable. [ruby-core:00358] + Sat Aug 24 13:57:28 2002 Tanaka Akira * lib/time.rb (Time.rfc2822, Time#rfc2822): preserve localtimeness. diff --git a/eval.c b/eval.c index 54b6ee0d04..fdde01f3d5 100644 --- a/eval.c +++ b/eval.c @@ -2079,12 +2079,16 @@ call_trace_func(event, node, self, id, klass) { int state; struct FRAME *prev; - NODE *node_save = ruby_last_node; + NODE *node_save[2]; VALUE srcfile; if (!trace_func) return; if (tracing) return; + node_save[0] = ruby_last_node; + if (!(node_save[1] = ruby_current_node)) { + node_save[1] = NEW_NEWLINE(0); + } tracing = 1; prev = ruby_frame; PUSH_FRAME(); @@ -2120,7 +2124,9 @@ call_trace_func(event, node, self, id, klass) POP_FRAME(); tracing = 0; - ruby_last_node = node_save; + ruby_last_node = node_save[0]; + ruby_current_node = node_save[1]; + SET_CURRENT_SOURCE(); if (state) JUMP_TAG(state); } @@ -3424,7 +3430,6 @@ module_setup(module, n) int state; struct FRAME frame; VALUE result; /* OK */ - NODE * cnode = ruby_current_node; /* NOT IN USE, is it OK? */ TMP_PROTECT; frame = *ruby_frame;