123456789_123456789_123456789_123456789_123456789_

Class: Object

Relationships & Source Files
Inherits: BasicObject
Defined in: parse.y

Instance Method Summary

Instance Method Details

#assert_Qundef(obj, msg)

This method is for internal use only.
[ GitHub ]

  
# File 'parse.y', line 12277

static VALUE
ripper_assert_Qundef(VALUE self, VALUE obj, VALUE msg)
{
    StringValue(msg);
    if (obj == Qundef) {
        rb_raise(rb_eArgError, "%"PRIsVALUE, msg);
    }
    return Qnil;
}

#rawVALUE(obj)

This method is for internal use only.
[ GitHub ]

  
# File 'parse.y', line 12288

static VALUE
ripper_value(VALUE self, VALUE obj)
{
    return ULONG2NUM(obj);
}

#validate_object(x)

This method is for internal use only.
[ GitHub ]

  
# File 'parse.y', line 11922

static VALUE
ripper_validate_object(VALUE self, VALUE x)
{
    if (x == Qfalse) return x;
    if (x == Qtrue) return x;
    if (x == Qnil) return x;
    if (x == Qundef)
        rb_raise(rb_eArgError, "Qundef given");
    if (FIXNUM_P(x)) return x;
    if (SYMBOL_P(x)) return x;
    if (!rb_is_pointer_to_heap(x))
        rb_raise(rb_eArgError, "invalid pointer: %p", 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:
        return x;
      case T_NODE:
	if (nd_type(x) != NODE_RIPPER) {
	    rb_raise(rb_eArgError, "NODE given: %p", x);
	}
	return ((NODE *)x)->nd_rval;
      default:
        rb_raise(rb_eArgError, "wrong type of ruby object: %p (%s)",
                 x, rb_obj_classname(x));
    }
    return x;
}