mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Assert that rb_sym2str returns 0 or a T_STRING
This commit is contained in:
parent
e50590a541
commit
37490474c4
1 changed files with 7 additions and 2 deletions
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…
Add table
Add a link
Reference in a new issue