Files
sdk/pkg/analyzer/test
Konstantin Shcheglov e43773e93f CQ. Centralize VariableDeclarationList scoping
Move VariableDeclarationList traversal and scope selection into
ScopeContext so all resolver passes apply the same scoping rules and
doc-comment handling for fields and top-level variables.

Specifically, non-late field initializers now run in a constructor-
initializer scope when a primary constructor is available, while
static/late fields keep using the normal instance scope. This aligns
field-initializer resolution with constructor initializer semantics.

Stop relying on VariableDeclarationList visitation for semantic work by
moving local variable type assignment into visitVariableDeclaration and
binding initializer scopes there (outline linking). This keeps behavior
correct even when list traversal is elided or customized.

Also broaden assignment-to-primary-constructor-parameter diagnostics to
cover both identifiers and AssignedVariablePattern, so pattern-based
assignments are rejected in field initializers and constructor
initializers.

Change-Id: I47b7643d32a26071ea6891821783b37e088f426d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483627
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-02-26 11:27:30 -08:00
..