diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-06-12 18:33:17 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-06-12 18:33:17 +0900 |
| commit | 4348639e1c608b7e6ad56f4c4f7d5bc0f9f6bd06 (patch) | |
| tree | afceb6f39105cce8a0d6401458b622d7d4eb1164 /src/kernel.c | |
| parent | b5ffbea4c2f914409465aa87d906f12b5a57972e (diff) | |
| download | mruby-4348639e1c608b7e6ad56f4c4f7d5bc0f9f6bd06.tar.gz mruby-4348639e1c608b7e6ad56f4c4f7d5bc0f9f6bd06.zip | |
raise error if string arg is given to Kernel#instance_eval
Diffstat (limited to 'src/kernel.c')
| -rw-r--r-- | src/kernel.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/kernel.c b/src/kernel.c index 49538e256..04e427327 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -557,12 +557,10 @@ mrb_obj_init_copy(mrb_state *mrb, mrb_value self) /* 15.3.1.3.18 */ /* * call-seq: - * obj.instance_eval(string [, filename [, lineno]] ) -> obj * obj.instance_eval {| | block } -> obj * - * Evaluates a string containing Ruby source code, or the given block, - * within the context of the receiver (_obj_). In order to set the - * context, the variable +self+ is set to _obj_ while + * Evaluates the given block,within the context of the receiver (_obj_). + * In order to set the context, the variable +self+ is set to _obj_ while * the code is executing, giving the code access to _obj_'s * instance variables. In the version of <code>instance_eval</code> * that takes a +String+, the optional second and third @@ -580,9 +578,11 @@ mrb_obj_init_copy(mrb_state *mrb, mrb_value self) mrb_value mrb_obj_instance_eval(mrb_state *mrb, mrb_value self) { - mrb_value b; + mrb_value a, b; - mrb_get_args(mrb, "&", &b); + if (mrb_get_args(mrb, "|S&", &a, &b) == 1) { + mrb_raise(mrb, mrb->eRuntimeError_class, "instance_eval with string not implemented"); + } return mrb_yield_with_self(mrb, b, 0, 0, self); } |
