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

Ripper#validate_object: check if the object is hidden

This commit is contained in:
Nobuyoshi Nakada 2019-07-19 07:55:40 +09:00
parent 0b826418af
commit fd461dea06
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -12498,16 +12498,21 @@ ripper_validate_object(VALUE self, VALUE x)
case T_FLOAT:
case T_COMPLEX:
case T_RATIONAL:
return x;
break;
case T_NODE:
if (nd_type((NODE *)x) != NODE_RIPPER) {
rb_raise(rb_eArgError, "NODE given: %p", (void *)x);
}
return ((NODE *)x)->nd_rval;
x = ((NODE *)x)->nd_rval;
break;
default:
rb_raise(rb_eArgError, "wrong type of ruby object: %p (%s)",
(void *)x, rb_obj_classname(x));
}
if (!RBASIC_CLASS(x)) {
rb_raise(rb_eArgError, "hidden ruby object: %p (%s)",
(void *)x, rb_builtin_type_name(TYPE(x)));
}
return x;
}
#endif