| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library linter.src.rules.parameter_assignments; | 5 library linter.src.rules.parameter_assignments; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/visitor.dart'; | 8 import 'package:analyzer/dart/ast/visitor.dart'; |
| 9 import 'package:linter/src/linter.dart'; | 9 import 'package:linter/src/linter.dart'; |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void visitFunctionDeclaration(FunctionDeclaration node) { | 71 void visitFunctionDeclaration(FunctionDeclaration node) { |
| 72 node.functionExpression.parameters.parameters.forEach((e) { | 72 node.functionExpression.parameters.parameters.forEach((e) { |
| 73 if (node.functionExpression.body.isPotentiallyMutatedInScope(e.element)) { | 73 if (node.functionExpression.body.isPotentiallyMutatedInScope(e.element)) { |
| 74 rule.reportLint(e); | 74 rule.reportLint(e); |
| 75 } | 75 } |
| 76 }); | 76 }); |
| 77 } | 77 } |
| 78 | 78 |
| 79 @override | 79 @override |
| 80 void visitMethodDeclaration(MethodDeclaration node) { | 80 void visitMethodDeclaration(MethodDeclaration node) { |
| 81 node.parameters.parameters.forEach((e) { | 81 FormalParameterList parameterList = node.parameters; |
| 82 if (node.body.isPotentiallyMutatedInScope(e.element)) { | 82 if (parameterList != null) { |
| 83 rule.reportLint(e); | 83 // Getters don't have parameters. |
| 84 } | 84 parameterList.parameters.forEach((e) { |
| 85 }); | 85 if (node.body.isPotentiallyMutatedInScope(e.element)) { |
| 86 rule.reportLint(e); |
| 87 } |
| 88 }); |
| 89 } |
| 86 } | 90 } |
| 87 } | 91 } |
| OLD | NEW |