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

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

Issue 2424743004: Fix exception in linter (issue 315) (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 a3760a241ce8744fb8945937b9914649bf113376..6188f4e4f44d62f6e7ed9178d02dfbcbd6889cbd 100644
--- a/lib/src/rules/parameter_assignments.dart
+++ b/lib/src/rules/parameter_assignments.dart
@@ -69,11 +69,16 @@ class _Visitor extends SimpleAstVisitor {
@override
void visitFunctionDeclaration(FunctionDeclaration node) {
- node.functionExpression.parameters.parameters.forEach((e) {
- if (node.functionExpression.body.isPotentiallyMutatedInScope(e.element)) {
- rule.reportLint(e);
- }
- });
+ FormalParameterList parameters = node.functionExpression.parameters;
+ if (parameters != null) {
+ // Getter do not have formal parameters.
+ parameters.parameters.forEach((e) {
+ if (node.functionExpression.body
+ .isPotentiallyMutatedInScope(e.element)) {
+ rule.reportLint(e);
+ }
+ });
+ }
}
@override
« 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