mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:01:20 +00:00
Fix npe in quick fix computation (issue 32926)
Change-Id: Ic93da063758513f101d753516cb61c351dae2501 Reviewed-on: https://dart-review.googlesource.com/51940 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Danny Tuppeny <dantup@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
499b6ba4cf
commit
bdc727d49b
|
@ -2393,7 +2393,7 @@ class FixProcessor {
|
|||
final thisExpression = node is ThisExpression
|
||||
? node
|
||||
: node.getAncestor((node) => node is ThisExpression);
|
||||
final parent = thisExpression.parent;
|
||||
final parent = thisExpression?.parent;
|
||||
if (parent is PropertyAccess) {
|
||||
DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
|
||||
await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
|
||||
|
|
|
@ -6901,6 +6901,17 @@ class A {
|
|||
''');
|
||||
}
|
||||
|
||||
test_removeThisExpression_notAThisExpression() async {
|
||||
String src = '''
|
||||
void foo() {
|
||||
final /*LINT*/this.id;
|
||||
}
|
||||
''';
|
||||
await findLint(src, LintNames.unnecessary_this);
|
||||
|
||||
await assertNoFix(DartFixKind.REMOVE_THIS_EXPRESSION);
|
||||
}
|
||||
|
||||
test_removeThisExpression_propertyAccess_oneCharacterOperator() async {
|
||||
String src = '''
|
||||
class A {
|
||||
|
|
Loading…
Reference in a new issue