dart-sdk/pkg/nnbd_migration/test/api_test_base.dart
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

30 lines
970 B
Dart

// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:nnbd_migration/nnbd_migration.dart';
import 'package:test/test.dart';
class TestMigrationListener implements NullabilityMigrationListener {
final edits = <Source, List<SourceEdit>>{};
List<String> details = [];
@override
void addEdit(Source source, SourceEdit edit) {
(edits[source] ??= []).add(edit);
}
@override
void addSuggestion(String descriptions, Location location) {}
@override
void reportException(
Source source, AstNode node, Object exception, StackTrace stackTrace) {
fail('Exception reported: $exception\n$stackTrace');
}
}