diff options
Diffstat (limited to 'lib/B')
-rw-r--r-- | lib/B/Deparse-core.t | 41 | ||||
-rw-r--r-- | lib/B/Deparse.t | 13 | ||||
-rw-r--r-- | lib/B/Op_private.pm | 7 |
3 files changed, 39 insertions, 22 deletions
diff --git a/lib/B/Deparse-core.t b/lib/B/Deparse-core.t index 981c74e673..b97cc71327 100644 --- a/lib/B/Deparse-core.t +++ b/lib/B/Deparse-core.t @@ -36,11 +36,10 @@ BEGIN { use strict; use Test::More; -plan tests => 4006; +plan tests => 3886; use feature (sprintf(":%vd", $^V)); # to avoid relying on the feature # logic to add CORE:: -no warnings 'experimental::autoderef'; use B::Deparse; my $deparse = new B::Deparse; @@ -103,7 +102,6 @@ sub testit { unless ($got_text =~ / package (?:lexsub)?test; - BEGIN \{\$\{\^WARNING_BITS} = "[^"]*"} use strict 'refs', 'subs'; use feature [^\n]+ \Q$vars\E\(\) = (.*) @@ -252,6 +250,7 @@ testit do => 'do { 1 };', "do {\n 1\n };"; testit each => 'CORE::each %bar;'; +testit each => 'CORE::each @foo;'; testit eof => 'CORE::eof();'; @@ -271,17 +270,32 @@ testit glob => 'CORE::glob $a;', 'CORE::glob($a);'; testit grep => 'CORE::grep { $a } $b, $c', 'grep({$a;} $b, $c);'; testit keys => 'CORE::keys %bar;'; +testit keys => 'CORE::keys @bar;'; testit map => 'CORE::map { $a } $b, $c', 'map({$a;} $b, $c);'; testit not => '3 unless CORE::not $a && $b;'; +testit pop => 'CORE::pop @foo;'; + +testit push => 'CORE::push @foo;', 'CORE::push(@foo);'; +testit push => 'CORE::push @foo, 1;', 'CORE::push(@foo, 1);'; +testit push => 'CORE::push @foo, 1, 2;', 'CORE::push(@foo, 1, 2);'; + testit readline => 'CORE::readline $a . $b;'; testit readpipe => 'CORE::readpipe $a + $b;'; testit reverse => 'CORE::reverse sort(@foo);'; +testit shift => 'CORE::shift @foo;'; + +testit splice => q{CORE::splice @foo;}, q{CORE::splice(@foo);}; +testit splice => q{CORE::splice @foo, 0;}, q{CORE::splice(@foo, 0);}; +testit splice => q{CORE::splice @foo, 0, 1;}, q{CORE::splice(@foo, 0, 1);}; +testit splice => q{CORE::splice @foo, 0, 1, 'a';}, q{CORE::splice(@foo, 0, 1, 'a');}; +testit splice => q{CORE::splice @foo, 0, 1, 'a', 'b';}, q{CORE::splice(@foo, 0, 1, 'a', 'b');}; + # note that the test does '() = split...' which is why the # limit is optimised to 1 testit split => 'split;', q{split(' ', $_, 1);}; @@ -298,7 +312,12 @@ testit sub => 'CORE::sub { $a, $b }', testit system => 'CORE::system($foo $bar);'; +testit unshift => 'CORE::unshift @foo;', 'CORE::unshift(@foo);'; +testit unshift => 'CORE::unshift @foo, 1;', 'CORE::unshift(@foo, 1);'; +testit unshift => 'CORE::unshift @foo, 1, 2;', 'CORE::unshift(@foo, 1, 2);'; + testit values => 'CORE::values %bar;'; +testit values => 'CORE::values @foo;'; # XXX These are deparsed wrapped in parens. @@ -463,7 +482,7 @@ defined 01 $+ die @ p1 # do handled specially # dump handled specially -each 1 - # also tested specially +# each handled specially endgrent 0 - endhostent 0 - endnetent 0 - @@ -522,7 +541,7 @@ index 23 p int 01 $ ioctl 3 p join 13 p -keys 1 - # also tested specially +# keys handled specially kill 123 p # last handled specially lc 01 $ @@ -555,12 +574,12 @@ ord 01 $ our 123 p+ # skip with 0 args, as our() => () pack 123 p pipe 2 p -pop 01 1 +pop 0 1 # also tested specially pos 01 $+ print @ p$+ printf @ p$+ prototype 1 + -push 123 p +# push handled specially quotemeta 01 $ rand 01 - read 34 p @@ -601,7 +620,7 @@ setprotoent 1 - setpwent 0 - setservent 1 - setsockopt 4 p -shift 01 1 +shift 0 1 # also tested specially shmctl 3 p shmget 3 p shmread 4 p @@ -613,7 +632,7 @@ socket 4 p socketpair 5 p sort @ p1+ # split handled specially -splice 12345 p +# splice handled specially sprintf 123 p sqrt 01 $ srand 01 - @@ -642,10 +661,10 @@ umask 01 - undef 01 + unlink @ p$ unpack 12 p$ -unshift 1 p +# unshift handled specially untie 1 - utime @ p1 -values 1 - # also tested specially +# values handled specially vec 3 p wait 0 - waitpid 2 p diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 2fb5b7580c..b4874a4a62 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -1365,6 +1365,7 @@ tr/a/b/r + $a =~ tr/p/q/r; <a,>; #### # [perl #91008] +# SKIP ?$] >= 5.023 && "autoderef deleted in this Perl version" # CONTEXT no warnings 'experimental::autoderef'; each $@; keys $~; @@ -1871,12 +1872,12 @@ my sub f {} print f(); >>>> use feature 'lexical_subs'; -BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x55\x01"} +BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x55"} my sub f { - BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x01"} + BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55"} } -BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x01"} +BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55"} print f(); #### # SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version" @@ -1887,13 +1888,13 @@ state sub f {} print f(); >>>> use feature 'lexical_subs'; -BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x55\x01"} +BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x55"} CORE::state sub f { - BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x01"} + BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55"} use feature 'state'; } -BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x01"} +BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55"} use feature 'state'; print f(); #### diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm index 512f66a541..c9db867f05 100644 --- a/lib/B/Op_private.pm +++ b/lib/B/Op_private.pm @@ -137,7 +137,7 @@ $bits{$_}{6} = 'OPpLVAL_DEFER' for qw(aelem helem multideref); $bits{$_}{7} = 'OPpLVAL_INTRO' for qw(aelem aslice cond_expr delete enteriter entersub gvsv helem hslice list lvavref lvref lvrefslice multideref padav padhv padrange padsv pushmark refassign rv2av rv2gv rv2hv rv2sv); $bits{$_}{2} = 'OPpLVREF_ELEM' for qw(lvref refassign); $bits{$_}{3} = 'OPpLVREF_ITER' for qw(lvref refassign); -$bits{$_}{3} = 'OPpMAYBE_LVSUB' for qw(aassign aelem aslice av2arylen helem hslice keys kvaslice kvhslice multideref padav padhv pos rkeys rv2av rv2gv rv2hv substr vec); +$bits{$_}{3} = 'OPpMAYBE_LVSUB' for qw(aassign aelem aslice av2arylen helem hslice keys kvaslice kvhslice multideref padav padhv pos rv2av rv2gv rv2hv substr vec); $bits{$_}{4} = 'OPpMAYBE_TRUEBOOL' for qw(padhv rv2hv); $bits{$_}{7} = 'OPpOFFBYONE' for qw(caller runcv wantarray); $bits{$_}{5} = 'OPpOPEN_IN_CRLF' for qw(backtick open); @@ -452,7 +452,6 @@ $bits{prototype}{0} = $bf[0]; $bits{quotemeta}{0} = $bf[0]; @{$bits{rand}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]); $bits{range}{0} = $bf[0]; -$bits{reach}{0} = $bf[0]; @{$bits{read}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]); $bits{readdir}{0} = $bf[0]; $bits{readline}{0} = $bf[0]; @@ -473,14 +472,12 @@ $bits{require}{0} = $bf[0]; $bits{rewinddir}{0} = $bf[0]; @{$bits{right_shift}}{1,0} = ($bf[1], $bf[1]); @{$bits{rindex}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]); -$bits{rkeys}{0} = $bf[0]; $bits{rmdir}{0} = $bf[0]; $bits{rv2av}{0} = $bf[0]; @{$bits{rv2cv}}{7,5,0} = ('OPpENTERSUB_NOPAREN', 'OPpMAY_RETURN_CONSTANT', $bf[0]); @{$bits{rv2gv}}{6,5,4,2,0} = ('OPpALLOW_FAKE', $bf[6], $bf[6], 'OPpDONT_INIT_GV', $bf[0]); $bits{rv2hv}{0} = $bf[0]; @{$bits{rv2sv}}{5,4,0} = ($bf[6], $bf[6], $bf[0]); -$bits{rvalues}{0} = $bf[0]; @{$bits{sassign}}{7,6,1,0} = ('OPpASSIGN_CV_TO_GV', 'OPpASSIGN_BACKWARDS', $bf[1], $bf[1]); @{$bits{sbit_and}}{1,0} = ($bf[1], $bf[1]); @{$bits{sbit_or}}{1,0} = ($bf[1], $bf[1]); @@ -775,7 +772,7 @@ our %ops_using = ( OPpLVAL_DEFER => [qw(aelem helem multideref)], OPpLVAL_INTRO => [qw(aelem aslice cond_expr delete enteriter entersub gvsv helem hslice list lvavref lvref lvrefslice multideref padav padhv padrange padsv pushmark refassign rv2av rv2gv rv2hv rv2sv)], OPpLVREF_ELEM => [qw(lvref refassign)], - OPpMAYBE_LVSUB => [qw(aassign aelem aslice av2arylen helem hslice keys kvaslice kvhslice multideref padav padhv pos rkeys rv2av rv2gv rv2hv substr vec)], + OPpMAYBE_LVSUB => [qw(aassign aelem aslice av2arylen helem hslice keys kvaslice kvhslice multideref padav padhv pos rv2av rv2gv rv2hv substr vec)], OPpMAYBE_TRUEBOOL => [qw(padhv rv2hv)], OPpMULTIDEREF_DELETE => [qw(multideref)], OPpOFFBYONE => [qw(caller runcv wantarray)], |