Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(765)

Unified Diff: lib/src/rules/parameter_assignments.dart

Issue 2403443003: Fix failure when linting getters (issue 27545) (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/rules/parameter_assignments.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/rules/parameter_assignments.dart
diff --git a/lib/src/rules/parameter_assignments.dart b/lib/src/rules/parameter_assignments.dart
index 75f74e29ed79985896f34b4bf462ee8a49e84c4e..a3760a241ce8744fb8945937b9914649bf113376 100644
--- a/lib/src/rules/parameter_assignments.dart
+++ b/lib/src/rules/parameter_assignments.dart
@@ -78,10 +78,14 @@ class _Visitor extends SimpleAstVisitor {
@override
void visitMethodDeclaration(MethodDeclaration node) {
- node.parameters.parameters.forEach((e) {
- if (node.body.isPotentiallyMutatedInScope(e.element)) {
- rule.reportLint(e);
- }
- });
+ FormalParameterList parameterList = node.parameters;
+ if (parameterList != null) {
+ // Getters don't have parameters.
+ parameterList.parameters.forEach((e) {
+ if (node.body.isPotentiallyMutatedInScope(e.element)) {
+ rule.reportLint(e);
+ }
+ });
+ }
}
}
« no previous file with comments | « no previous file | test/rules/parameter_assignments.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698