tsquery-playground icon indicating copy to clipboard operation
tsquery-playground copied to clipboard

Cannot get direct descendants of Block when preceeded by Constructor or FunctionDeclaration

Open nonara opened this issue 6 years ago • 0 comments

The Playground seems to think that there is an additional unidentifiable node sitting between Block and its children when preceeded by Constructor or FunctionDeclaration

Code:

function A() {
  this.a = 1;
}

class B {
  constructor() {
    this.a = 1;
  }
}

AST Queries

The following will not work:

ClassDeclaration > Constructor > Block > ExpressionStatement
FunctionDeclaration > Block > ExpressionStatement

Where, these do work:

ClassDeclaration > Constructor > Block > * > ExpressionStatement
ClassDeclaration > Constructor > Block ExpressionStatement
FunctionDeclaration > Block > * > ExpressionStatement
FunctionDeclaration > Block ExpressionStatement

nonara avatar Aug 25 '19 19:08 nonara