Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion src/js_parser/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@
decls: decls_slice,
});
}
let r = p.store_name_in_ref(raw)?;
let r = p.store_name_in_ref(raw2)?;

Check notice on line 922 in src/js_parser/parse/mod.rs

View check run for this annotation

Claude / Claude Code Review

await using.foo ** x not rejected (TAsteriskAsterisk check runs before parse_suffix in the using-identifier fallback)

🟣 Pre-existing (distinct from the line-885 note above): in this same fallback, the `TAsteriskAsterisk` check at line 936 runs *before* `parse_suffix` at line 939, so `await using.foo ** x` (and `using[0]`/`using()`/`using`tpl`` followed by `**`) is silently accepted as `(await using.foo) ** x` instead of the spec-required SyntaxError. The else-branch (line 933) and `parse_prefix`'s await handler both check `**` *after* parsing the prefix expression, so `await x.foo ** y` for any other `x` is cor

Check notice on line 922 in src/js_parser/parse/mod.rs

View check run for this annotation

Claude / Claude Code Review

Same raw→raw2 bug left unfixed in Zig reference (parse.zig:719)

🟣 Pre-existing parity gap: the Zig reference this code was ported from still has the identical `raw` → `raw2` bug at `src/js_parser/parse/parse.zig:719` (`.ref = try p.storeNameInRef(raw)` inside the `raw2 == "using"` fallback). That `parseExprOrLetStmt` is still wired in via `p.zig:94` and called from `parse_stmt.zig`, so any build path routed through the Zig parser (e.g. the WASM target via `main_wasm.zig`) retains the original `await await instanceof o` miscompile, and a future re-sync from t
Comment thread
robobun marked this conversation as resolved.
Comment thread
robobun marked this conversation as resolved.
Comment thread
robobun marked this conversation as resolved.
break 'value p.new_expr(
E::Identifier {
ref_: r,
Expand Down
17 changes: 17 additions & 0 deletions test/bundler/transpiler/transpiler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3824,6 +3824,23 @@ console.log("boop");
expectCapturePrintedSnapshot(`for await (await using a of b) { c(a); a(c) }`);
});

it("await of the identifier 'using' is not an await using declaration", () => {
// "await using" only starts a declaration when followed by an identifier on
// the same line. Otherwise it's an "await" expression of the identifier "using".
expectPrinted_(
"async function f() { await using instanceof o }",
"async function f() {\n await using instanceof o;\n}",
);
expectPrinted_("async function f() { await using }", "async function f() {\n await using;\n}");
expectPrinted_("async function f() { await using\n x = 1 }", "async function f() {\n await using;\n x = 1;\n}");
expectPrinted_("async function f() { await using.foo() }", "async function f() {\n await using.foo();\n}");
expectPrinted_(
"async function f() { for (await using instanceof o;;); }",
"async function f() {\n for (await using instanceof o;; )\n ;\n}",
);
expectBunPrinted_("await using instanceof o", "await using instanceof o");
});

it("using top level", () => {
expectPrintedSnapshot(`
using a = b;
Expand Down
Loading