summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorLukas Mai <l.mai@web.de>2015-08-17 21:59:41 +0200
committerLukas Mai <l.mai@web.de>2015-08-18 22:34:22 +0200
commitf3106bc89eb4bbffee5ca7cb67bd63d2f3ce87bf (patch)
treee76f7aee1fd75771d5e78d487e7131761c494f4d /toke.c
parent9cd8e8a586b62830fc3c73f9acb7411a1639c3ce (diff)
downloadperl-f3106bc89eb4bbffee5ca7cb67bd63d2f3ce87bf.tar.gz
disallow nested declarations [perl #125587] [perl #121058]
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/toke.c b/toke.c
index 16d1252d59..7a0f1b6c55 100644
--- a/toke.c
+++ b/toke.c
@@ -7605,6 +7605,14 @@ Perl_yylex(pTHX)
case KEY_our:
case KEY_my:
case KEY_state:
+ if (PL_in_my) {
+ yyerror(Perl_form(aTHX_
+ "Can't redeclare \"%s\" in \"%s\"",
+ tmp == KEY_my ? "my" :
+ tmp == KEY_state ? "state" : "our",
+ PL_in_my == KEY_my ? "my" :
+ PL_in_my == KEY_state ? "state" : "our"));
+ }
PL_in_my = (U16)tmp;
s = skipspace(s);
if (isIDFIRST_lazy_if(s,UTF)) {