aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-08 14:17:53 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-08 14:17:53 +0000
commit67245eec7192abdc1dd0dc2510c1f6c77df89bd0 (patch)
treefacd3ae86d8ea6fbb70c362cc9a1e22fbaf54b56 /eval.c
parent1bcc5eb9223fae41acd88ecacef0aee0d2087e56 (diff)
downloadruby-67245eec7192abdc1dd0dc2510c1f6c77df89bd0.tar.gz
* eval.c (rb_thread_restore_context): save current value of
lastline and lastmatch in the thread struct for later restore. * eval.c (rb_thread_save_context): restore lastline and lastmatch. * numeric.c (flo_to_s): should handle negative float value. * class.c (rb_include_module): should check whole ancestors to avoid duplicate module inclusion. * string.c (trnext): should check backslash before updating "now" position. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index aa97595cf1..0655cadc5e 100644
--- a/eval.c
+++ b/eval.c
@@ -7267,6 +7267,7 @@ rb_thread_save_context(th)
{
VALUE *pos;
int len;
+ static VALUE tval;
len = stack_length(&pos);
th->stk_len = 0;
@@ -7294,8 +7295,12 @@ rb_thread_save_context(th)
th->tracing = tracing;
th->errinfo = ruby_errinfo;
th->last_status = rb_last_status;
- th->last_line = rb_lastline_get();
- th->last_match = rb_backref_get();
+ tval = rb_lastline_get();
+ rb_lastline_set(th->last_line);
+ th->last_line = tval;
+ tval = rb_backref_get();
+ rb_backref_set(th->last_match);
+ th->last_match = tval;
th->safe = ruby_safe_level;
th->file = ruby_sourcefile;
@@ -7359,6 +7364,7 @@ rb_thread_restore_context(th, exit)
VALUE v;
static rb_thread_t tmp;
static int ex;
+ static VALUE tval;
if (!th->stk_ptr) rb_bug("unsaved context");
@@ -7395,8 +7401,12 @@ rb_thread_restore_context(th, exit)
FLUSH_REGISTER_WINDOWS;
MEMCPY(tmp->stk_pos, tmp->stk_ptr, VALUE, tmp->stk_len);
+ tval = rb_lastline_get();
rb_lastline_set(tmp->last_line);
+ tmp->last_line = tval;
+ tval = rb_backref_get();
rb_backref_set(tmp->last_match);
+ tmp->last_match = tval;
longjmp(tmp->context, ex);
}