2000-01-18

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-01-18 06:09:05 +00:00
parent dde62bcd2e
commit e5ed1780af
7 changed files with 26 additions and 51 deletions

View File

@ -1,3 +1,7 @@
Tue Jan 18 12:24:28 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* struct.c (Init_Struct): remove Struct's own hash and eql?.
Sat Jan 15 22:21:08 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* eval.c (search_method): argument klass may be 0.

View File

@ -1301,11 +1301,12 @@ rb_ary_hash(ary)
VALUE ary;
{
long i;
int h;
int n, h;
h = RARRAY(ary)->len;
for (i=0; i<RARRAY(ary)->len; i++) {
int n = rb_hash(RARRAY(ary)->ptr[i]);
h = (h<<1) | (h<0 ? 1 : 0);
n = rb_hash(RARRAY(ary)->ptr[i]);
h ^= NUM2LONG(n);
}
return INT2FIX(h);

View File

@ -179,7 +179,8 @@ The variable ruby-indent-level controls the amount of indentation.
(back-to-indentation)
(setq top (current-column))
(skip-chars-backward " \t")
(if (>= shift top) (setq shift (- shift top)))
(if (>= shift top) (setq shift (- shift top))
(setq shift 0))
(if (and (bolp)
(= x top))
(move-to-column (+ x shift))

View File

@ -58,18 +58,11 @@ rb_obj_equal(obj1, obj2)
return Qfalse;
}
static VALUE
rb_any_to_a(obj)
VALUE obj;
{
return rb_ary_new3(1, obj);
}
static VALUE
rb_obj_hash(obj)
VALUE obj;
{
return (long)obj|FIXNUM_FLAG;
return ((long)obj)|FIXNUM_FLAG;
}
VALUE
@ -121,6 +114,13 @@ rb_obj_dup(obj)
return rb_funcall(obj, rb_intern("clone"), 0, 0);
}
static VALUE
rb_any_to_a(obj)
VALUE obj;
{
return rb_ary_new3(1, obj);
}
VALUE
rb_any_to_s(obj)
VALUE obj;

View File

@ -343,7 +343,7 @@ ok(($x * 5).join(":") == '1:1:1:1:1')
ok(($x * 1).join(":") == '1')
ok(($x * 0).join(":") == '')
*$x = 1..7
*$x = (1..7).to_a
ok($x.size == 7)
ok($x == [1, 2, 3, 4, 5, 6, 7])
@ -716,8 +716,11 @@ ok(a == 1 && b == 2 && c == 3 && d == 4)
*a = 1, 2, 3
ok(a == [1, 2, 3])
*a = 1..3 # array conversion
ok(a == [1, 2, 3])
*a = 4
ok(a == [4])
*a = nil
ok(a == [])
check "call"
def aaa(a, b=100, *rest)
@ -1042,7 +1045,7 @@ test = struct_test.new(1, 2)
ok(test.foo == 1 && test.bar == 2)
ok(test[0] == 1 && test[1] == 2)
a, b = test
a, b = test.to_a
ok(a == 1 && b == 2)
test[0] = 22

View File

@ -523,38 +523,6 @@ rb_struct_equal(s, s2)
return Qtrue;
}
static VALUE
rb_struct_eql(s, s2)
VALUE s, s2;
{
long i;
if (TYPE(s2) != T_STRUCT) return Qfalse;
if (CLASS_OF(s) != CLASS_OF(s2)) return Qfalse;
if (RSTRUCT(s)->len != RSTRUCT(s2)->len) {
rb_bug("inconsistent struct"); /* should never happen */
}
for (i=0; i<RSTRUCT(s)->len; i++) {
if (!rb_eql(RSTRUCT(s)->ptr[i], RSTRUCT(s2)->ptr[i])) return Qfalse;
}
return Qtrue;
}
static VALUE
rb_struct_hash(s)
VALUE s;
{
long i;
int h;
h = CLASS_OF(s);
for (i=0; i<RSTRUCT(s)->len; i++) {
h ^= rb_hash(RSTRUCT(s)->ptr[i]);
}
return INT2FIX(h);
}
static VALUE
rb_struct_size(s)
VALUE s;
@ -574,8 +542,6 @@ Init_Struct()
rb_define_method(rb_cStruct, "clone", rb_struct_clone, 0);
rb_define_method(rb_cStruct, "==", rb_struct_equal, 1);
rb_define_method(rb_cStruct, "eql?", rb_struct_eql, 1);
rb_define_method(rb_cStruct, "hash", rb_struct_hash, 0);
rb_define_method(rb_cStruct, "to_s", rb_struct_to_s, 0);
rb_define_method(rb_cStruct, "inspect", rb_struct_inspect, 0);

View File

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.2"
#define RUBY_RELEASE_DATE "2000-01-17"
#define RUBY_RELEASE_DATE "2000-01-18"
#define RUBY_VERSION_CODE 152
#define RUBY_RELEASE_CODE 20000117
#define RUBY_RELEASE_CODE 20000118