summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-07-25 23:40:19 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-07-26 00:09:04 -0700
commit7de68bd5ba804db7c26eb42d7496401202a00b80 (patch)
tree78d00e6a6be019655729ad30f6b277317b8d0374 /op.c
parentb8c38f0a2a65800ef71a3715d0a31299fcfb4986 (diff)
downloadperl-7de68bd5ba804db7c26eb42d7496401202a00b80.tar.gz
core_prototype: Eliminate the special mkdir case
The prototype-generation code just needed a little tweaking for this to work. It assumed that ‘;’ should not be emitted if PL_opargs[opnum] & OA_DEFGV, which is not necessarily the case. It only applies at the beginning of the prototype, hence the n check (where n is the character position in the protoytpe). It also changed the last $ to _ in the OA_DEFGV case, instead of the first. _ only comes at the beginning of a prototype (at least for core functions; ck_fun, incidentally, enforces this), but not necessarily at the end.
Diffstat (limited to 'op.c')
-rw-r--r--op.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/op.c b/op.c
index 2c829ded62..5b39492091 100644
--- a/op.c
+++ b/op.c
@@ -10228,8 +10228,6 @@ Perl_core_prototype(pTHX_ SV *sv, const char *name, const STRLEN len,
case KEY_lt : case KEY_ne : case KEY_or :
case KEY_system: case KEY_x : case KEY_xor :
return NULL;
- case KEY_mkdir:
- retsetpvs("_;$");
case KEY_keys: case KEY_values: case KEY_each:
retsetpvs("+");
case KEY_push: case KEY_unshift:
@@ -10263,7 +10261,7 @@ Perl_core_prototype(pTHX_ SV *sv, const char *name, const STRLEN len,
defgv = PL_opargs[i] & OA_DEFGV;
oa = PL_opargs[i] >> OASHIFT;
while (oa) {
- if (oa & OA_OPTIONAL && !seen_question && !defgv) {
+ if (oa & OA_OPTIONAL && !seen_question && (!defgv || n)) {
seen_question = 1;
str[n++] = ';';
}
@@ -10277,8 +10275,8 @@ Perl_core_prototype(pTHX_ SV *sv, const char *name, const STRLEN len,
str[n++] = ("?$@@%&*$")[oa & (OA_OPTIONAL - 1)];
oa = oa >> 4;
}
- if (defgv && str[n - 1] == '$')
- str[n - 1] = '_';
+ if (defgv && str[0] == '$')
+ str[0] = '_';
str[n++] = '\0';
sv_setpvn(sv, str, n - 1);
return sv;