* string.c (Init_String): undef Symbol#new.
* struct.c (rb_struct_s_def): wrong symbol detection. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d064c0bf13
commit
10a0dea1f5
@ -1,3 +1,9 @@
|
|||||||
|
Sat Sep 2 23:59:58 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (Init_String): undef Symbol#new.
|
||||||
|
|
||||||
|
* struct.c (rb_struct_s_def): wrong symbol detection.
|
||||||
|
|
||||||
Sat Sep 2 23:59:37 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Sat Sep 2 23:59:37 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (str_to_id): a bug caused by premature optimization.
|
* string.c (str_to_id): a bug caused by premature optimization.
|
||||||
|
4
string.c
4
string.c
@ -4407,7 +4407,6 @@ rb_str_setter(VALUE val, ID id, VALUE *var)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* Symbol.new(str) => new_sym
|
|
||||||
* Symbol.intern(str) => new_sym
|
* Symbol.intern(str) => new_sym
|
||||||
*
|
*
|
||||||
* Returns a new symbol corresponding to <i>str</i>.
|
* Returns a new symbol corresponding to <i>str</i>.
|
||||||
@ -4699,9 +4698,10 @@ Init_String(void)
|
|||||||
rb_define_variable("$-F", &rb_fs);
|
rb_define_variable("$-F", &rb_fs);
|
||||||
|
|
||||||
rb_cSymbol = rb_define_class("Symbol", rb_cString);
|
rb_cSymbol = rb_define_class("Symbol", rb_cString);
|
||||||
|
rb_undef_alloc_func(rb_cSymbol);
|
||||||
|
rb_undef_method(CLASS_OF(rb_cSymbol), "new");
|
||||||
rb_define_singleton_method(rb_cSymbol, "all_symbols", rb_sym_all_symbols, 0); /* in parse.y */
|
rb_define_singleton_method(rb_cSymbol, "all_symbols", rb_sym_all_symbols, 0); /* in parse.y */
|
||||||
rb_define_singleton_method(rb_cSymbol, "intern", rb_sym_s_intern, 1);
|
rb_define_singleton_method(rb_cSymbol, "intern", rb_sym_s_intern, 1);
|
||||||
rb_define_singleton_method(rb_cSymbol, "new", rb_sym_s_intern, 1);
|
|
||||||
|
|
||||||
rb_define_method(rb_cSymbol, "to_i", sym_to_i, 0);
|
rb_define_method(rb_cSymbol, "to_i", sym_to_i, 0);
|
||||||
rb_define_method(rb_cSymbol, "inspect", sym_inspect, 0);
|
rb_define_method(rb_cSymbol, "inspect", sym_inspect, 0);
|
||||||
|
9
struct.c
9
struct.c
@ -282,15 +282,10 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
|
|||||||
id = rb_to_id(RARRAY_PTR(rest)[i]);
|
id = rb_to_id(RARRAY_PTR(rest)[i]);
|
||||||
RARRAY_PTR(rest)[i] = ID2SYM(id);
|
RARRAY_PTR(rest)[i] = ID2SYM(id);
|
||||||
}
|
}
|
||||||
if (!NIL_P(name)) {
|
if (!NIL_P(name) && SYMBOL_P(name)) {
|
||||||
VALUE tmp = rb_check_string_type(name);
|
rb_ary_unshift(rest, name);
|
||||||
|
|
||||||
if (NIL_P(tmp)) {
|
|
||||||
id = rb_to_id(name);
|
|
||||||
rb_ary_unshift(rest, ID2SYM(id));
|
|
||||||
name = Qnil;
|
name = Qnil;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
st = make_struct(name, rest, klass);
|
st = make_struct(name, rest, klass);
|
||||||
if (rb_block_given_p()) {
|
if (rb_block_given_p()) {
|
||||||
rb_mod_module_eval(0, 0, st);
|
rb_mod_module_eval(0, 0, st);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user