benjamn / benjamn/ast-types

Connecting a reference back to its object

Open
#359 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
194
Avg merge
22h 43m
Merged PRs (30d)
10

Description

Hello!
I am new to language parsing so please correct me if I use the wrong terminology. I'm searching for a library that would hand be an AST that would provide information for a consumer to connect a reference at one location to its original definition.

For example:

```javascript
var output = "Hello" // <- object X

function coolDude(asdf) { // <- function A
asdf += " ~~not so cool dude"
return asdf
}

function addWorld(to) {
function coolDude(asdf) { // <- function B
asdf += " cool duuuude"
return asdf
}

to += " world!"
return coolDude(to) // <- tell me Call B refers to object/function B (not function A)
}

output = addWorld(output /* <- refers to object X */)
output = coolDude(output) // <- tell me Call A refers to object/function A
```

etc etc.

I am unclear how to get this information through `ast-types` or if it is possible, going through the examples and breaking in at different points seems to only give me literal parsed information (location an expression is in source, what type of expression it is, correlated metadata such as arguments for a callee, etc etc).

Any help or direction would be much appreciated, thank you!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.