Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
a14n committed Jan 24, 2018
1 parent 6b3d600 commit cdbe9ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/src/rules/avoid_shadowing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class _Visitor extends SimpleAstVisitor {
@override
visitVariableDeclarationStatement(VariableDeclarationStatement node) {
final variables = node.variables.variables;
final library = variables.first.element.library;

bool skipInstanceMembers = false;
AstNode current = node;
Expand Down Expand Up @@ -109,11 +110,8 @@ class _Visitor extends SimpleAstVisitor {
}

current = current.parent;
if (current == null) {
final library = node.variables.variables.first.element.library;
_checkLibrary(library, variables);
}
}
_checkLibrary(library, variables);
}

void _checkClass(
Expand Down
8 changes: 8 additions & 0 deletions test/rules/avoid_shadowing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,11 @@ class D {
var c; // LINT
}
}

// 2 shadowing
class E {
int x;
m(int x) {
int x; // LINT
}
}

0 comments on commit cdbe9ce

Please sign in to comment.