aaeb9e7acf
Change-Id: I7372fa152aa78fc6db01a11306a903e0ce38463e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219742 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
33 lines
1.0 KiB
Dart
33 lines
1.0 KiB
Dart
// Copyright (c) 2021, 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:analysis_server/src/protocol_server.dart';
|
|
import 'package:analyzer_utilities/check/check.dart';
|
|
import 'package:meta/meta.dart';
|
|
|
|
extension SourceChangeExtension on CheckTarget<SourceChange> {
|
|
@useResult
|
|
CheckTarget<List<SourceFileEdit>> get edits {
|
|
return nest(value.edits, (value) => 'has edits ${valueStr(value)}');
|
|
}
|
|
|
|
CheckTarget<SourceFileEdit> hasFileEdit(String path) {
|
|
return nest(
|
|
value.edits.singleWhere((e) => e.file == path),
|
|
(selected) => 'has edit ${valueStr(selected)}',
|
|
);
|
|
}
|
|
}
|
|
|
|
extension SourceFileEditExtension on CheckTarget<SourceFileEdit> {
|
|
@useResult
|
|
CheckTarget<String> appliedTo(String applyTo) {
|
|
var actual = SourceEdit.applySequence(applyTo, value.edits);
|
|
return nest(
|
|
actual,
|
|
(selected) => 'produces ${valueStr(selected)}',
|
|
);
|
|
}
|
|
}
|