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

Implement @ets inline #7

Open
0x706b opened this issue Jan 29, 2022 · 0 comments
Open

Implement @ets inline #7

0x706b opened this issue Jan 29, 2022 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@0x706b
Copy link
Contributor

0x706b commented Jan 29, 2022

discord link

So an idea, we could in theory have a generic @ets inline that works like:

1) if specified in a function in a .ts file it ensures the function body doesn't access any external symbol except the arguments
2) emits in the .d.ts an added text to the jsdoc like @ets inline self.map(f)
3) when a call expression uses it the compiler inline the implementation

This requires a few tricks though:
1) to process the .d.ts we need to extend the Parser to produce a valid ast and check the ast like any normal TS
2) the .d.ts and the plain .ts should end up with the same ast structure
3) the transformer needs to parse and replace the identifiers in the ast respective to the function arguments, if the body isn't a simple expression but a body like {return ...} the function should be inlined fully and called
@0x706b 0x706b created this issue from a note in TypeScript Extensions (To do) Jan 29, 2022
@mikearnaldi mikearnaldi added the help wanted Extra attention is needed label Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Development

No branches or pull requests

2 participants