1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: check for symbol

* parse.y (rb_sym2id, rb_sym2id_without_pindown): return 0 for
  non-symbol values, for the time being.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-04-24 02:21:38 +00:00
parent 313e34b461
commit 34c35bf107
2 changed files with 13 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Thu Apr 24 11:21:37 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (rb_sym2id, rb_sym2id_without_pindown): return 0 for
non-symbol values, for the time being.
Thu Apr 24 05:50:13 2014 NARUSE, Yui <naruse@ruby-lang.org>
* parse.y (dsym_node_gen): like r45492, call rb_gc_resurrect().

10
parse.y
View file

@ -10774,9 +10774,12 @@ rb_sym2id(VALUE x)
if (STATIC_SYM_P(x)) {
return RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT);
}
else {
else if (!SPECIAL_CONST_P(x) && BUILTIN_TYPE(x) == T_SYMBOL) {
return rb_pin_dynamic_symbol(x);
}
else {
return 0;
}
}
ID
@ -10785,9 +10788,12 @@ rb_sym2id_without_pindown(VALUE x)
if (STATIC_SYM_P(x)) {
return RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT);
}
else {
else if (!SPECIAL_CONST_P(x) && BUILTIN_TYPE(x) == T_SYMBOL) {
return (ID)x;
}
else {
return 0;
}
}
VALUE