summaryrefslogtreecommitdiff
path: root/perly.y
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2022-10-14 13:14:47 +0100
committerPaul Evans <leonerd@leonerd.org.uk>2022-10-25 15:49:20 +0100
commit9a27b4a4d8ed9cce0905c91d78c279be127de229 (patch)
tree15b03d5eab1248d62d9475a486688f4a0446591c /perly.y
parentdb2b17365aa663074617cea8c7795ff608c41295 (diff)
downloadperl-9a27b4a4d8ed9cce0905c91d78c279be127de229.tar.gz
Better handling of builtin CV attributes
The previous code would handle subroutine attributes directly against `PL_compcv` as a side-effect of merely parsing the syntax in `yyl_colon()`, an unlikely place for anyone to find it. This complicates the way the parser works. The new structure creates a new function to apply all the builtin attributes out of an attribute list to any given CV, and invokes it from the parser at a slightly better time.
Diffstat (limited to 'perly.y')
-rw-r--r--perly.y7
1 files changed, 6 insertions, 1 deletions
diff --git a/perly.y b/perly.y
index fe0c717540..00e6266625 100644
--- a/perly.y
+++ b/perly.y
@@ -709,7 +709,12 @@ proto
subattrlist
: empty
| COLONATTR THING
- { $$ = $THING; }
+ {
+ OP *attrlist = $THING;
+ if(attrlist && !PL_parser->sig_seen)
+ attrlist = apply_builtin_cv_attributes(PL_compcv, attrlist);
+ $$ = attrlist;
+ }
| COLONATTR
{ $$ = NULL; }
;