You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DeCo. Build fields from primary constructor formal parameters.
Introduce element building for `PrimaryConstructorDeclaration` that synthesizes a backing field and a matching field-formal parameter when a primary constructor parameter is declared with `final` or `var`. The constructor fragment is created, `const` is honored, and child fragments for such parameters are added as synthetic fields. Track the relationship between the declaring formal and the created fragments in `Linker.declaringFormalParameters` via a new `DeclaringFormalParameterInfo`. Subsequent visits to the same parameter reuse these fragments (including for default-parameter wrappers), which avoids duplicates and keeps the element model consistent. Propagate explicit types from declaring formals to the synthesized fields so that explicitly typed or function-typed parameters produce correctly typed fields (`_copyDeclaringFormalParametersExplicitTypes`). Traverse `NameWithTypeParameters` in the declaring-constructors path to pick up type parameters, and add convenience accessors `finalKeyword`/`varKeyword` plus a `hasFinalOrVarKeyword` helper on formal parameters. Some changes to extension type offsets, to align better with new AST presentation. Bug: #61701 Change-Id: Icbd507b4304131df6bce47e1a5eb5fe6f144dbd3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459160 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
0 commit comments