Commit Graph

3 Commits

Author SHA1 Message Date
Paul Berry 8714a7fa1d Abstract resolution calls to .isNullAware.
When migrating, we'll need to change some null-aware property accesses
and method calls to non-null-aware (due to the fact that the receiver
is non-nullable, or due to the new `?.` shortcut rules), so when
migration re-resolves, it will need to be able to override
resolution's determination of whether a given property access or
method call is null-aware.

Change-Id: I411f43fb937431e757d4dd9b968874db84158e47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133240
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-01-24 19:58:43 +00:00
Paul Berry 31bfacfda4 Migration: change API to make use of FixBuilder's "changes" data structure.
The new FixBuilder component of the migration engine communicates the
changes it produces using a "changes" data structure of type Map<int,
List<AtomicEdit>>, and is not compatible with the old
SingleNullabilityFix class (which made the incorrect assumption that
each SourceEdit was associated with a single fix).  This CL changes
the migration engine's instrumentation API to use this data structure,
and changes its listener API to avoid reference to the
SingleNullabilityFix class.  This allows SingleNullabilityFix to be
deleted.

This required changing AtomicEditWithReason so that it can hold
multiple fix reasons, and a NullabilityFixDescription.  It does so
using a new object, AtomicEditInfo, and AtomicEditWithReason is
renamed to AtomicEditWithInfo.

In addition, the old FixInfo class is removed, since it carries the
same information as the new AtomicEditWithInfo class.

This required deleting the "incremental workflow" functionality from
UnitRenderer.  This functionality was disabled, and I believe it
wouldn't have worked anyway (since it, too, made the incorrect
assumption that each SourceEdit was associated with a single fix).

Change-Id: Id965cfd803b408c66f15436017b87fc3e46521c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132306
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-19 16:50:01 +00:00
Paul Berry 4ae145e173 Migration: Introduce an instrumentation interface.
This interface is a callback interface that allows the client to
receive detailed information about the decisions made by the migration
tool, and the source code locations associated with those decisions.
The idea is that a client of this interface can put together a report
to the user to help them understand the behavior of the migration
tool.

The instrumentation interface mostly exposes internals of the
migration engine through some safe, non-destructive interfaces.  The
interface itself is documented in the new file
pkg/nnbd_migration/lib/instrumentation.dart.  For examples of what
information the client can expect to receive through the
instrumentation interface, see the new file
pkg/nnbd_migration/test/instrumentation_test.dart.

Change-Id: I079551922bff75e0e8d290819f31533c29d7b62f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117285
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-16 20:57:41 +00:00