mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 18:31:32 +00:00
Migration: remove changedPaths tracking.
See comments in https://dart-review.googlesource.com/c/sdk/+/147043/1/pkg/nnbd_migration/lib/migration_cli.dart#484 for why this is unnecessary. Change-Id: I046835d73eb581aecd8d65b1e3248d07daf34f17 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147702 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
parent
444490d640
commit
fabceab5ee
|
@ -80,7 +80,7 @@ class NonNullableFix extends FixCodeTask {
|
|||
/// If this occurs, then don't update any code.
|
||||
bool _packageIsNNBD = true;
|
||||
|
||||
Future<void> Function([List<String>]) rerunFunction;
|
||||
Future<void> Function() rerunFunction;
|
||||
|
||||
/// A list of the URLs corresponding to the included roots.
|
||||
List<String> previewUrls;
|
||||
|
@ -257,9 +257,9 @@ environment:
|
|||
_packageIsNNBD = false;
|
||||
}
|
||||
|
||||
Future<MigrationState> rerun([List<String> changedPaths]) async {
|
||||
Future<MigrationState> rerun() async {
|
||||
reset();
|
||||
await rerunFunction(changedPaths);
|
||||
await rerunFunction();
|
||||
final state = MigrationState(
|
||||
migration, includedRoot, listener, instrumentationListener);
|
||||
await state.refresh();
|
||||
|
|
|
@ -476,18 +476,7 @@ Use this interactive web view to review, improve, or apply the results.
|
|||
bool _isUriError(AnalysisError error) =>
|
||||
error.errorCode == CompileTimeErrorCode.URI_DOES_NOT_EXIST;
|
||||
|
||||
Future<void> _rerunFunction([List<String> changedPaths]) async {
|
||||
// Note: we don't support [changedPaths]. The only time it is non-null is
|
||||
// when the tool decides to re-run automatically due to deleting a hint.
|
||||
// That's problematic for two reasons: (1) if the user first makes a change
|
||||
// to some other file (without re-running) and then removes a hint, only the
|
||||
// file affected by the removal will be in changedPaths, so the user will
|
||||
// think that migration has been totally re-run when it hasn't.
|
||||
// (2) removing a hint shouldn't force a re-run anyhow (see
|
||||
// https://github.com/dart-lang/sdk/issues/41795), and once that is fixed
|
||||
// changedPaths will always be null.
|
||||
//
|
||||
// TODO(paulberry): remove changedPaths entirely.
|
||||
Future<void> _rerunFunction() async {
|
||||
_dartFixListener.reset();
|
||||
_fixCodeProcessor.prepareToRerun();
|
||||
await _fixCodeProcessor.runFirstPhase();
|
||||
|
|
|
@ -33,7 +33,7 @@ class HttpPreviewServer {
|
|||
Future<HttpServer> _serverFuture;
|
||||
|
||||
// A function which allows the migration to be rerun, taking changed paths.
|
||||
final Future<MigrationState> Function([List<String>]) rerunFunction;
|
||||
final Future<MigrationState> Function() rerunFunction;
|
||||
|
||||
/// Integer for a port to run the preview server on. If null or zero, allow
|
||||
/// [HttpServer.bind] to pick one.
|
||||
|
|
|
@ -60,7 +60,7 @@ class PreviewSite extends Site
|
|||
final Map<String, UnitInfo> unitInfoMap = {};
|
||||
|
||||
// A function provided by DartFix to rerun the migration.
|
||||
final Future<MigrationState> Function([List<String>]) rerunFunction;
|
||||
final Future<MigrationState> Function() rerunFunction;
|
||||
|
||||
final String serviceAuthToken = _makeAuthToken();
|
||||
|
||||
|
@ -257,12 +257,12 @@ class PreviewSite extends Site
|
|||
file.writeAsStringSync(newContent);
|
||||
unitInfo.diskContent = newContent;
|
||||
if (!insertionOnly) {
|
||||
await rerunMigration([path]);
|
||||
await rerunMigration();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> rerunMigration([List<String> changedPaths]) async {
|
||||
migrationState = await rerunFunction(changedPaths);
|
||||
Future<void> rerunMigration() async {
|
||||
migrationState = await rerunFunction();
|
||||
reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,15 +35,13 @@ class PreviewSiteTest with ResourceProviderMixin, PreviewSiteTestMixin {
|
|||
}
|
||||
|
||||
void setUp() {
|
||||
reranPaths = null;
|
||||
dartfixListener = DartFixListener(null);
|
||||
resourceProvider = MemoryResourceProvider();
|
||||
final migrationInfo = MigrationInfo({}, {}, null, null);
|
||||
state = MigrationState(null, null, dartfixListener, null);
|
||||
state.pathMapper = PathMapper(resourceProvider);
|
||||
state.migrationInfo = migrationInfo;
|
||||
site = PreviewSite(state, ([paths]) async {
|
||||
reranPaths = paths;
|
||||
site = PreviewSite(state, () async {
|
||||
return state;
|
||||
});
|
||||
}
|
||||
|
@ -160,7 +158,6 @@ void main(List args) {
|
|||
expect(file.readAsStringSync(), 'int/*?*/ foo() {}');
|
||||
expect(state.hasBeenApplied, false);
|
||||
expect(state.needsRerun, true);
|
||||
expect(reranPaths, null);
|
||||
expect(unitInfo.content, 'int/*?*/ foo() {}');
|
||||
}
|
||||
|
||||
|
@ -181,7 +178,6 @@ mixin PreviewSiteTestMixin {
|
|||
PreviewSite site;
|
||||
DartFixListener dartfixListener;
|
||||
MigrationState state;
|
||||
List<String> reranPaths;
|
||||
|
||||
Future<void> performEdit(String path, int offset, String replacement) {
|
||||
final pathUri = Uri.file(path).path;
|
||||
|
@ -197,14 +193,12 @@ class PreviewSiteWithEngineTest extends NnbdMigrationTestBase
|
|||
@override
|
||||
void setUp() {
|
||||
super.setUp();
|
||||
reranPaths = null;
|
||||
dartfixListener = DartFixListener(null);
|
||||
final migrationInfo = MigrationInfo({}, {}, null, null);
|
||||
state = MigrationState(null, null, dartfixListener, null);
|
||||
state.pathMapper = PathMapper(resourceProvider);
|
||||
state.migrationInfo = migrationInfo;
|
||||
site = PreviewSite(state, ([paths]) async {
|
||||
reranPaths = paths;
|
||||
site = PreviewSite(state, () async {
|
||||
return state;
|
||||
});
|
||||
}
|
||||
|
@ -256,6 +250,5 @@ int/*?*/? y = x;
|
|||
unitInfo.content.indexOf('= x;') + '= '.length, contains('data flow'));
|
||||
expect(state.hasBeenApplied, false);
|
||||
expect(state.needsRerun, true);
|
||||
expect(reranPaths, null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue