Backport #1962 ยป Array.patch
eval.c (working copy) | ||
---|---|---|
if (NIL_P(tmp)) {
|
||
/* hack to avoid invoke Object#to_a */
|
||
VALUE origin;
|
||
const NODE *body;
|
||
ID id = rb_intern("to_a");
|
||
if (search_method(CLASS_OF(val), id, &origin) &&
|
||
if ((body = search_method(CLASS_OF(val), id, &origin)) &&
|
||
body->nd_body && /* not an undef'd method */
|
||
RCLASS(origin)->m_tbl != RCLASS(rb_mKernel)->m_tbl) { /* exclude Kernel#to_a */
|
||
val = rb_funcall(val, id, 0);
|
||
if (TYPE(val) != T_ARRAY) {
|