Files
sdk/pkg/analyzer/test
Erik Ernst c7e6c98877 Implement analyzer support for => anonymous methods
This CL adds implementation of the static analysis of anonymous methods
whose body is of the form `=> e`. Block bodies are still rejected by a
`UnimplementedError` exception.

Flow analysis is rudimentary, but this might be sufficiuent for the
particular kind of anonymous methods which are covered by this CL. In
particular, it does not cause assigned local variables to be marked as
non-promotable in enclosing scopes, and it does allow local variables
promoted in the anonymous method body to preserve their promotions after
the anonymous method invocation.

Note that the change in `_resolveReceiver` is needed because the old code relied on looking up the syntactically enclosing class or extension in order to determine the type of `this`, but that is incorrect when `this` may be the type of the receiver of an enclosing anonymous method.

Change-Id: I3d2bd6d104015a6e310e9ce061c7b4109002a1b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2026-02-20 06:58:36 -08:00
..