summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-05 18:50:35 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-05 18:50:35 +0000
commita4a81019653287291f88563964d482798da6221f (patch)
treeec7c2bdf59d69e9f2b87b1c45e51977b0ed792e2 /proc.c
parent0d70d8864359e6d8c410dd2727de618ba7cc3dc7 (diff)
downloadruby-a4a81019653287291f88563964d482798da6221f.tar.gz
* proc.c: support Binding#eval.
* yarvtest/test_eval.rb: add a test for above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/proc.c b/proc.c
index f058f7251c..0e37b90e48 100644
--- a/proc.c
+++ b/proc.c
@@ -282,10 +282,13 @@ rb_f_binding(VALUE self)
*/
static VALUE
-bind_eval(int argc, VALUE *argv, VALUE bind)
+bind_eval(int argc, VALUE *argv, VALUE bindval)
{
- UNSUPPORTED(bind_eval);
- return Qnil;
+ VALUE args[4];
+
+ rb_scan_args(argc, argv, "12", &args[0], &args[2], &args[3]);
+ args[1] = bindval;
+ return rb_f_eval(argc+1, args, Qnil /* self will be searched in eval */);
}
#define PROC_TSHIFT (FL_USHIFT+1)
@@ -1584,6 +1587,7 @@ Init_Binding(void)
rb_undef_method(CLASS_OF(rb_cBinding), "new");
rb_define_method(rb_cBinding, "clone", binding_clone, 0);
rb_define_method(rb_cBinding, "dup", binding_dup, 0);
+ rb_define_method(rb_cBinding, "eval", bind_eval, -1);
rb_define_global_function("binding", rb_f_binding, 0);
}