diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-06-22 12:09:07 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-06-22 23:16:41 -0700 |
commit | 9657ccb4f31f4d026ef8ff65d8cfb5c24d0949ef (patch) | |
tree | 950aa674f791332adf020527bff6b3f6c63a1167 /toke.c | |
parent | 9b7d7782b9990e579acbba430d00797bfb529804 (diff) | |
download | perl-9657ccb4f31f4d026ef8ff65d8cfb5c24d0949ef.tar.gz |
toke.c: Don’t depend on sv_force_normal’s good graces
when parsing ‘keyword =>’ with comments or line breaks before the =>.
sv_force_normal will allow modification of read-only values at compile
time. While this might be convenient, it has resulted in many bugs
elsewhere, so I am trying to change that. This is a necessary pre-
requisite.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -7182,9 +7182,13 @@ Perl_yylex(pTHX) if (*s == '=' && s[1] == '>' && !pkgname) { op_free(rv2cv_op); CLINE; + /* This is our own scalar, created a few lines above, + so this is safe. */ + SvREADONLY_off(cSVOPx(pl_yylval.opval)->op_sv); sv_setpv(((SVOP*)pl_yylval.opval)->op_sv, PL_tokenbuf); if (UTF && !IN_BYTES && is_utf8_string((U8*)PL_tokenbuf, len)) SvUTF8_on(((SVOP*)pl_yylval.opval)->op_sv); + SvREADONLY_on(cSVOPx(pl_yylval.opval)->op_sv); TERM(WORD); } |