summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--eval.c8
-rw-r--r--numeric.c2
3 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 942085036e6..800e806db8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
Mon May 17 12:26:31 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * numeric.c (fix_rev): should treat Fixnum as signed long.
+
+ * eval.c (massign): add strict number check for yield (and call).
+
+ * eval.c (proc_arity): new method to return number of arguments.
+
+ * eval.c (method_arity): new method to return number of arguments.
+
* parse.y (read_escape): char may be unsigned.
* string.c (rb_str_succ): ditto.
diff --git a/eval.c b/eval.c
index 46bf5fe9a0b..8b27fe110b4 100644
--- a/eval.c
+++ b/eval.c
@@ -5523,10 +5523,10 @@ proc_arity(proc)
int n;
Data_Get_Struct(proc, struct BLOCK, data);
- if (data->var == 0) return 0;
+ if (data->var == 0) return FIX2INT(-1);
switch (nd_type(data->var)) {
default:
- return INT2FIX(-1);
+ return INT2FIX(-2);
case NODE_MASGN:
list = data->var->nd_head;
n = 0;
@@ -5534,7 +5534,7 @@ proc_arity(proc)
n++;
list = list->nd_next;
}
- if (data->var->nd_args) return INT2FIX(-n);
+ if (data->var->nd_args) return INT2FIX(-n-1);
return INT2FIX(n);
}
}
@@ -5717,7 +5717,7 @@ method_arity(method)
body = body->nd_head;
if (!body) return INT2FIX(0);
n = body->nd_cnt;
- if (body->nd_rest) n = -n;
+ if (body->nd_rest) n = -n-1;
return INT2FIX(n);
}
}
diff --git a/numeric.c b/numeric.c
index 102665f8dff..91d5c97edba 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1100,7 +1100,7 @@ static VALUE
fix_rev(num)
VALUE num;
{
- unsigned long val = FIX2ULONG(num);
+ long val = FIX2LONG(num);
val = ~val;
return rb_int2inum(val);