summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-23 15:01:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-23 15:01:13 +0000
commitcdf8817d0eddd274762c2bf3731b12eca408e99a (patch)
treea830a9502712da8b5cbcaff47a2d5faff49aea4f
parentb97d73ae3db8d4d5dcfdbd01d9b39a3a71153638 (diff)
downloadruby-cdf8817d0eddd274762c2bf3731b12eca408e99a.tar.gz
ruby-cdf8817d0eddd274762c2bf3731b12eca408e99a.tar.xz
ruby-cdf8817d0eddd274762c2bf3731b12eca408e99a.zip
* eval.c (method_call): check receiver is defined.
* eval.c (umethod_call): removed. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--eval.c17
2 files changed, 10 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 93b7477cd..d502825b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Aug 23 23:59:57 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (method_call): check receiver is defined.
+
+ * eval.c (umethod_call): removed.
+
Fri Aug 23 17:06:48 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* configure.in: RUBY_SO_NAME is msvcrt-rubyXX on mswin32/mingw32.
diff --git a/eval.c b/eval.c
index dc88795fc..54b6ee0d0 100644
--- a/eval.c
+++ b/eval.c
@@ -6914,6 +6914,9 @@ method_call(argc, argv, method)
volatile int safe = ruby_safe_level;
Data_Get_Struct(method, struct METHOD, data);
+ if (data->recv == Qundef) {
+ rb_raise(rb_eTypeError, "you cannot call unbound method; bind first");
+ }
PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
PUSH_TAG(PROT_NONE);
if (OBJ_TAINTED(method) && ruby_safe_level < 4) {
@@ -6930,16 +6933,6 @@ method_call(argc, argv, method)
}
static VALUE
-umethod_call(argc, argv, method)
- int argc;
- VALUE *argv;
- VALUE method;
-{
- rb_raise(rb_eTypeError, "you cannot call unbound method; bind first");
- return Qnil; /* not reached */
-}
-
-static VALUE
umethod_bind(method, recv)
VALUE method, recv;
{
@@ -7078,7 +7071,7 @@ static VALUE
umcall(args, method)
VALUE args, method;
{
- return umethod_call(0, 0, method);
+ return method_call(0, 0, method);
}
VALUE
@@ -7212,8 +7205,6 @@ Init_Proc()
rb_define_method(rb_mKernel, "method", rb_obj_method, 1);
rb_cUnboundMethod = rb_define_class("UnboundMethod", rb_cMethod);
- rb_define_method(rb_cUnboundMethod, "call", umethod_call, -1);
- rb_define_method(rb_cUnboundMethod, "[]", umethod_call, -1);
rb_define_method(rb_cUnboundMethod, "to_proc", umethod_proc, 0);
rb_define_method(rb_cUnboundMethod, "bind", umethod_bind, 1);
rb_define_method(rb_cUnboundMethod, "unbind", umethod_unbind, 0);