mirror of
https://github.com/ruby/ruby.git
synced 2026-08-03 13:08:59 +08:00
Assert that rb_sym2str returns 0 or a T_STRING
This commit is contained in:
parent
e50590a541
commit
37490474c4
9
symbol.c
9
symbol.c
@ -953,12 +953,17 @@ rb_id2sym(ID x)
|
||||
VALUE
|
||||
rb_sym2str(VALUE sym)
|
||||
{
|
||||
VALUE str;
|
||||
if (DYNAMIC_SYM_P(sym)) {
|
||||
return RSYMBOL(sym)->fstr;
|
||||
str = RSYMBOL(sym)->fstr;
|
||||
RUBY_ASSERT(BUILTIN_TYPE(str) == T_STRING);
|
||||
}
|
||||
else {
|
||||
return rb_id2str(STATIC_SYM2ID(sym));
|
||||
str = rb_id2str(STATIC_SYM2ID(sym));
|
||||
RUBY_ASSERT(str == 0 || BUILTIN_TYPE(str) == T_STRING);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user