summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/ripper/ripper_init.c.tmpl31
-rw-r--r--parse.y33
2 files changed, 31 insertions, 33 deletions
diff --git a/ext/ripper/ripper_init.c.tmpl b/ext/ripper/ripper_init.c.tmpl
index 1cd701844c..2386f54c0e 100644
--- a/ext/ripper/ripper_init.c.tmpl
+++ b/ext/ripper/ripper_init.c.tmpl
@@ -477,6 +477,37 @@ ripper_raw_value(VALUE self, VALUE obj)
{
return ULONG2NUM(obj);
}
+
+/* :nodoc: */
+static VALUE
+ripper_validate_object(VALUE self, VALUE x)
+{
+ if (x == Qfalse) return x;
+ if (x == Qtrue) return x;
+ if (NIL_P(x)) return x;
+ if (UNDEF_P(x))
+ rb_raise(rb_eArgError, "Qundef given");
+ if (FIXNUM_P(x)) return x;
+ if (SYMBOL_P(x)) return x;
+ switch (BUILTIN_TYPE(x)) {
+ case T_STRING:
+ case T_OBJECT:
+ case T_ARRAY:
+ case T_BIGNUM:
+ case T_FLOAT:
+ case T_COMPLEX:
+ case T_RATIONAL:
+ 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
#ifdef UNIVERSAL_PARSER
diff --git a/parse.y b/parse.y
index 95ba962943..b8f03b5473 100644
--- a/parse.y
+++ b/parse.y
@@ -16549,39 +16549,6 @@ rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr)
#endif
#ifdef RIPPER
-#ifdef RIPPER_DEBUG
-/* :nodoc: */
-static VALUE
-ripper_validate_object(VALUE self, VALUE x)
-{
- if (x == Qfalse) return x;
- if (x == Qtrue) return x;
- if (NIL_P(x)) return x;
- if (UNDEF_P(x))
- rb_raise(rb_eArgError, "Qundef given");
- if (FIXNUM_P(x)) return x;
- if (SYMBOL_P(x)) return x;
- switch (BUILTIN_TYPE(x)) {
- case T_STRING:
- case T_OBJECT:
- case T_ARRAY:
- case T_BIGNUM:
- case T_FLOAT:
- case T_COMPLEX:
- case T_RATIONAL:
- 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
-
#define validate(x) ((x) = (x) == rb_ripper_none ? Qnil : x)
static VALUE