Files
sdk/pkg/analysis_server/lib
Robert Nystrom 78e254f9e4 Handle private named parameters in ConvertAllFormalParametersToNamed.
If all of the positional parameters in the parameter list are public,
then it happily converts them to public named parameters.

If any of them have private names and they can be private named
parameters, it does that too. For that to be true:

- The library containing the declaration needs to support private named
  parameters.

- The parameter needs to be an initializing formal (or a declaring
  parameter when those are supported). That implies it must also be in
  a constructor.

If there are any positional parameters that are private and don't fit
that, then it doesn't allow the refactoring.

Also, in cases where it does convert a private positional parameter to
a private named parameter, this CL makes sure that the added argument
name is the corresponding public name.

This also fixes #62284 by not applying the refactoring unless the
result yields valid private named parameters.

Fix #62284.

Change-Id: Id00831c2631ff3bf6587ac63d90865f7b0fb367c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475267
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-23 17:25:30 -08:00
..