Skip to content

CodeQL confused by property named "await" in JavaScript code #22499

Description

@ericcornelissen

Description of the issue

CodeQL has a parse error when JavaScript code contains a property access expression for the property "await" inside an async function, even though this is perfectly valid JavaScript, which you can confirm with this snippet:

const o = { await: 42 };async function x() {console.log(o.await)};x();

For example this parse error emitted by CodeQL in GitHub Actions:

   * src/npm.js#L99C30:30: A parse error occurred: `Can not use 'await' as identifier inside an async function`. Check the syntax of the file. If the file is invalid, correct the error or [exclude](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning) the file from analysis.

corresponds to this expression:

const results = await pool.await();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions