Skip to content

Commit 7e353a3

Browse files
pqCommit Queue
authored andcommitted
[element model] migrate prefer_final_parameters
Bug: https://github.com/dart-lang/linter/issues/5099 Change-Id: Ia4dd49b4168d4223a27e81e66ca69249e2533cad Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393165 Auto-Submit: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent 1a02736 commit 7e353a3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pkg/linter/analyzer_use_new_elements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ lib/src/rules/prefer_equal_for_default_values.dart
137137
lib/src/rules/prefer_expression_function_bodies.dart
138138
lib/src/rules/prefer_final_in_for_each.dart
139139
lib/src/rules/prefer_final_locals.dart
140+
lib/src/rules/prefer_final_parameters.dart
140141
lib/src/rules/prefer_for_elements_to_map_fromIterable.dart
141142
lib/src/rules/prefer_foreach.dart
142143
lib/src/rules/prefer_function_declarations_over_variables.dart
@@ -179,6 +180,7 @@ lib/src/rules/tighten_type_of_initializing_formals.dart
179180
lib/src/rules/type_annotate_public_apis.dart
180181
lib/src/rules/type_init_formals.dart
181182
lib/src/rules/type_literal_in_constant_pattern.dart
183+
lib/src/rules/unawaited_futures.dart
182184
lib/src/rules/unintended_html_in_doc_comment.dart
183185
lib/src/rules/unnecessary_await_in_return.dart
184186
lib/src/rules/unnecessary_brace_in_string_interps.dart

pkg/linter/lib/src/rules/prefer_final_parameters.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ class _Visitor extends SimpleAstVisitor<void> {
7171
param is SuperFormalParameter) {
7272
continue;
7373
}
74-
var declaredElement = param.declaredElement;
74+
var declaredElement = param.declaredFragment?.element;
7575
if (declaredElement != null &&
7676
!declaredElement.isInitializingFormal &&
7777
!declaredElement.isWildcardVariable &&
78-
!body.isPotentiallyMutatedInScope(declaredElement)) {
78+
!body.isPotentiallyMutatedInScope2(declaredElement)) {
7979
rule.reportLint(param, arguments: [param.name!.lexeme]);
8080
}
8181
}

0 commit comments

Comments
 (0)