`{ ..."ab" }` is `{}`; a throw in a `for await` body does not wait for the iterator's return()
Maintainers usually reply within 5 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c, javascript
Research direction
Start by reading the object spread path and JS_CopyDataProperties, then trace how the source is converted before its properties are copied. For the for await case, follow AsyncIteratorClose and its handling of throw completions. Use the two reproductions in the issue to check both behaviors; done means string properties are copied and iterator cleanup finishes before the catch runs.
Written by the indexing model from the issue text.
Description
1. Object spread of a string primitive copies nothing.
console.log(JSON.stringify({ ..."ab" })); // {"0":"a","1":"b"}
console.log(JSON.stringify({ ...new String("ab") })); // {"0":"a","1":"b"}
./qjs t.js prints {} for the first line; the second is correct, and so are Object.assign({}, "ab") and const {...r} = "ab". JS_CopyDataProperties returns early when the source is not an object, and the object-literal spread path doesn't convert the source with ToObject first.
2. A throw in a for await body doesn't await return().
const log = [];
async function* g() { try { yield 1; } finally { log.push("finally"); } }
(async () => {
try { for await (const v of g()) throw "t"; } catch (e) { log.push("catch"); }
console.log(log.join(" ")); // expected: finally catch
})();
Actual: catch (the finally runs later). With break instead of throw master is correct; the 2026-06-04 release gets both wrong. AsyncIteratorClose awaits the result of return() even when the completion is a throw.
Versions: master e5ac135 (2026-11-09) and release 2026-06-04, Linux x86-64.
Credit: https://ucsbplse.github.io/
- Dominant language
- C
- Stars
- 11.1k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bellard/quickjs
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 5 days
-
RegExp: patterns with more than 255 capture groups fail with "too many captures"Possibly taken @andreasrosdal claimed this 3 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
bellard/quickjs#624 · 1 comment ·
Maintainers usually reply within 5 days
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
bellard/quickjs#620 · 1 comment ·
Maintainers usually reply within 5 days
-
(comment on #611) `function g(a, d = (a = 10)) { return a; }` returns the argument instead of 10Open
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Maintainers usually reply within 5 days
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Maintainers usually reply within 5 days
Similar issues
-
new issue
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
llvm/llvm-project#245835 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 72/100
InauguralSystems/EigenScript#2537 · 1 comment ·
Maintainers usually reply within 1 day
-
Fix a typo in H5Centry.cPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
openwrt/openwrt#26942 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#2518 ·
Maintainers usually reply within 1 day