Skip to content

Allow using a custom analyzer #934

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

Merged
merged 1 commit into from
Nov 2, 2019

Conversation

singpolyma-shopify
Copy link
Contributor

Export ExportsWalker to allow building custom walkers for analysis tools.

Allow an option to asc.main to get called with the Program object to
facilitate building custom CLIs on top of asc that call their own analysis
logic.

@dcodeIO
Copy link
Member

dcodeIO commented Nov 1, 2019

This seems like it could reuse the existing afterCompile transform, so exposing the walker would be sufficient.

@singpolyma-shopify
Copy link
Contributor Author

@dcodeIO that transform looks like it gives access to a Module but I'm not sure I can get the Program from there in order to run a walker? Maybe I'm just missing it.

@MaxGraey
Copy link
Member

MaxGraey commented Nov 1, 2019

If you need program better use afterParse hook:

afterParse(parser: Parser): void {
  const program = parser.program;
  ...
}

or you could save program reference and use it inside afterCompile hook later

Export ExportsWalker to allow building custom walkers for analysis tools.
@singpolyma-shopify
Copy link
Contributor Author

@MaxGraey thanks, I have it working using that strategy (save program reference from afterParse, then use in afterCompile).

So just the export, then.

@dcodeIO dcodeIO merged commit 93a5045 into AssemblyScript:master Nov 2, 2019
@dcodeIO
Copy link
Member

dcodeIO commented Nov 2, 2019

Alright, thanks! Maybe a word of caution: ExportsWalker is responsible for generating definitions, which hasn't been tested a lot. Might or might not work as expected, so if there are any issues, let us know :)

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

Successfully merging this pull request may close these issues.

3 participants