-
Notifications
You must be signed in to change notification settings - Fork 143
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
Port babel-parser changes from 2022-01-10 to 2022-02-26 #716
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instructions: https://github.com/alangpierce/sucrase/wiki/Porting-changes-from-Babel's-parser 69246b6212 [babel 8] fix properties name for function-like TS nodes (#13709) 🚫 AST only. bc0d1ef860 v7.16.8 🚫 Release only. 478a9709ab Improve errors location tracking (#14130) 🚫 Change to error messaging details that were removed in Sucrase. 4a737547e5 v7.16.10 🚫 Release only. e5d29f6e40 fix: incorrect conciseBody lookahead (#14194) ✅ Bug doesn't appear in Sucrase, but I added a test anyway. 5266605528 v7.16.12 🚫 Release only. 5861002b33 Reinterpret << when parsing TS type arguments (#14145) ✅ Ported following a very similar implementation. 6b427ced22 Fuzz test location-related parser options (#14201) 🚫 Babel-internal change testing location logic not present in Sucrase. 96a8251def Add parser support for the "regexp unicode sets" proposal (#14086) ✅ No implementation necessary, but I added a quick test. f893b333a8 Add the `decoratorsAutoAccessors` parser plugin (#13681) ✅ Ported basic parsing for accessor properties. de5c7b1bce Parse destructuring private fields (#13931) ✅ Seems to be already working, and I added a test. 🚫 d50c18dbc2 fix: usePrivateName usage Only affects Babel scope code, not relevant to Sucrase. 🚫 b092bd0cb5 remove invalid test output Only affects Babel tests. df27d542ef proposal-pipe: Add support for `^^` and `@@` topics (#13973) 🚫 Sucrase is holding off on pipeline topic parsing until the details are finalized. Tracked in #674. 97a8bcb9cc Expose `.index` on Position to internally track nodes location (#14174) 🚫 Only affects class not used in Sucrase. 38c23cded4 v7.17.0 🚫 Release only. 19ede090eb parser: Update `babel-parser.d.ts` for 7v.17.0 features (#14266) 🚫 Not relevant to Sucrase. f52c70c357 v7.17.3 🚫 Release only. a53c2fa4a2 fix(ts): skip func-type param start on parsing (#14293) 🚫 Bug not present in Sucrase. 5749c16dc2 [tsx] raise error on single arrow type argument without comma (#14135) 🚫 Only affects error handling.
Codecov Report
@@ Coverage Diff @@
## main #716 +/- ##
==========================================
+ Coverage 85.53% 86.86% +1.33%
==========================================
Files 55 54 -1
Lines 5883 5665 -218
Branches 1332 1333 +1
==========================================
- Hits 5032 4921 -111
+ Misses 574 472 -102
+ Partials 277 272 -5
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
Benchmark resultsBefore this PR: 347.3 thousand lines per second Measured change: 0.97% faster (0.54% slower to 1.55% faster) |
1Lighty
pushed a commit
to Astra-mod/sucrase
that referenced
this pull request
Aug 14, 2022
) Instructions: https://github.com/alangpierce/sucrase/wiki/Porting-changes-from-Babel's-parser 69246b6212 [babel 8] fix properties name for function-like TS nodes (#13709) 🚫 AST only. bc0d1ef860 v7.16.8 🚫 Release only. 478a9709ab Improve errors location tracking (#14130) 🚫 Change to error messaging details that were removed in Sucrase. 4a737547e5 v7.16.10 🚫 Release only. e5d29f6e40 fix: incorrect conciseBody lookahead (#14194) ✅ Bug doesn't appear in Sucrase, but I added a test anyway. 5266605528 v7.16.12 🚫 Release only. 5861002b33 Reinterpret << when parsing TS type arguments (#14145) ✅ Ported following a very similar implementation. 6b427ced22 Fuzz test location-related parser options (#14201) 🚫 Babel-internal change testing location logic not present in Sucrase. 96a8251def Add parser support for the "regexp unicode sets" proposal (#14086) ✅ No implementation necessary, but I added a quick test. f893b333a8 Add the `decoratorsAutoAccessors` parser plugin (#13681) ✅ Ported basic parsing for accessor properties. de5c7b1bce Parse destructuring private fields (#13931) ✅ Seems to be already working, and I added a test. 🚫 d50c18dbc2 fix: usePrivateName usage Only affects Babel scope code, not relevant to Sucrase. 🚫 b092bd0cb5 remove invalid test output Only affects Babel tests. df27d542ef proposal-pipe: Add support for `^^` and `@@` topics (#13973) 🚫 Sucrase is holding off on pipeline topic parsing until the details are finalized. Tracked in alangpierce#674. 97a8bcb9cc Expose `.index` on Position to internally track nodes location (#14174) 🚫 Only affects class not used in Sucrase. 38c23cded4 v7.17.0 🚫 Release only. 19ede090eb parser: Update `babel-parser.d.ts` for 7v.17.0 features (#14266) 🚫 Not relevant to Sucrase. f52c70c357 v7.17.3 🚫 Release only. a53c2fa4a2 fix(ts): skip func-type param start on parsing (#14293) 🚫 Bug not present in Sucrase. 5749c16dc2 [tsx] raise error on single arrow type argument without comma (#14135) 🚫 Only affects error handling.
alangpierce
added a commit
that referenced
this pull request
Nov 27, 2022
Fixes #758 There was already some logic from #716 to handle cases like `f<<T>() => void>`, where we're transitioning from a non-type context to a type context and need to detect if `<<` is actually two open-type-parameter/argument tokens. There was a simpler missing case, though, which is that `<<` is never allowed within a type, so we should exit early with a simple `<` in a type context. There was already a similar case for `>`, so this just uses the same logic for `<`. This fixes the same issue in TS and Flow.
alangpierce
added a commit
that referenced
this pull request
Nov 28, 2022
Fixes #758 There was already some logic from #716 to handle cases like `f<<T>() => void>`, where we're transitioning from a non-type context to a type context and need to detect if `<<` is actually two open-type-parameter/argument tokens. There was a simpler missing case, though, which is that `<<` is never allowed within a type, so we should tokenize as a simple `<` in a type context. To handle the various cases correctly, this extra logic needs to only happen for `<<`, and this PR also adds some additional comments explaining the nuances.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instructions: https://github.com/alangpierce/sucrase/wiki/Porting-changes-from-Babel's-parser
69246b6212 [babel 8] fix properties name for function-like TS nodes (#13709)
🚫 AST only.
bc0d1ef860 v7.16.8
🚫 Release only.
478a9709ab Improve errors location tracking (#14130)
🚫 Change to error messaging details that were removed in Sucrase.
4a737547e5 v7.16.10
🚫 Release only.
e5d29f6e40 fix: incorrect conciseBody lookahead (#14194)
✅ Bug doesn't appear in Sucrase, but I added a test anyway.
5266605528 v7.16.12
🚫 Release only.
5861002b33 Reinterpret << when parsing TS type arguments (#14145)
✅ Ported following a very similar implementation.
6b427ced22 Fuzz test location-related parser options (#14201)
🚫 Babel-internal change testing location logic not present in Sucrase.
96a8251def Add parser support for the "regexp unicode sets" proposal (#14086)
✅ No implementation necessary, but I added a quick test.
f893b333a8 Add the
decoratorsAutoAccessors
parser plugin (#13681)✅ Ported basic parsing for accessor properties.
de5c7b1bce Parse destructuring private fields (#13931)
✅ Seems to be already working, and I added a test.
🚫 d50c18dbc2 fix: usePrivateName usage
Only affects Babel scope code, not relevant to Sucrase.
🚫 b092bd0cb5 remove invalid test output
Only affects Babel tests.
df27d542ef proposal-pipe: Add support for
^^
and@@
topics (#13973)🚫 Sucrase is holding off on pipeline topic parsing until the details are finalized. Tracked in #674.
97a8bcb9cc Expose
.index
on Position to internally track nodes location (#14174)🚫 Only affects class not used in Sucrase.
38c23cded4 v7.17.0
🚫 Release only.
19ede090eb parser: Update
babel-parser.d.ts
for 7v.17.0 features (#14266)🚫 Not relevant to Sucrase.
f52c70c357 v7.17.3
🚫 Release only.
a53c2fa4a2 fix(ts): skip func-type param start on parsing (#14293)
🚫 Bug not present in Sucrase.
5749c16dc2 [tsx] raise error on single arrow type argument without comma (#14135)
🚫 Only affects error handling.