mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 14:53:37 +00:00
quick fix for MISSING_TYPEDEF_PARAMETERS
See: https://github.com/dart-lang/sdk/issues/55917 Change-Id: I9b81940c1c515bf923ceecb83d5aaad1d416dab1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370482 Commit-Queue: Phil Quitslund <pquitslund@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
49e0c0b33e
commit
7ead4b5786
|
@ -24,10 +24,17 @@ class AddEmptyArgumentList extends ResolvedCorrectionProducer {
|
|||
@override
|
||||
Future<void> compute(ChangeBuilder builder) async {
|
||||
var node = this.node;
|
||||
if (node is! AnnotationImpl) return;
|
||||
int? offset;
|
||||
if (node is AnnotationImpl) {
|
||||
offset = node.end;
|
||||
} else if (node is FunctionTypeAlias) {
|
||||
// endToken is the trailing `;`.
|
||||
offset = node.endToken.previous?.end;
|
||||
}
|
||||
if (offset == null) return;
|
||||
|
||||
await builder.addDartFileEdit(file, (builder) {
|
||||
builder.addSimpleInsertion(node.end, '()');
|
||||
builder.addSimpleInsertion(offset!, '()');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#
|
||||
# Stats:
|
||||
# - 42 "needsEvaluation"
|
||||
# - 334 "needsFix"
|
||||
# - 331 "needsFix"
|
||||
# - 417 "hasFix"
|
||||
# - 516 "noFix"
|
||||
|
||||
|
@ -3060,9 +3060,7 @@ ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP:
|
|||
notes: |-
|
||||
Add the missing terminator.
|
||||
ParserErrorCode.MISSING_TYPEDEF_PARAMETERS:
|
||||
status: needsFix
|
||||
notes: |-
|
||||
Add an empty parameter list.
|
||||
status: hasFix
|
||||
ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH:
|
||||
status: noFix
|
||||
ParserErrorCode.MIXED_PARAMETER_GROUPS:
|
||||
|
|
|
@ -1452,6 +1452,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
|
|||
ParserErrorCode.MISSING_FUNCTION_BODY: [
|
||||
ConvertIntoBlockBody.missingBody,
|
||||
],
|
||||
ParserErrorCode.MISSING_TYPEDEF_PARAMETERS: [
|
||||
AddEmptyArgumentList.new,
|
||||
],
|
||||
ParserErrorCode.MIXIN_DECLARES_CONSTRUCTOR: [
|
||||
RemoveConstructor.new,
|
||||
],
|
||||
|
|
|
@ -61,6 +61,15 @@ class A {
|
|||
}
|
||||
@A()
|
||||
main() {}
|
||||
''');
|
||||
}
|
||||
|
||||
Future<void> test_missingTypedefParameters() async {
|
||||
await resolveTestCode('''
|
||||
typedef F<E>;
|
||||
''');
|
||||
await assertHasFix('''
|
||||
typedef F<E>();
|
||||
''');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue