Skip to content

Commit f42dd5f

Browse files
committed
op_dump:(): display RCLASS on METHOD ops
Some types of method call have a redirect class in addition to the method name, e.g. $obj->BAR::foo(). This value 'BAR' wasn't being displayed by op_dump(). So this commit makes it do so. I also took the opportunity to add comments to the various OP_METHOD_FOO cases to identify what sort of method calls it handled, and added a stub OP_METHOD case rather than it just being handled by the default branch. This is to make it clearer that OP_METHOD *does* exist, but it doesn't have any values (like 'foo' or 'BAR') which need dumping.
1 parent 218fccc commit f42dd5f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

dump.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,15 +1399,25 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o)
13991399
#endif
14001400
break;
14011401

1402-
case OP_METHOD_NAMED:
1403-
case OP_METHOD_SUPER:
1404-
case OP_METHOD_REDIR:
1405-
case OP_METHOD_REDIR_SUPER:
1402+
case OP_METHOD: /* $obj->$foo */
1403+
break;
1404+
1405+
case OP_METHOD_NAMED: /* $obj->foo */
1406+
case OP_METHOD_SUPER: /* $obj->SUPER::foo */
1407+
case OP_METHOD_REDIR: /* $obj->BAR::foo */
1408+
case OP_METHOD_REDIR_SUPER: /* $obj->BAR::SUPER::foo */
14061409
#ifndef USE_ITHREADS
14071410
/* with ITHREADS, consts are stored in the pad, and the right pad
14081411
* may not be active here, so skip */
1412+
/* display method name (e.g. 'foo') */
14091413
S_opdump_indent(aTHX_ o, level, bar, file, "SV = %s\n",
14101414
SvPEEK(cMETHOPo_meth));
1415+
1416+
/* display redirect class (e.g. 'BAR') */
1417+
if (optype == OP_METHOD_REDIR || optype == OP_METHOD_REDIR_SUPER) {
1418+
S_opdump_indent(aTHX_ o, level, bar, file, "RCLASS = %s\n",
1419+
SvPEEK(cMETHOPo_rclass));
1420+
}
14111421
#endif
14121422
break;
14131423

0 commit comments

Comments
 (0)