Repository navigation
Add parser support for explicit resource management (using/await using) - #4649
Conversation
…t using) Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
Test262 conformance changes
Tested main commit: |
jedel1043
left a comment
There was a problem hiding this comment.
Nice job! This seems like a very good starting point for the feature.
Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
|
Heyy @jedel1043, I have made the required updates. |
|
So... I’m thinking of implementing the remaining implementation in separate PRs. Does that work for you, or would you prefer if I handle this iteratively in a single PR? |
|
Open up multiple PRs please, it makes reviewing much easier |
| } | ||
|
|
||
| // Check if this is `await using` | ||
| let next_tok = cursor.peek(0, interner).or_abrupt()?; |
There was a problem hiding this comment.
Doesn't this need to use peek_no_skip_line_term? According to the spec, await using is only valid if there are no line terminators between both keywords.
I would suggest you do a pass through the spec to see if you can find small caveats like these
There was a problem hiding this comment.
Yep, I actually pushed this in the latest update 🙂 Went through the spec properly and added peek_no_skip_line_term() checks in all three spots (lexical.rs, declaration/mod.rs, and statement/mod.rs) with explicit line terminator validation. Also added solid test coverage for the no-line-terminator rule, destructuring rejection, AllowAwait checks, and the other early errors.
…rations Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
jedel1043
left a comment
There was a problem hiding this comment.
Amazing work! Can't wait to see the full proposal implemented
|
Hey @jedel1043, thanks for the review. Could you run the CI tests so I can check if anything breaks? Also, I think we should have a setting to run the CI automatically once the changes are approved by the maintainer. This would help contributors run tests and make improvements more easily. I’m also working on the next part of the proposal, but I need these changes to be merged first so I can open a new PR with the continued updates. |
That's enabled, but only if you have at least a PR merged into the project |
|
You could just run tests locally if you want early feedback :) |
ohh.. that's understandable 😅 |
Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
Head branch was pushed to by a user without write access
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4649 +/- ##
===========================================
+ Coverage 47.24% 59.12% +11.87%
===========================================
Files 476 563 +87
Lines 46892 62531 +15639
===========================================
+ Hits 22154 36970 +14816
- Misses 24738 25561 +823 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
|
Ping me after you fix the formatting so that I can merge this |
Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
9a47e5c to
667be98
Compare
Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
This Pull Request fixes/closes #4445
This PR introduces the parser foundation for the TC39 Explicit Resource Management proposal. It’s an initial step and does not yet include runtime support, which will be added gradually in future commits. Because this is a large feature, it will be developed over multiple commits.
It focuses on parsing support for using and await using, along with proper validation, AST integration, and test coverage. Runtime behavior is intentionally not included yet, using declarations are currently compiled as regular lexical bindings, with clear TODOs marking the follow-up work.
All existing parser tests continue to pass, and 5 new tests have been added for the new syntax. An example script and a short implementation roadmap are included to make future work straightforward.
This is the first step of a larger feature and is designed to be safe, incremental, and easy to review. Runtime disposal logic and related built-ins will be added in further commits of my work.
Thanks for reviewing!