Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions javascript/extractor/src/com/semmle/jcorn/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2296,9 +2296,9 @@ protected Identifier parseIdent(boolean liberal) {
&& (this.options.ecmaVersion() >= 6
|| inputSubstring(this.start, this.end).indexOf("\\") == -1))
this.raiseRecoverable(this.start, "The keyword '" + this.value + "' is reserved");
if (!isPrivateField && this.inGenerator && this.value.equals("yield"))
if (!liberal && !isPrivateField && this.inGenerator && this.value.equals("yield"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shipwright · HIGH

The change to parseIdent now suppresses the 'yield'/'await' identifier errors whenever liberal is true, not just for private fields.

Impact: The change to parseIdent now suppresses the 'yield'/'await' identifier errors whenever liberal is true, not just for private fields. The liberal flag is used in contexts beyond property names (e.g., error recovery, certain parsing modes), so this could silently accept invalid generator/async code that previously raised recoverable errors, changing downstream AST/error behavior for existing queries.

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

this.raiseRecoverable(this.start, "Can not use 'yield' as identifier inside a generator");
if (!isPrivateField && this.inAsync && this.value.equals("await"))
if (!liberal && !isPrivateField && this.inAsync && this.value.equals("await"))
this.raiseRecoverable(
this.start, "Can not use 'await' as identifier inside an async function");
name = String.valueOf(this.value);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import javascript

from JSParseError err

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shipwright · HIGH

The test only asserts that some JSParseError exists (select err), but the expected file is empty.

Impact: The test only asserts that some JSParseError exists (select err), but the expected file is empty. This means the test passes vacuously: it does not verify that the specific await/yield property-name cases parse without error, nor that unrelated parse errors are absent. A regression that makes the entire file fail to parse would still satisfy this query.

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

select err
1 change: 1 addition & 0 deletions javascript/ql/test/library-tests/AwaitPropertyName/options
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
semmle-extractor-options: --tolerate-parse-errors
10 changes: 10 additions & 0 deletions javascript/ql/test/library-tests/AwaitPropertyName/tst.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const pool = { await() { return 42; } };
const generator = { yield() { return 42; } };

async function issue22499() {
return await pool.await();
}

function* yieldPropertyName() {
return generator.yield();
}