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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/rules/parameter_assignments.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« 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