-
-
Notifications
You must be signed in to change notification settings - Fork 411
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 by Bors] - Implement arrow function parsing based on CoverParenthesizedExpressionAndArrowParameterList
#2171
Conversation
…nAndArrowParameterList
Test262 conformance changesVM implementation
Fixed tests (694):
|
Codecov Report
@@ Coverage Diff @@
## main #2171 +/- ##
==========================================
- Coverage 42.04% 41.89% -0.16%
==========================================
Files 231 231
Lines 21271 21498 +227
==========================================
+ Hits 8943 9006 +63
- Misses 12328 12492 +164
Continue to review full report at Codecov.
|
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.
Parsing arrow functions was probably the messiest part of the parser. This looks so much better!
Thank you for fixing this :) I gave it a look from my phone and it looks pretty good, just had a few comments, but looks good from my side!
boa_engine/src/syntax/parser/expression/primary/object_initializer/mod.rs
Outdated
Show resolved
Hide resolved
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.
Looks good to me! :)
bors r+ |
…onAndArrowParameterList` (#2171) Previously we parsed arrow functions without the relevant cover grammar `CoverParenthesizedExpressionAndArrowParameterList`. This leads to either arrow functions or parenthesized expressions not being parsed correctly. Implementing this is a bit tricky, as the cover grammar is being parsed in `PrimaryExpression` while arrow functions are parsed in `AssignmentExpression`. This means that we have to return the covered parameter list that was parsed via `CoverParenthesizedExpressionAndArrowParameterList` in `PrimaryExpression` to `AssignmentExpression`. Fortunately this works pretty good and now the full arrow function test suite, with the exception of a few tests that require other features, passes. This Pull Request changes the following: - Implement `CoverParenthesizedExpressionAndArrowParameterList` parsing. - Implement `CoverInitializedName` parsing in object literals. - Fix a bug where an environment would be wrongly removed from the environment stack when an expression in default function parameters throws. - Add more valid cases where on object literal can be converted to an object declaration pattern. - Implement `Expression` parsing manually to avoid some cases where the parser would prematurely throw an error. - Implement parsing of arrow functions via `CoverParenthesizedExpressionAndArrowParameterList`. - Remove unneeded `AllowIn` flag on array and object declaration pattern parsers. - Fix an of-by-one bug in the trace output.
Pull request successfully merged into main. Build succeeded: |
CoverParenthesizedExpressionAndArrowParameterList
CoverParenthesizedExpressionAndArrowParameterList
Previously we parsed arrow functions without the relevant cover grammar
CoverParenthesizedExpressionAndArrowParameterList
. This leads to either arrow functions or parenthesized expressions not being parsed correctly. Implementing this is a bit tricky, as the cover grammar is being parsed inPrimaryExpression
while arrow functions are parsed inAssignmentExpression
. This means that we have to return the covered parameter list that was parsed viaCoverParenthesizedExpressionAndArrowParameterList
inPrimaryExpression
toAssignmentExpression
. Fortunately this works pretty good and now the full arrow function test suite, with the exception of a few tests that require other features, passes.This Pull Request changes the following:
CoverParenthesizedExpressionAndArrowParameterList
parsing.CoverInitializedName
parsing in object literals.Expression
parsing manually to avoid some cases where the parser would prematurely throw an error.CoverParenthesizedExpressionAndArrowParameterList
.AllowIn
flag on array and object declaration pattern parsers.