Skip to content

JavaScript: Add support for top-level await. #1946

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
merged 1 commit into from
Sep 18, 2019

Conversation

xiemaisi
Copy link

Evaluation shows a number of syntax errors going away in the test suites of babel, test262, gecko-dev and ChakraCore. There is also a (smaller) number of new syntax errors in tests exercising various tricky cases where await is used as a normal identifier, but I don't think it's worth bothering with fixing those. There are no changes at all outside test suites.

@xiemaisi xiemaisi added the JS label Sep 18, 2019
@xiemaisi xiemaisi requested a review from a team as a code owner September 18, 2019 08:58
@asger-semmle
Copy link
Contributor

There is also a (smaller) number of new syntax errors in tests exercising various tricky cases where await is used as a normal identifier

OOI could you share an example of this?

@xiemaisi
Copy link
Author

Certainly: https://github.com/babel/babel/blob/0ee2c42b55e1893f0ae6510916405eb273587844/packages/babel-parser/test/fixtures/es2015/uncategorised/356/input.js#L

Technically, the proposal is to allow top-level await in modules. Presumably this test case is meant to be a stand-alone script, not a module, so await is not treated specially.

The parser only has a fairly vague idea of whether it is in a module or not, so I thought it best to always treat await as a keyword.

Copy link
Contributor

@asger-semmle asger-semmle left a comment

Choose a reason for hiding this comment

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

Thanks. LGTM

@semmle-qlci semmle-qlci merged commit 479fca9 into github:master Sep 18, 2019
@xiemaisi xiemaisi deleted the js/top-level-await branch October 17, 2019 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants