Skip to content

Commit

Permalink
Fix wildcard property being added for member access
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed May 18, 2018
1 parent 3fda52e commit 029a0b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var bindingVisitor = {

state.undeclared[node.name] = true
if (state.wildcard &&
!(parent.type === 'MemberExpression' && parent.object === node) &&
!(parent.type === 'VariableDeclarator' && parent.id === node) &&
!(parent.type === 'AssignmentExpression' && parent.left === node)) {
state.undeclaredProps[node.name + '.*'] = true
Expand Down
5 changes: 3 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ test('wildcard use of undeclared name', function (t) {
new A()
A.from()
func(b)
C.from()
`, { wildcard: true }), {
identifiers: ['A', 'b'],
properties: ['A.*', 'A.from', 'b.*']
identifiers: ['A', 'b', 'C'],
properties: ['A.*', 'A.from', 'b.*', 'C.from']
})
t.end()
})
Expand Down

0 comments on commit 029a0b7

Please sign in to comment.