Project

General

Profile

Backport #1962 ยป Array.patch

oggy (George Ogata), 08/20/2009 02:51 PM

View differences:

eval.c (working copy)
2854 2854
    if (NIL_P(tmp)) {
2855 2855
	/* hack to avoid invoke Object#to_a */
2856 2856
	VALUE origin;
2857
	const NODE *body;
2857 2858
	ID id = rb_intern("to_a");
2858 2859

  
2859
	if (search_method(CLASS_OF(val), id, &origin) &&
2860
	if ((body = search_method(CLASS_OF(val), id, &origin)) &&
2861
	    body->nd_body &&  /* not an undef'd method */
2860 2862
	    RCLASS(origin)->m_tbl != RCLASS(rb_mKernel)->m_tbl) { /* exclude Kernel#to_a */
2861 2863
	    val = rb_funcall(val, id, 0);
2862 2864
	    if (TYPE(val) != T_ARRAY) {