From 9abdbf4e17a6623ba9fa25a54e726f56cd61f81e Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 5 Aug 2003 06:47:37 +0000 Subject: * eval.c (rb_load): should preserve current source file/line. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 35fed1413..acfb22068 100644 --- a/eval.c +++ b/eval.c @@ -5715,6 +5715,7 @@ rb_load(fname, wrap) volatile ID last_func; volatile VALUE wrapper = 0; volatile VALUE self = ruby_top_self; + NODE *volatile last_node; NODE *saved_cref = ruby_cref; TMP_PROTECT; @@ -5759,6 +5760,11 @@ rb_load(fname, wrap) PUSH_TAG(PROT_NONE); state = EXEC_TAG(); last_func = ruby_frame->last_func; + last_node = ruby_current_node; + if (!ruby_current_node && ruby_sourcefile) { + last_node = NEW_NEWLINE(0); + } + ruby_current_node = 0; if (state == 0) { NODE *node; volatile int critical; @@ -5777,6 +5783,9 @@ rb_load(fname, wrap) } ALLOW_INTS; ruby_frame->last_func = last_func; + ruby_current_node = last_node; + ruby_sourcefile = 0; + ruby_set_current_source(); if (ruby_scope->flags == SCOPE_ALLOCA && ruby_class == rb_cObject) { if (ruby_scope->local_tbl) /* toplevel was empty */ free(ruby_scope->local_tbl); -- cgit