summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--eval.c8
-rw-r--r--parse.y2
-rw-r--r--ruby.c7
4 files changed, 23 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 0efb0ade3e..2e522516c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Sun Sep 22 21:49:42 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (call_trace_func): should not call trace function while
+ compilation.
+
+ * eval.c (rb_call0): also inside c-func.
+
+ * parse.y (yycompile): ditto.
+
+ * ruby.c (require_libraries): preserve source file/line for each
+ require.
+
Sat Sep 21 22:23:41 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* eval.c (rb_thread_raise): no need to save dead thread context.
diff --git a/eval.c b/eval.c
index 1bbf65f109..1a9b77c541 100644
--- a/eval.c
+++ b/eval.c
@@ -895,8 +895,7 @@ void
ruby_set_current_source()
{
if (ruby_current_node) {
- ruby_sourcefile = ruby_current_node->nd_file;
- ruby_sourceline = nd_line(ruby_current_node);
+ SET_CURRENT_SOURCE();
}
}
@@ -2061,6 +2060,7 @@ call_trace_func(event, node, self, id, klass)
if (!trace_func) return;
if (tracing) return;
+ if (ruby_in_compile) return;
node_save[0] = ruby_last_node;
if (!(node_save[1] = ruby_current_node)) {
@@ -4501,17 +4501,21 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
}
if (trace_func) {
int state;
+ NODE *volatile node = ruby_current_node;
call_trace_func("c-call", ruby_current_node, recv, id, klass);
+ ruby_current_node = 0;
PUSH_TAG(PROT_FUNC);
if ((state = EXEC_TAG()) == 0) {
result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
}
POP_TAG();
+ ruby_current_node = node;
call_trace_func("c-return", ruby_current_node, recv, id, klass);
if (state) JUMP_TAG(state);
}
else {
+ ruby_current_node = 0;
result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
}
}
diff --git a/parse.y b/parse.y
index 0ab2181575..d38e5e7d0c 100644
--- a/parse.y
+++ b/parse.y
@@ -2335,6 +2335,7 @@ yycompile(f, line)
NODE *node = 0;
struct RVarmap *vp, *vars = ruby_dyna_vars;
+ ruby_in_compile = 1;
if (!compile_for_eval && rb_safe_level() == 0 &&
rb_const_defined(rb_cObject, rb_intern("SCRIPT_LINES__"))) {
VALUE hash, fname;
@@ -2365,7 +2366,6 @@ yycompile(f, line)
quoted_term = -1;
ruby_current_node = 0;
ruby_sourcefile = rb_source_filename(f);
- ruby_in_compile = 1;
n = yyparse();
ruby_debug_lines = 0;
compile_for_eval = 0;
diff --git a/ruby.c b/ruby.c
index dfaa2e1c9c..e6adcc7614 100644
--- a/ruby.c
+++ b/ruby.c
@@ -321,19 +321,20 @@ require_libraries()
ruby_eval_tree = ruby_eval_tree_begin = 0;
req_list_last = 0;
while (list) {
+ ruby_current_node = 0;
rb_require(list->name);
tmp = list->next;
free(list->name);
free(list);
list = tmp;
+ ruby_current_node = save[2];
+ ruby_set_current_source();
}
req_list_head.next = 0;
ruby_eval_tree = save[0];
ruby_eval_tree_begin = save[1];
- ruby_current_node = save[2];
- ruby_set_current_source();
- ruby_current_node = 0;
rb_gc_force_recycle((VALUE)save[2]);
+ ruby_current_node = 0;
}
static void