summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-07-25 23:55:41 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-07-26 00:09:04 -0700
commit1ecbeecf75755d93718667baf356b00f2037712c (patch)
tree046768dd078e21ca3ac778364ab190fef2120fb8 /op.c
parent7de68bd5ba804db7c26eb42d7496401202a00b80 (diff)
downloadperl-1ecbeecf75755d93718667baf356b00f2037712c.tar.gz
core_prototype: Remove special cases for lock and tie
core_prototype now calls scalar_mod_type in the OA_SCALARREF case. For core functions, the only thing distinguishing the \$ and \[$@%*] cases during parsing is the call to scalar_mod_type in op_lvalue_flags. So calling this same function here just works.
Diffstat (limited to 'op.c')
-rw-r--r--op.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/op.c b/op.c
index 5b39492091..d44b6a2555 100644
--- a/op.c
+++ b/op.c
@@ -1781,7 +1781,7 @@ Perl_mod(pTHX_ OP *o, I32 type)
STATIC bool
S_scalar_mod_type(const OP *o, I32 type)
{
- PERL_ARGS_ASSERT_SCALAR_MOD_TYPE;
+ assert(o || type != OP_SASSIGN);
switch (type) {
case OP_SASSIGN:
@@ -10236,10 +10236,6 @@ Perl_core_prototype(pTHX_ SV *sv, const char *name, const STRLEN len,
retsetpvs(";+");
case KEY_splice:
retsetpvs("+;$$@");
- case KEY_lock: case KEY_tied: case KEY_untie:
- retsetpvs("\\[$@%*]");
- case KEY_tie:
- retsetpvs("\\[$@%*]$@");
case KEY___FILE__: case KEY___LINE__: case KEY___PACKAGE__:
retsetpvs("");
case KEY_readpipe:
@@ -10272,7 +10268,16 @@ Perl_core_prototype(pTHX_ SV *sv, const char *name, const STRLEN len,
) {
str[n++] = '\\';
}
- str[n++] = ("?$@@%&*$")[oa & (OA_OPTIONAL - 1)];
+ if ((oa & (OA_OPTIONAL - 1)) == OA_SCALARREF
+ && !scalar_mod_type(NULL, i)) {
+ str[n++] = '[';
+ str[n++] = '$';
+ str[n++] = '@';
+ str[n++] = '%';
+ str[n++] = '*';
+ str[n++] = ']';
+ }
+ else str[n++] = ("?$@@%&*$")[oa & (OA_OPTIONAL - 1)];
oa = oa >> 4;
}
if (defgv && str[0] == '$')