[element model] migrate avoid_returning_this
Bug: https://github.com/dart-lang/linter/issues/5099 Change-Id: Ia746475aaa29bae8be14a8c408adf728e77e015e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390081 Auto-Submit: Phil Quitslund <pquitslund@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
@@ -31,6 +31,7 @@ lib/src/rules/avoid_relative_lib_imports.dart
|
||||
lib/src/rules/avoid_return_types_on_setters.dart
|
||||
lib/src/rules/avoid_returning_null.dart
|
||||
lib/src/rules/avoid_returning_null_for_future.dart
|
||||
lib/src/rules/avoid_returning_this.dart
|
||||
lib/src/rules/avoid_shadowing_type_parameters.dart
|
||||
lib/src/rules/avoid_single_cascade_in_expression_statements.dart
|
||||
lib/src/rules/avoid_slow_async_io.dart
|
||||
@@ -346,6 +347,8 @@ test/rules/prefer_inlined_adds_test.dart
|
||||
test/rules/prefer_int_literals_test.dart
|
||||
test/rules/prefer_interpolation_to_compose_strings_test.dart
|
||||
test/rules/prefer_is_empty_test.dart
|
||||
test/rules/prefer_is_not_empty_test.dart
|
||||
test/rules/prefer_is_not_operator_test.dart
|
||||
test/rules/prefer_iterable_whereType_test.dart
|
||||
test/rules/prefer_mixin_test.dart
|
||||
test/rules/prefer_null_aware_method_calls_test.dart
|
||||
@@ -442,9 +445,6 @@ test/verify_reflective_test_suites_test.dart
|
||||
test_data/rules/no_default_cases.dart
|
||||
test_data/rules/overridden_fields.dart
|
||||
test_data/rules/prefer_const_declarations.dart
|
||||
test_data/rules/prefer_final_fields.dart
|
||||
test_data/rules/prefer_is_not_empty.dart
|
||||
test_data/rules/prefer_is_not_operator.dart
|
||||
test_data/rules/prefer_void_to_null.dart
|
||||
test_data/rules/require_trailing_commas.dart
|
||||
test_data/rules/type_init_formals.dart
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// 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/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer/src/dart/ast/ast.dart'; // ignore: implementation_imports
|
||||
|
||||
import '../analyzer.dart';
|
||||
import '../extensions.dart';
|
||||
@@ -79,10 +79,11 @@ class _Visitor extends SimpleAstVisitor<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
var returnType = node.declaredElement?.returnType;
|
||||
var returnType = node.declaredFragment?.element.returnType;
|
||||
if (returnType is InterfaceType &&
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
returnType.element == (parent as Declaration).declaredElement) {
|
||||
returnType.element3 ==
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
(parent as FragmentDeclaration).declaredFragment?.element) {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user