-
-
Notifications
You must be signed in to change notification settings - Fork 689
feat: parse and preserve parameter decorators in AST #3023
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -273,6 +273,11 @@ export abstract class Transform { | |
| /** Lists all files in a directory. */ | ||
| listFiles(dirname: string, baseDir: string): (string[] | null) | Promise<string[] | null>; | ||
|
|
||
| /** Called after program initialization, before WASM compilation. Transformers should use | ||
| * this hook to perform custom validation of AST constructs such as parameter decorators | ||
| * and emit their own diagnostics. Decorators remain in the AST unchanged. */ | ||
| beforeCompile?(program: Program): void | Promise<void>; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's even less clear why we need
Specialized validate would be appropriate more, as I suggested. Because it could optionally interrupt the compilation flow without trigger exception (soft bail)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm gonna assume you meant:
I think a preliminary discussion on this might be a good idea before I just jump and and start adding stuff 😅. Maybe a change to the transformer API should be delegated to it's own PR? What do you think? That would allow this PR to focus solely on adding decorators to the AST.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, copy-paste typo
If this is not a blocker then that’s actually how it should be. |
||
|
|
||
|
Comment on lines
+276
to
+280
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This can be cited as an example, not as a requirement. Also, the comment is rather wordy. |
||
| /** Called when parsing is complete, before a program is instantiated from the AST. */ | ||
| afterParse?(parser: Parser): void | Promise<void>; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I haven't seen any indication that it's been integrated into the pipeline and well tested. For instance
afterParse:https://github.com/search?q=repo%3AAssemblyScript%2Fassemblyscript+afterParse&type=code
for
beforeCompileneed to do the same