From 4a632a3948819d65243582402506254f5841c388 Mon Sep 17 00:00:00 2001 From: pq Date: Mon, 30 Sep 2024 22:04:11 +0000 Subject: [PATCH] [element model] migrate `comment_references` Bug: https://github.com/dart-lang/linter/issues/5099 Change-Id: Ia0957f65ee9bfd49b1984849d9a2df6bef476552 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387606 Reviewed-by: Brian Wilkerson Commit-Queue: Phil Quitslund --- pkg/linter/analyzer_use_new_elements.txt | 71 +++++++++++++++++++ .../lib/src/rules/comment_references.dart | 4 +- 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/pkg/linter/analyzer_use_new_elements.txt b/pkg/linter/analyzer_use_new_elements.txt index 746eb08b1307..4aa14d0152a9 100644 --- a/pkg/linter/analyzer_use_new_elements.txt +++ b/pkg/linter/analyzer_use_new_elements.txt @@ -35,6 +35,7 @@ lib/src/rules/cancel_subscriptions.dart lib/src/rules/cast_nullable_to_non_nullable.dart lib/src/rules/close_sinks.dart lib/src/rules/combinators_ordering.dart +lib/src/rules/comment_references.dart lib/src/rules/constant_identifier_names.dart lib/src/rules/control_flow_in_finally.dart lib/src/rules/curly_braces_in_flow_control_structures.dart @@ -46,6 +47,7 @@ lib/src/rules/empty_constructor_bodies.dart lib/src/rules/empty_statements.dart lib/src/rules/enable_null_safety.dart lib/src/rules/erase_dart_type_extension_types.dart +lib/src/rules/file_names.dart lib/src/rules/flutter_style_todos.dart lib/src/rules/implicit_call_tearoffs.dart lib/src/rules/invariant_booleans.dart @@ -66,3 +68,72 @@ lib/src/rules/no_self_assignments.dart lib/src/rules/non_constant_identifier_names.dart lib/src/rules/null_check_on_nullable_type_parameter.dart lib/src/rules/omit_obvious_local_variable_types.dart +lib/src/rules/one_member_abstracts.dart +lib/src/rules/only_throw_errors.dart +lib/src/rules/package_api_docs.dart +lib/src/rules/package_prefixed_library_names.dart +lib/src/rules/prefer_adjacent_string_concatenation.dart +lib/src/rules/prefer_asserts_with_message.dart +lib/src/rules/prefer_bool_in_asserts.dart +lib/src/rules/prefer_collection_literals.dart +lib/src/rules/prefer_conditional_assignment.dart +lib/src/rules/prefer_const_declarations.dart +lib/src/rules/prefer_contains.dart +lib/src/rules/prefer_double_quotes.dart +lib/src/rules/prefer_equal_for_default_values.dart +lib/src/rules/prefer_expression_function_bodies.dart +lib/src/rules/prefer_generic_function_type_aliases.dart +lib/src/rules/prefer_if_elements_to_conditional_expressions.dart +lib/src/rules/prefer_if_null_operators.dart +lib/src/rules/prefer_inlined_adds.dart +lib/src/rules/prefer_interpolation_to_compose_strings.dart +lib/src/rules/prefer_is_empty.dart +lib/src/rules/prefer_is_not_operator.dart +lib/src/rules/prefer_iterable_whereType.dart +lib/src/rules/prefer_null_aware_method_calls.dart +lib/src/rules/prefer_null_aware_operators.dart +lib/src/rules/prefer_single_quotes.dart +lib/src/rules/prefer_spread_collections.dart +lib/src/rules/prefer_typing_uninitialized_variables.dart +lib/src/rules/provide_deprecation_message.dart +lib/src/rules/pub/depend_on_referenced_packages.dart +lib/src/rules/pub/package_names.dart +lib/src/rules/pub/secure_pubspec_urls.dart +lib/src/rules/pub/sort_pub_dependencies.dart +lib/src/rules/require_trailing_commas.dart +lib/src/rules/sized_box_for_whitespace.dart +lib/src/rules/sized_box_shrink_expand.dart +lib/src/rules/slash_for_doc_comments.dart +lib/src/rules/sort_child_properties_last.dart +lib/src/rules/sort_constructors_first.dart +lib/src/rules/sort_unnamed_constructors_first.dart +lib/src/rules/specify_nonobvious_local_variable_types.dart +lib/src/rules/super_goes_last.dart +lib/src/rules/throw_in_finally.dart +lib/src/rules/tighten_type_of_initializing_formals.dart +lib/src/rules/type_annotate_public_apis.dart +lib/src/rules/type_literal_in_constant_pattern.dart +lib/src/rules/unintended_html_in_doc_comment.dart +lib/src/rules/unnecessary_brace_in_string_interps.dart +lib/src/rules/unnecessary_const.dart +lib/src/rules/unnecessary_constructor_name.dart +lib/src/rules/unnecessary_final.dart +lib/src/rules/unnecessary_late.dart +lib/src/rules/unnecessary_library_directive.dart +lib/src/rules/unnecessary_new.dart +lib/src/rules/unnecessary_null_aware_assignments.dart +lib/src/rules/unnecessary_null_in_if_null_operators.dart +lib/src/rules/unnecessary_raw_strings.dart +lib/src/rules/unnecessary_statements.dart +lib/src/rules/unnecessary_string_escapes.dart +lib/src/rules/unnecessary_string_interpolations.dart +lib/src/rules/unnecessary_to_list_in_spreads.dart +lib/src/rules/use_colored_box.dart +lib/src/rules/use_decorated_box.dart +lib/src/rules/use_function_type_syntax_for_parameters.dart +lib/src/rules/use_if_null_to_convert_nulls_to_bools.dart +lib/src/rules/use_is_even_rather_than_modulo.dart +lib/src/rules/use_raw_strings.dart +lib/src/rules/use_to_and_as_if_applicable.dart +lib/src/rules/use_truncating_division.dart +lib/src/rules/valid_regexps.dart diff --git a/pkg/linter/lib/src/rules/comment_references.dart b/pkg/linter/lib/src/rules/comment_references.dart index 00d7935b7e99..a7893a061670 100644 --- a/pkg/linter/lib/src/rules/comment_references.dart +++ b/pkg/linter/lib/src/rules/comment_references.dart @@ -87,11 +87,11 @@ class _Visitor extends SimpleAstVisitor { if (expression.isSynthetic) return; if (expression is Identifier && - expression.staticElement == null && + expression.element == null && !linkReferences.contains(expression.name)) { rule.reportLint(expression); } else if (expression is PropertyAccess && - expression.propertyName.staticElement == null) { + expression.propertyName.element == null) { var target = expression.target; if (target is PrefixedIdentifier) { var name = '${target.name}.${expression.propertyName.name}';