summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-10-29 05:07:26 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-10-29 05:07:26 +0000
commit88abd791f522c7097141753c3480a456340215f8 (patch)
treeac7f94b43697aed5cb9306aa19a904f08ab8a2d7 /eval.c
parent429f7ed113dc862b121ab63c73170e4169853581 (diff)
* parse.y (str_extend): shuould allow interpolation of $-x.
* variable.c (rb_cvar_set): empty iv_tbl may cause infinite loop. * variable.c (rb_cvar_get): ditto. * variable.c (cvar_override_check): ditto. * bignum.c (rb_big_eq): convert Bignum to Float, instead of reverse. * time.c (time_localtime): getting tm should not be prohibited for frozen time objects. * time.c (time_gmtime): ditto. * version.c (Init_version): freeze RUBY_VERSION, RUBY_RELEASE_DATE, and RUBY_PLATFORM. * file.c (Init_File): freeze File::SEPARATOR, ALT_SEPARATOR and PATH_SEPARATOR. * file.c (rb_stat_cmp): should check operand type before calling get_stat(). * eval.c (rb_eval_cmd): should not invoke "call" with a block on any occasion. * numeric.c (fix_aref): idx may be a Bignum. * numeric.c (num_remainder): a bug in Numeric#remainder. * eval.c (rb_exec_end_proc): END might be called within END block. * class.c (rb_mod_clone): should not copy class name, since clone should remain anonymous. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/eval.c b/eval.c
index e31c5986c9..5fb2213c75 100644
--- a/eval.c
+++ b/eval.c
@@ -1349,8 +1349,10 @@ rb_eval_cmd(cmd, arg)
volatile int safe = ruby_safe_level;
if (TYPE(cmd) != T_STRING) {
- return rb_funcall2(cmd, rb_intern("call"),
- RARRAY(arg)->len, RARRAY(arg)->ptr);
+ PUSH_ITER(ITER_NOT);
+ val = rb_funcall2(cmd, rb_intern("call"), RARRAY(arg)->len, RARRAY(arg)->ptr);
+ POP_ITER();
+ return val;
}
saved_scope = ruby_scope;
@@ -2736,7 +2738,7 @@ rb_eval(self, n)
val = rb_funcall(val, node->nd_mid, 1, rb_eval(self, rval));
}
argv[argc-1] = val;
- val = rb_funcall2(recv, aset, argc, argv);
+ rb_funcall2(recv, aset, argc, argv);
result = val;
}
break;
@@ -3921,7 +3923,7 @@ assign(self, lhs, val, pcall)
VALUE
rb_iterate(it_proc, data1, bl_proc, data2)
- VALUE (*it_proc)(), (*bl_proc)();
+ VALUE (*it_proc) _((VALUE)), (*bl_proc)(ANYARGS);
VALUE data1, data2;
{
int state;
@@ -3995,10 +3997,10 @@ handle_rescue(self, node)
VALUE
#ifdef HAVE_STDARG_PROTOTYPES
-rb_rescue2(VALUE (*b_proc)(), VALUE data1, VALUE (*r_proc)(), VALUE data2, ...)
+rb_rescue2(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*r_proc)(ANYARGS), VALUE data2, ...)
#else
rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
- VALUE (*b_proc)(), (*r_proc)();
+ VALUE (*b_proc)(ANYARGS), (*r_proc)(ANYARGS);
VALUE data1, data2;
va_dcl
#endif
@@ -4089,8 +4091,9 @@ rb_protect(proc, data, state)
VALUE
rb_ensure(b_proc, data1, e_proc, data2)
VALUE (*b_proc)();
+ VALUE data1;
VALUE (*e_proc)();
- VALUE data1, data2;
+ VALUE data2;
{
int state;
volatile VALUE result = Qnil;
@@ -5959,12 +5962,20 @@ rb_f_at_exit()
void
rb_exec_end_proc()
{
- struct end_proc_data *link;
+ struct end_proc_data *link, *save;
int status;
- link = end_procs;
+ save = link = end_procs;
while (link) {
- rb_protect((VALUE(*)_((VALUE)))link->func, link->data, &status);
+ rb_protect((VALUE(*)())link->func, link->data, &status);
+ if (status) {
+ error_handle(status);
+ }
+ link = link->next;
+ }
+ link = end_procs;
+ while (link != save) {
+ rb_protect((VALUE(*)())link->func, link->data, &status);
if (status) {
error_handle(status);
}