feat: allow multiline arrow functions #18500
Open
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.
I've played with the lexer and complete the multiline arrow functions.
Implementation is quite simple:
{}
{}
, like the regular functionsKey points:
RETURN
ast node, which is similar tofn() => return
, but it's not acceptable by the lexer. I didn't change that, just added a new way to allow multiline statements.The last think I don't know how to solve is #7900 issue:
Isn't handled by the
catch
, 'cause it leads to a Fatal error.Although, it looks correct because there is no RETURN token added implicitly
@iluuu1994 I remember you've preparing long arrow functions and match expressions, but I think it can be added separately, so I can reference your RFC if I go to there. What do you think?