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

Add simpler findReferences and getDefinitions that only returns nodes #297

Closed
dsherret opened this issue Mar 30, 2018 · 1 comment
Closed

Comments

@dsherret
Copy link
Owner

dsherret commented Mar 30, 2018

Right now findReferences and getDefinitions() is the same as in the compiler API and it's kind of a pain to use if you only want to get the nodes:

const classDeclaration = ...; // get a class or some other declaration somehow
const referencedSymbols = classDeclaration.getNameNode().findReferences();
const referencingNodes = referencedSymbols
    .map(s => s.getReferences())
    .reduce(/*...etc..*/)
    .filter(r => !r.isDefinition())
    .map(r => r.getNode()))

Would be nice if there was also a method for getting just the nodes (ex. classDeclaration.getReferencingNodes() and node.getDefinitionNodes()).

@dsherret
Copy link
Owner Author

dsherret commented Apr 1, 2018

  • NamedNode and NameableNode - Added .getReferencingNodes() and findReferences().
  • Identifier - Added getDefinitionReferencingNodes() and getDefinitionNodes()

@dsherret dsherret closed this as completed Apr 1, 2018
dsherret added a commit that referenced this issue Apr 1, 2018
dsherret added a commit that referenced this issue May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant