-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Improved the grammar of local functions #20368
Conversation
+ ; | ||
|
||
+local-function-body | ||
+local_function_body |
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.
❓ Does this rule not already exist with another name we can/should use?
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.
There is method_body
, but it also allows empty body (';'
; for abstract
, extern
and partial
methods), so it's not the same and I think it shouldn't be used here.
Also, it looks like arrow_expression_body
does not exist.
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.
Yes, arrow_expression_body
is referenced from some new specs even though it hasn't made its way into the language yet.
+ ; | ||
|
||
+local-function-modifiers | ||
+ : (async | unsafe) |
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.
Why split across two lines?
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.
That's the style used by the spec. I think it makes sense to stay consistent with it.
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.
Sounds good.
The fixes I made:
async
andunsafe
can be both used at the same time.