Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subject indicator false positives #60

Open
jupenur opened this issue Aug 21, 2017 · 0 comments
Open

Subject indicator false positives #60

jupenur opened this issue Aug 21, 2017 · 0 comments

Comments

@jupenur
Copy link
Contributor

jupenur commented Aug 21, 2017

Queries with subject indicators match more nodes than they should, and also match the same node multiple times. E.g.:

esquery(esprima.parse('foo = bar = baz'),
  '!AssignmentExpression > AssignmentExpression > Identifier');

...returns the following:

[ AssignmentExpression {
    type: 'AssignmentExpression',
    operator: '=',
    left: Identifier { type: 'Identifier', name: 'bar' },
    right: Identifier { type: 'Identifier', name: 'baz' } },
  AssignmentExpression {
    type: 'AssignmentExpression',
    operator: '=',
    left: Identifier { type: 'Identifier', name: 'foo' },
    right: 
     AssignmentExpression {
       type: 'AssignmentExpression',
       operator: '=',
       left: [Object],
       right: [Object] } },
  AssignmentExpression {
    type: 'AssignmentExpression',
    operator: '=',
    left: Identifier { type: 'Identifier', name: 'bar' },
    right: Identifier { type: 'Identifier', name: 'baz' } },
  AssignmentExpression {
    type: 'AssignmentExpression',
    operator: '=',
    left: Identifier { type: 'Identifier', name: 'foo' },
    right: 
     AssignmentExpression {
       type: 'AssignmentExpression',
       operator: '=',
       left: [Object],
       right: [Object] } } ]

As far as I can tell, it should return only this:

[ AssignmentExpression {
    type: 'AssignmentExpression',
    operator: '=',
    left: Identifier { type: 'Identifier', name: 'foo' },
    right: 
     AssignmentExpression {
       type: 'AssignmentExpression',
       operator: '=',
       left: [Object],
       right: [Object] } } ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant