зеркало из https://github.com/github/ruby.git
* 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:
Родитель
d064c0bf13
Коммит
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>
|
||||
|
||||
* 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:
|
||||
* Symbol.new(str) => new_sym
|
||||
* Symbol.intern(str) => new_sym
|
||||
*
|
||||
* Returns a new symbol corresponding to <i>str</i>.
|
||||
|
@ -4699,9 +4698,10 @@ Init_String(void)
|
|||
rb_define_variable("$-F", &rb_fs);
|
||||
|
||||
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, "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, "inspect", sym_inspect, 0);
|
||||
|
|
11
struct.c
11
struct.c
|
@ -282,14 +282,9 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
|
|||
id = rb_to_id(RARRAY_PTR(rest)[i]);
|
||||
RARRAY_PTR(rest)[i] = ID2SYM(id);
|
||||
}
|
||||
if (!NIL_P(name)) {
|
||||
VALUE tmp = rb_check_string_type(name);
|
||||
|
||||
if (NIL_P(tmp)) {
|
||||
id = rb_to_id(name);
|
||||
rb_ary_unshift(rest, ID2SYM(id));
|
||||
name = Qnil;
|
||||
}
|
||||
if (!NIL_P(name) && SYMBOL_P(name)) {
|
||||
rb_ary_unshift(rest, name);
|
||||
name = Qnil;
|
||||
}
|
||||
st = make_struct(name, rest, klass);
|
||||
if (rb_block_given_p()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче