diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-08-17 12:32:33 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-08-18 06:50:20 -0700 |
commit | 7fa5bd9b5ba9d950fb8f72ee787a1d83167753b8 (patch) | |
tree | beccb6e9ced69d5de10f575ef585abada67c8db8 /MANIFEST | |
parent | deb8a388bf9e4429400eaf01ad745964d9d291d2 (diff) | |
download | perl-7fa5bd9b5ba9d950fb8f72ee787a1d83167753b8.tar.gz |
&CORE::foo() for nullary functions
This commit makes nullary subs in the CORE package callable with
ampersand syntax and through references--except for wantarray, which
is more complicated and will have its own commit.
It does this by creating an op tree like this:
$ ./perl -Ilib -MO=Concise,CORE::times -e 'BEGIN{\&CORE::times}'
CORE::times:
3 <1> leavesub[1 ref] K/REFC,1 ->(end)
- <@> lineseq K ->3
1 <$> coreargs(IV 310) v ->2
2 <0> tms ->3
-e syntax OK
The coreargs op checks to make sure there are no arguments, for now.
The 310 is the op number for times (OP_TMS).
There is no nextstate op, because we want to inherit hints from
the caller.
The __FILE__, __LINE__ and __PACKAGE__ directives are implemented
like this:
$ ./perl -Ilib -MO=Concise,CORE::__FILE__ -e 'BEGIN{\&CORE::__FILE__}'
CORE::__FILE__:
7 <1> leavesub[1 ref] K/REFC,1 ->(end)
- <@> lineseq K ->7
1 <$> coreargs(PV "__FILE__") v ->2
6 <2> lslice K/2 ->7
- <1> ex-list lK ->4
2 <0> pushmark s ->3
3 <$> const(IV 1) s ->4
- <1> ex-list lK ->6
4 <0> pushmark s ->5
5 <0> caller[t1] l ->6
-e syntax OK
The lslice op and its children are equivalent to (caller)[1].
Diffstat (limited to 'MANIFEST')
-rw-r--r-- | MANIFEST | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -4918,6 +4918,7 @@ t/op/concat.t See if string concatenation works t/op/cond.t See if conditional expressions work t/op/context.t See if context propagation works t/op/coreinline.t Test inlining of \&CORE::subs +t/op/coresubs.t Test &CORE::subs() t/op/cproto.t Check builtin prototypes t/op/crypt.t See if crypt works t/op/dbm.t See if dbmopen/dbmclose work |