{0: 41, 1: 42} was raising 'dict-set!: dict key val' because the parser
kept numeric keys as numbers in the entry dict, but SX dicts require string
keys. Now we str-coerce number-type tokens during jp-parse-object-entry.
Unblocks a huge chunk of test262 array-like-receiver tests that build
{length: N, 0: v, 1: v, ...} literals.
3 new tests, 453/455 total.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds js-invoke-function-method dispatched from js-invoke-method when the
receiver is a JS function (lambda/function/component/callable-dict) and the
method name is one of call/apply/bind/toString/name/length.
call and apply bind this around a single call; bind returns a closure with
prepended args. toString returns the native-code placeholder.
6 unit tests, 450/452 total (Array.prototype.push.call with arrayLike still
fails — tracked as the 455x 'Not callable array-like' scoreboard item which
needs array methods to treat dict-with-length as a list).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rework test262-runner.py to support --workers N parallel shards, each running
a long-lived sx_server session. Replace thread-per-readline with a select-based
raw-fd line buffer.
On 2-core machines, 1 worker still beats 2 (OCaml eval is CPU-bound and starves
when shared). Auto-defaults n_workers=1 on <=2 CPU, nproc-1 (up to 8) otherwise.
Throughput baseline: ~1.1 Math tests/s serial on 2-core (unchanged; the
evaluator dominates). The runner framework is now ready to scale on bigger
machines without further code changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
js-transpile-unop intercepts 'delete' before transpiling the
operand. Maps to (js-delete-prop obj key) for members and indexed
access. Runtime js-delete-prop sets the dict value to js-undefined
and returns true.
444/446 unit (+2), 148/148 slice unchanged.
Each prototype contains method-name → closure pairs. Each closure
reads this via js-this and dispatches through js-invoke-method.
Lets Array.prototype.push, String.prototype.slice etc. be accessed
and invoked as (expected) functions.
440/442 unit unchanged, 148/148 slice unchanged.
Array destructure now supports [a, ...rest]. Rest entry is
transpiled to (define name (js-list-slice tmp i (len tmp))).
Nested patterns like [[a,b], c] now parse (as holes) instead of
erroring. jp-skip-balanced skips nested groups.
440/442 unit (+2), 148/148 slice unchanged.
Parser: jp-parse-postfix handles op "?." followed by ident / [ / (
emitting (js-optchain-member obj name), (js-optchain-index obj k),
or (js-optchain-call callee args).
Transpile: each emits (js-optchain-get obj key) or (js-optchain-call
fn args).
Runtime: js-optchain-get and js-optchain-call short-circuit to
js-undefined when receiver is null/undefined.
423/425 unit (+5), 148/148 slice unchanged.
Parser: jp-array-loop and jp-call-args-loop detect punct "..."
and emit (js-spread inner).
Transpile: when any element is spread, build array/args via
js-array-spread-build with (list "js-value" v) and (list
"js-spread" xs) tags.
Runtime: js-array-spread-build walks items, appending values or
splicing spreads via js-iterable-to-list (handles list/string/dict).
Works in arrays, call args, variadic fns (Math.max(...arr)),
and string spread ([...'abc']).
414/416 unit (+5), 148/148 slice unchanged.
String: replace, search, match now work with either string or regex
arg. Regex path uses js-string-index-of on source (case-adjusted
when ignoreCase set).
Array.from(iter, mapFn?) normalizes via js-iterable-to-list and
optionally applies mapFn.
Fixed dict-set! on list bug in js-regex-stub-exec — just omit the
index/input metadata, spec-breaking but tests that just check [0]
work.
407/409 unit (+8), 148/148 slice unchanged.
flat: walk with depth, recursive when element is list and depth>0.
fill(value, start?, end?): in-place mutation, returns self.
indexOf: honor second arg as start position.
396/398 unit (+5), 148/148 slice unchanged.
String global with fromCharCode (variadic). parseInt truncates via
js-math-trunc; parseFloat delegates to js-to-number. Wired into
js-global.
381/383 unit (+5), 148/148 slice unchanged.
Parser: jp-parse-postfix emits (js-postfix op target) on trailing
++/--; jp-parse-primary emits (js-prefix op target) before the
unary -/+/!/~ branch.
Transpile: js-transpile-prefix → (set! name (+ (js-to-number name)
±1)) for idents, (js-set-prop obj key ...) for members/indices.
js-transpile-postfix caches old value in a let binding, updates,
returns the saved value.
340/342 unit (+11), 148/148 slice unchanged.
Math gains sqrt/pow/trunc/sign/cbrt/hypot plus LN2/LN10/LOG2E/
LOG10E/SQRT2/SQRT1_2 constants and full-precision PI/E.
Number global: isFinite/isNaN/isInteger/isSafeInteger plus
MAX_VALUE/MIN_VALUE/MAX_SAFE_INTEGER/MIN_SAFE_INTEGER/EPSILON/
POSITIVE_INFINITY/NEGATIVE_INFINITY/NaN.
Global isFinite, isNaN, Infinity, NaN. Wired into js-global.
329/331 unit (+21), 148/148 slice unchanged.
- runtime hs-add-to!/hs-append: dedupe on list targets (Set semantics)
- compiler emit-set: set result to X now syncs it too
- compiler append!: handle (local)/(ref) targets via emit-set so scoped
vars get rebound to the returned list
- parser add/remove: accept bare @attr (not just [@attr])
- parser add-attr: support when-clause → emits add-attr-when
- compiler add-class-when/add-attr-when: collect matched items into
the-result / it so subsequent "if the result is empty" works
+6 upstream tests in early range (add 13→17, append 10→12).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Initial commit of the lib/js/ tree and plans/ directory. A previous
session left template-string work in progress — 278/280 unit tests pass
(2 failing: tpl part-count off-by-one, escaped-backtick ident lookup).
test262-runner.py and scoreboard are placeholders (0/8 with 7 timeouts);
fixing the runner is the next queue item.