summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-10-17 16:07:04 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-10-17 16:07:04 +0000
commitb13fd70a68ddf5966a8175e04009af31c9841332 (patch)
tree0f36f6edc1b8a9e7c973692c254ec03aee519e90 /op.c
parentc36568be88bd894c59f9e2994c64120ffb2941bb (diff)
downloadperl-b13fd70a68ddf5966a8175e04009af31c9841332.tar.gz
First attempt at implementing the _ prototype
p4raw-id: //depot/perl@29032
Diffstat (limited to 'op.c')
-rw-r--r--op.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/op.c b/op.c
index fbe455ed22..711aa248fd 100644
--- a/op.c
+++ b/op.c
@@ -7375,6 +7375,7 @@ Perl_ck_subr(pTHX_ OP *o)
optional = 1;
proto++;
continue;
+ case '_':
case '$':
proto++;
arg++;
@@ -7533,6 +7534,12 @@ Perl_ck_subr(pTHX_ OP *o)
mod(o2, OP_ENTERSUB);
prev = o2;
o2 = o2->op_sibling;
+ if (o2 && o2->op_type == OP_NULL && proto && *proto == '_') {
+ /* generate an access to $_ */
+ o2 = newDEFSVOP();
+ o2->op_sibling = prev->op_sibling;
+ prev->op_sibling = o2; /* instead of cvop */
+ }
} /* while */
if (proto && !optional && proto_end > proto &&
(*proto != '@' && *proto != '%' && *proto != ';'))