0
@@ -689,30 +689,6 @@ static unsigned long frame_unique = 0;
0
ruby_frame = _frame.prev; \
0
- struct RVarmap *dyna_vars;
0
-#define BLOCK_D_SCOPE 1
0
-#define BLOCK_FROM_METHOD 4
0
static struct BLOCK *ruby_block;
0
static unsigned long block_unique = 0;
0
@@ -2641,7 +2617,7 @@ avalue_splat(VALUE v)
0
- return rb_values_from_ary(rb_
convert_type(v, T_ARRAY, "Array", "to_a"));
0
+ return rb_values_from_ary(rb_
Array(v));
0
@@ -5827,7 +5803,7 @@ rb_apply(VALUE recv, ID mid, VALUE args)
0
-send_f
call(int argc, VALUE *argv, VALUE recv, int scope)
0
+send_f
uncall(int argc, VALUE *argv, VALUE recv, int scope)
0
@@ -5869,25 +5845,25 @@ rb_f_send(int argc, VALUE *argv, VALUE recv)
0
int scope = (ruby_frame->flags & FRAME_FUNC) ? 1 : 0;
0
- return send_f
call(argc, argv, recv, scope);
0
+ return send_f
uncall(argc, argv, recv, scope);
0
- * obj.f
call(symbol [, args...]) => obj
0
+ * obj.f
uncall(symbol [, args...]) => obj
0
* Invokes the method identified by _symbol_, passing it any
0
* arguments specified. Unlike send, which calls private methods only
0
- * when it is invoked in function call style, f
call always aware of
0
+ * when it is invoked in function call style, f
uncall always aware of
0
- * 1.f
call(:puts, "hello") # prints "foo"
0
+ * 1.f
uncall(:puts, "hello") # prints "foo"
0
-rb_f_f
call(int argc, VALUE *argv, VALUE recv)
0
+rb_f_f
uncall(int argc, VALUE *argv, VALUE recv)
0
- return send_f
call(argc, argv, recv, 1);
0
+ return send_f
uncall(argc, argv, recv, 1);
0
@@ -6336,16 +6312,25 @@ eval_under(VALUE under, VALUE self, VALUE src, const char *file, int line)
0
-yield_under_i(VALUE
self)
0
+yield_under_i(VALUE
arg)
0
- return rb_yield_0(self, self, ruby_class, YIELD_PUBLIC_DEF, Qfalse);
0
+ VALUE *args = (VALUE *)arg;
0
+ if (args[0] == Qundef) {
0
+ return rb_yield_0(args[0], args[1], ruby_class, YIELD_PUBLIC_DEF, avalue);
0
/* block eval under the class/module context */
0
-yield_under(VALUE under, VALUE self
)
0
+yield_under(VALUE under, VALUE self
, VALUE values)
0
- return exec_under(yield_under_i, under, 0, self);
0
+ return exec_under(yield_under_i, under, 0, (VALUE)args);
0
@@ -6355,7 +6340,7 @@ specific_eval(int argc, VALUE *argv, VALUE klass, VALUE self)
0
rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
0
- return yield_under(klass, self
);
0
+ return yield_under(klass, self
, Qundef);
0
@@ -6424,6 +6409,38 @@ rb_obj_instance_eval(int argc, VALUE *argv, VALUE self)
0
+ * obj.instance_exec(arg...) {|var...| block } => obj
0
+ * Executes the given block within the context of the receiver
0
+ * (_obj_). In order to set the context, the variable +self+ is set
0
+ * to _obj_ while the code is executing, giving the code access to
0
+ * _obj_'s instance variables. Arguments are passed as block parameters.
0
+ * k.instance_eval(5) {|x| @secret+x } #=> 104
0
+rb_obj_instance_exec(int argc, VALUE *argv, VALUE self)
0
+ if (FIXNUM_P(self) || SYMBOL_P(self)) {
0
+ klass = rb_singleton_class(self);
0
+ return yield_under(klass, self, rb_values_new2(argc, argv));
0
* mod.class_eval(string [, filename [, lineno]]) => obj
0
* mod.module_eval {|| block } => obj
0
@@ -6452,6 +6469,32 @@ rb_mod_module_eval(int argc, VALUE *argv, VALUE mod)
0
return specific_eval(argc, argv, mod, mod);
0
+ * mod.module_exec(arg...) {|var...| block } => obj
0
+ * mod.class_exec(arg...) {|var...| block } => obj
0
+ * Evaluates the given block in the context of the class/module.
0
+ * The method defined in the block will belong to the receiver.
0
+ * def hello() "Hello there!" end
0
+ * puts Thing.new.hello()
0
+rb_mod_module_exec(int argc, VALUE *argv, VALUE mod)
0
+ return yield_under(mod, mod, rb_values_new2(argc, argv));
0
NORETURN(static void load_failed(VALUE));
0
@@ -6699,10 +6742,9 @@ load_wait(char *ftptr)
0
if (!loading_tbl) return Qfalse;
0
if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return Qfalse;
0
- if ((rb_thread_t)th == curr_thread) return Qtrue;
0
+ if ((rb_thread_t)th == curr_thread) return Qtrue;
0
} while (st_lookup(loading_tbl, (st_data_t)ftptr, &th));
0
@@ -7579,8 +7621,9 @@ Init_eval(void)
0
rb_define_method(rb_mKernel, "send", rb_f_send, -1);
0
rb_define_method(rb_mKernel, "__send__", rb_f_send, -1);
0
- rb_define_method(rb_mKernel, "f
call", rb_f_fcall, -1);
0
+ rb_define_method(rb_mKernel, "f
uncall", rb_f_funcall, -1);
0
rb_define_method(rb_mKernel, "instance_eval", rb_obj_instance_eval, -1);
0
+ rb_define_method(rb_mKernel, "instance_exec", rb_obj_instance_exec, -1);
0
rb_define_private_method(rb_cModule, "append_features", rb_mod_append_features, 1);
0
rb_define_private_method(rb_cModule, "extend_object", rb_mod_extend_object, 1);
0
@@ -7597,6 +7640,8 @@ Init_eval(void)
0
rb_define_method(rb_cModule, "private_class_method", rb_mod_private_method, -1);
0
rb_define_method(rb_cModule, "module_eval", rb_mod_module_eval, -1);
0
rb_define_method(rb_cModule, "class_eval", rb_mod_module_eval, -1);
0
+ rb_define_method(rb_cModule, "module_exec", rb_mod_module_exec, -1);
0
+ rb_define_method(rb_cModule, "class_exec", rb_mod_module_exec, -1);
0
rb_undef_method(rb_cClass, "module_function");
0
@@ -8545,14 +8590,6 @@ block_pass(VALUE self, NODE *node)
0
(VALUE)&arg, rb_eval(self, node->nd_body));
0
bm_mark(struct METHOD *data)
0
@@ -10353,7 +10390,7 @@ rb_thread_schedule(void)
0
rb_bug("cross-thread violation on rb_thread_schedule()");
0
- rb_thread_pending =
0;
0
+ rb_thread_pending =
rb_thread_critical = 0;
0
if (curr_thread == curr_thread->next
0
&& curr_thread->status == THREAD_RUNNABLE)
Comments
No one has commented yet.