From: Vincent Pit Date: Mon, 20 Oct 2014 21:39:48 +0000 (-0200) Subject: Add support for METHOP ops X-Git-Tag: rt99319 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=commitdiff_plain;h=refs%2Ftags%2Frt99319 Add support for METHOP ops This new op class has been introduced with perl commit b46e009d9, which was published with perl 5.21.5. This fixes RT #99319. --- diff --git a/Magic.xs b/Magic.xs index 95d7282..9a07ac5 100644 --- a/Magic.xs +++ b/Magic.xs @@ -349,6 +349,9 @@ typedef enum { OPc_PVOP, OPc_LOOP, OPc_COP, +#if VMG_HAS_PERL(5, 21, 5) + OPc_METHOP, +#endif OPc_MAX } opclass; @@ -364,7 +367,11 @@ STATIC const char *const vmg_opclassnames[] = { "B::PADOP", "B::PVOP", "B::LOOP", - "B::COP" + "B::COP", +#if VMG_HAS_PERL(5, 21, 5) + "B::METHOP", +#endif + NULL }; STATIC opclass vmg_opclass(const OP *o) { @@ -436,6 +443,10 @@ STATIC opclass vmg_opclass(const OP *o) { return OPc_BASEOP; else return OPc_PVOP; +#if VMG_HAS_PERL(5, 21, 5) + case OA_METHOP: + return OPc_METHOP; +#endif } return OPc_BASEOP; diff --git a/t/18-opinfo.t b/t/18-opinfo.t index 70b5f74..0293c64 100644 --- a/t/18-opinfo.t +++ b/t/18-opinfo.t @@ -20,6 +20,7 @@ my $aelem = "$]" <= 5.008_003 ? 'aelem' my $aelemf = ("$]" < 5.013 or $is_5130_release) ? 'aelemfast' : 'sassign'; my $aelemf_op = $aelemf eq 'sassign' ? 'B::BINOP' : $Config{useithreads} ? 'B::PADOP' : 'B::SVOP'; +my $meth_op = ("$]" < 5.021_005) ? 'B::SVOP' : 'B::METHOP'; our @o; @@ -39,7 +40,7 @@ my @tests = ( [ 'bless', 'B::LISTOP' ] ], [ 'get', '$c', 'my $c = ""','$c =~ /x/', [ 'match', 'B::PMOP' ] ], [ 'get', '$c', 'my $c = "Variable::Magic::TestPkg"', - '$c->foo()', [ 'method_named', 'B::SVOP' ] ], + '$c->foo()', [ 'method_named', $meth_op ] ], [ 'get', '$c', 'my $c = ""','$c =~ y/x/y/', [ 'trans', 'B::PVOP' ] ], [ 'get', '$c', 'my $c = 1', '1 for 1 .. $c', [ 'enteriter', 'B::LOOP' ] ],