Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Fix issue where async as an id cannot be used with application and la… #708

Merged
merged 2 commits into from
Oct 28, 2022

Conversation

cristianoc
Copy link
Contributor

…belled arguments.

Fixes #707

@cristianoc
Copy link
Contributor Author

@IwanKaramazow would you check that there's nothing wrong with this fix in the heuristic for recognising es6 arrow functions? Is the early recognition of ~ just a perf shortcut, or does it have a deeper meaning?

let aw = (@foo (server->start))->foo

let foo = async(~a=34)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be more appropriate in the tests/parsing/grammar/expressions/async directory as it's really about parsing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did that first but wanted to check that it does not mess up printing.
Probably both.

@IwanKaramazow
Copy link
Contributor

Is the early recognition of ~ just a perf shortcut, or does it have a deeper meaning?

Perf shortcut. There wasn't a case where (~ didn't mean an arrow expression.

Your fix is correct. Upon finding the async keyword it will now search for the closing ) and then look for an => to confirm if we're in a arrow expression.

@cristianoc cristianoc merged commit 54118b3 into master Oct 28, 2022
@cristianoc cristianoc deleted the asyncApply branch October 28, 2022 06:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[10.1] Redefined async functions don't support named arguments
2 participants