class.c: delay declaring $self until after block_start() - #24738
Open
leonerd wants to merge 1 commit into
Open
Conversation
tonycoz
reviewed
Aug 24, 2026
|
|
||
| assert(cv == PL_compcv); | ||
| assert(HvSTASH_IS_CLASS(PL_curstash)); | ||
|
|
Contributor
There was a problem hiding this comment.
Need a PERL_UNUSED_ARG(cv);, since cv is only used in debug builds.
class.c:984:38: warning: unused parameter ‘cv’ [-Wunused-parameter]
984 | Perl_class_declare_padvars(pTHX_ CV *cv)
| ~~~~^~
Contributor
Author
There was a problem hiding this comment.
Ahyes, I keep forgetting about those ones.
Fixed.
Contributor
|
Looks good otherwise. |
Previously, the `$self` variable was declared so early that pad.c thought it was in an outer scope, and thus didn't warn of shadowing. By waiting until after the `remember` grammar token in `perl.y` we can ensure that the shadow warning still happens for duplicate declarations. Fixes Perl#24610
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, the
$selfvariable was declared so early that pad.c thought it was in an outer scope, and thus didn't warn of shadowing. By waiting until after theremembergrammar token inperl.ywe can ensure that the shadow warning still happens for duplicate declarations.Fixes #24610