mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Assert correct types in get_id_serial_entry
This commit is contained in:
parent
a80e8ba1c4
commit
43dcf4d1a6
1 changed files with 13 additions and 0 deletions
13
symbol.c
13
symbol.c
|
@ -481,6 +481,19 @@ get_id_serial_entry(rb_id_serial_t num, ID id, const enum id_entry_type t)
|
|||
}
|
||||
GLOBAL_SYMBOLS_LEAVE();
|
||||
|
||||
if (result) {
|
||||
switch (t) {
|
||||
case ID_ENTRY_STR:
|
||||
RUBY_ASSERT(BUILTIN_TYPE(result) == T_STRING);
|
||||
break;
|
||||
case ID_ENTRY_SYM:
|
||||
RUBY_ASSERT(SYMBOL_P(result));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue