js-on-sx: object literal spread {...src}
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s

This commit is contained in:
2026-05-09 23:42:13 +00:00
parent f15a8d8fef
commit 25b30788b4
4 changed files with 70 additions and 8 deletions

View File

@@ -158,6 +158,8 @@ Each item: implement → tests → update progress. Mark `[x]` when tests green.
Append-only record of completed iterations. Loop writes one line per iteration: date, what was done, test count delta.
- 2026-05-09 — **Object literal spread `{...src}` parses + executes.** Per ES spec, object literals can include `...expr` to copy own enumerable properties from a source. `jp-parse-object-entry` was rejecting the leading `...` punct. Added a parser branch that records the AST under `:spread`. `js-transpile-object` emits `(js-obj-spread! _obj <src-expr>)` for spread entries, alongside the existing `(js-obj-set! _obj k v)` for regular entries. New `js-obj-spread!` runtime helper: dict source copies own enumerable keys (skipping internal `__js_order__` / `__proto__`); string source copies each character at its numeric index; list source copies elements at their numeric index; null/undefined no-op. Result: language/expressions/array 5/30 → 13/30 (+8). Object 30/30 holds. conformance.sh: 148/148.
- 2026-05-09 — **`Object.getOwnPropertyNames` throws on null/undefined and includes `"length"` for strings/arrays.** Was returning `(list)` for non-list/non-dict inputs; per spec it ToObject's the argument and returns own keys including the implicit `"length"` property for strings/arrays. Added explicit branches: null/undefined → TypeError, string → `["0","1",…,"n-1","length"]` via `js-string-keys-loop` then append, list → indices + `"length"`, dict → existing ordered path. Result: built-ins/Object/getOwnPropertyNames 19/30 → 20/30. Object 30/30 holds. conformance.sh: 148/148.
- 2026-05-09 — **`Object.values`/`entries` throw on null/undefined and walk strings.** Same shape as the previous `Object.keys` fix. Both methods returned `(list)` for non-dict input; per spec they ToObject the argument and yield the property values / `[k, v]` pairs. Added explicit branches: null/undefined → TypeError, string → walk character indices, dict → iterate own enumerable keys (skipping internal `__js_order__` / `__proto__`). Result: built-ins/Object/values 5/16 → 8/16, entries 5/17 → 9/17. Object 30/30 holds. conformance.sh: 148/148.