Commit Graph

143 Commits

Author SHA1 Message Date
41dbac55b8 js-on-sx: rational handling in typeof/to-string/strict-eq/loose-eq
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
2026-05-09 04:53:11 +00:00
9bf4bd6180 js-on-sx: js-to-number coerces SX rationals via exact->inexact
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 34s
2026-05-09 04:19:51 +00:00
141795449a js-on-sx: parseFloat/parseInt return NaN for digitless prefix
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s
2026-05-09 03:42:47 +00:00
a6793fa656 js-on-sx: parseFloat recognises Infinity prefix
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
2026-05-09 03:13:21 +00:00
e5709c5aec js-on-sx: lexer rejects bare backslash in source
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 38s
2026-05-09 02:41:58 +00:00
0b7d88bbe1 js-on-sx: map js-transpile-* errors to SyntaxError in negative-test classifier
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 20s
2026-05-09 02:01:41 +00:00
b57f40db63 js-on-sx: getOwnPropertyDescriptor handles arrays + strings
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
2026-05-09 01:32:39 +00:00
c8ab505c32 js-on-sx: fix RegExp test/exec calling nil when platform impl missing
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
2026-05-09 01:01:39 +00:00
7c63fd8a7f js-on-sx: RegExp constructor wraps existing regex stub
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
2026-05-09 00:24:45 +00:00
c45a2b34a0 js-on-sx: js-is-space? covers full ES WhiteSpace + LineTerminator set
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 49s
2026-05-08 23:52:44 +00:00
20997d3360 js-on-sx: NativeError prototype chain + [object Error/Date/Map/Set] brands
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 49s
2026-05-08 23:08:01 +00:00
a1030dce5d js-on-sx: object literal __proto__ + try/catch error wrapping
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 36s
2026-05-08 22:13:17 +00:00
0d9c45176b js-on-sx: Date constructor + prototype stubs
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 36s
2026-05-08 21:30:36 +00:00
d8b8de6195 js-on-sx: Error.isError + [[ErrorData]] slot + verifyEqualTo
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 37s
2026-05-08 20:55:13 +00:00
ecae58316f js-on-sx: harness $DONE/asyncTest/checkSequence stubs
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 33s
2026-05-08 20:11:34 +00:00
1bff28e99e js-on-sx: Map and Set constructors with prototype methods
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
2026-05-08 19:40:30 +00:00
5b501f7937 js-on-sx: decodeURI/decodeURIComponent + harness decimalToHexString
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
2026-05-08 19:02:44 +00:00
0d99b5dfe8 js-on-sx: object computed keys + insertion-order tracking
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
2026-05-08 18:16:32 +00:00
a8d0dfb38a js-on-sx: bitwise ops & | ^ << >> (+ compound assigns)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s
2026-05-08 17:10:57 +00:00
ee422f3d15 js-on-sx: Function constructor compiles + evaluates JS source
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s
Was unconditionally throwing "Function constructor not supported".
Now js-function-ctor joins param strings with commas, wraps the
body in (function(<params>){<body>}), and runs it through js-eval.
Now Function('a', 'b', 'return a + b')(3,4) === 7.
built-ins/Function: 0/14 → 4/14. conformance.sh: 148/148.
2026-05-08 16:02:14 +00:00
f0dffd275d js-on-sx: arguments object + Array.from mapFn calling convention
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
Three related fixes:
1. Every JS function body binds arguments to (cons p1 ... __extra_args__),
   so arguments[k] and arguments.length work as expected.
2. Array.from(iter, mapFn) invokes mapFn through js-call-with-this
   with the index as second arg (was (map-fn x), missing index and
   inheriting outer this).
3. thisArg defaults to js-global-this when omitted (per non-strict ES).
conformance.sh: 148/148.
2026-05-08 15:31:33 +00:00
47e68454ad js-on-sx: String(arr) honours Array.prototype.toString overrides
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
Was always emitting comma-joined via js-list-join, so user
mutations of Array.prototype.toString had no effect on String(arr)
/ "" + arr. Now look up the override via js-dict-get-walk and call
it on the list as this; fall back to (js-list-join v ",") when the
override doesn't return a string.
String fail count: 11 → 9. conformance.sh: 148/148.
2026-05-08 14:46:35 +00:00
0b4f5e1df9 js-on-sx: top-level this resolves to the global object
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 15s
Per ES non-strict script semantics, top-level this is the global
object (window/global/globalThis). Was throwing "Undefined symbol:
this". Two-part fix:
1. js-global-this runtime variable set to js-global after globals
   are defined; js-this falls back to it when no this is active.
2. js-eval wraps transpiled body in (let ((this (js-this))) ...)
   so JS this resolves to bound this, or top-level to global.
Fixes String(this), this.Object === Object, etc.
built-ins/Object: 46/50 → 47/50. conformance.sh: 148/148.
2026-05-08 13:55:12 +00:00
4ab79f5758 js-on-sx: parser handles comma operator (a, b, c)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
Was failing with "Expected punct ')' got punct ','" because the
paren handler only consumed a single assignment. Added
jp-parse-comma-seq helpers that build a js-comma AST node with
the expression list; transpiler emits (begin ...) so each is
evaluated in order and the last value is returned.
built-ins/Object: 44/50 → 46/50. conformance.sh: 148/148.
2026-05-08 13:20:53 +00:00
b7627b4102 js-on-sx: ToPrimitive treats functions as non-primitive
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
Per ES, ToPrimitive only accepts strings/numbers/booleans/null
/undefined as primitives — objects AND functions trigger the next
step. Was treating function returns from toString/valueOf as
primitives (recursing to extract a string), so toString returning
a function didn't fall through to valueOf. Widened the dict-only
check to (or (= type "dict") (js-function? result)) in both
js-to-string and js-to-number ToPrimitive paths.
built-ins/String: 85/99 → 86/99. conformance.sh: 148/148.
2026-05-08 12:50:40 +00:00
d51ae65bbb js-on-sx: fn.toString honours Function.prototype.toString overrides
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 41s
Two hardcoded paths returned the native marker regardless of user
override: js-invoke-function-method and the lambda branch of
js-to-string. Both now look up Function.prototype.toString via
js-dict-get-walk and invoke it on the function, falling back to
the native marker only if no override exists.
built-ins/String: 84/99 → 85/99. conformance.sh: 148/148.
2026-05-08 12:07:55 +00:00
e97bdc4602 js-on-sx: native prototypes carry wrapped primitive marker
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 32s
Per ES, Boolean.prototype is a Boolean wrapper around false,
Number.prototype wraps 0, String.prototype wraps "". So
Boolean.prototype == false (loose-eq unwraps), and
Object.prototype.toString.call(Number.prototype) ===
"[object Number]". Set __js_*_value__ on each in post-init.
built-ins/Boolean: 23/27 → 24/27, String: 80/99 → 84/99.
conformance.sh: 148/148.
2026-05-08 11:27:18 +00:00
f03aa3056d js-on-sx: js-to-number throws TypeError on non-primitive
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 49s
Mirrors the earlier js-to-string fix. Number(obj) must throw
if ToPrimitive cannot extract a primitive (both valueOf and
toString return objects). Was returning NaN silently. Replaced
the inner (js-nan-value) fallback with (raise (js-new-call
TypeError ...)).
built-ins/Number: 45/50 → 46/50. conformance.sh: 148/148.
2026-05-08 10:53:58 +00:00
4c11c4e1b9 js-on-sx: native prototypes inherit from Object.prototype
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
Per ES, every native prototype's [[Prototype]] is Object.prototype
(and Function.prototype.[[Prototype]] is too). Was missing those
links, so Object.prototype.isPrototypeOf(Boolean.prototype)
returned false (the explicit isPrototypeOf walks __proto__, not
the recent fallback). Added 5 dict-set! lines to the post-init.
built-ins/Boolean: 22/27 → 23/27, built-ins/Number: 44/50 → 45/50.
conformance.sh: 148/148.
2026-05-08 10:21:05 +00:00
88b3db2e9f js-on-sx: delete obj.key actually removes the key
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 28s
js-delete-prop was setting value to js-undefined instead of
removing the key, so 'key' in obj remained true and proto-chain
lookup didn't fall through. Switched to dict-delete!.
Now delete Boolean.prototype.toString; Boolean.prototype.toString()
walks up to Object.prototype.toString and returns "[object Boolean]".
built-ins/Boolean: 21/27 → 22/27. conformance.sh: 148/148.
2026-05-08 09:49:18 +00:00
082749f0a9 js-on-sx: Boolean(NaN) === false
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
js-to-boolean was returning true for NaN because NaN != 0 by IEEE
semantics — the (= v 0) test fell through to the truthy else.
Per ES, NaN is one of the falsy values. Added a
(js-number-is-nan v) clause.
built-ins/Boolean: 19/27 → 21/27. conformance.sh: 148/148.
2026-05-08 09:19:21 +00:00
7a898567e4 js-on-sx: global eval(src) actually evaluates the source
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 51s
Was returning the input unchanged: eval('1+2') gave "1+2".
Per spec, eval(string) parses and evaluates as JS; non-string
passes through. Wired through js-eval (existing
lex/parse/transpile/eval pipeline).
built-ins/String fail count 13 → 11. conformance.sh: 148/148.
2026-05-08 08:44:34 +00:00
1b7bb5ad1f js-on-sx: new <non-callable> throws TypeError instead of hanging
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s
new (new Object("")) hung because js-new-call called
js-get-ctor-proto -> js-ctor-id -> inspect, and inspect on a
wrapper-with-proto-chain recurses through the prototype's
lambdas forever. Added (js-function? ctor) precheck at the top
of js-new-call that raises a TypeError instance instead.
conformance.sh: 148/148.
2026-05-08 07:17:44 +00:00
bfec2a4320 js-on-sx: JS functions accept extra args silently
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
SX strictly arity-checks lambdas; JS allows passing more args than
declared (extras accessible via arguments). Was raising "f expects
1 args, got 2" whenever Array.from passed (value, index) to a
1-arg mapFn. Fixed in js-build-param-list: every JS param list
now ends with &rest __extra_args__ unless an explicit rest is
present, so extras are silently absorbed.
conformance.sh: 148/148.
2026-05-08 06:36:54 +00:00
b1023f11d9 js-on-sx: lower array pad bail-out to 1M to kill remaining hang
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
The 2^32-1 threshold still allowed indices like 2147483648 to pad
billions of undefineds. Without sparse-array support there's no
semantic value in >1M padding; lowering the bail turns those tests
into fast assertion fails instead of timeouts.
built-ins/Array timeouts: 2 → 1. conformance.sh: 148/148.
2026-05-08 06:03:54 +00:00
16f7a14506 js-on-sx: bail out of array set/length at 2^32-1 instead of padding
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
arr[4294967295] = 'x' and arr.length = 4294967295 were padding
the SX list with js-undefined for ~4 billion entries — instant
timeout. Per ES spec, indices >= 2^32-1 aren't array indices
anyway (regular properties, which we can't store on lists).
Added (>= i 4294967295) bail clauses to js-list-set! and the
length setter.
built-ins/Array: 21/45 → 23/45 (5 timeouts → 2).
conformance.sh: 148/148.
2026-05-08 05:31:50 +00:00
0cfaeb9136 js-on-sx: built-in .length returns spec-defined values
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
String.fromCharCode.length, Math.max.length, Array.from.length
were returning 0 because their SX lambdas use &rest args with no
required params — but spec assigns each a specific length.
Added js-builtin-fn-length mapping JS name to spec length (12
entries). js-fn-length consults the table first and falls back to
counting real params.
built-ins/String: 79/99 → 80/99, built-ins/Array: 20/45 → 21/45.
conformance.sh: 148/148.
2026-05-08 05:01:12 +00:00
8d9ce7838d js-on-sx: Object.prototype.toString dispatches by [[Class]]
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Was hardcoded to "[object Object]" for everything; per ES it should
return "[object Array]", "[object Function]", "[object Number]",
etc. by class. Added js-object-tostring-class helper that switches
on type-of and dict-internal markers (__js_*_value__,
__callable__). Prototype-identity checks ensure
Object.prototype.toString.call(Number.prototype) returns
"[object Number]" (similar for String/Boolean/Array).
built-ins/Array: 18/45 → 20/45, built-ins/Number: 43/50 → 44/50.
conformance.sh: 148/148.
2026-05-08 04:26:37 +00:00
fb0ca374a3 js-on-sx: Math.X.name maps SX names to JS for trig/log/etc.
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
js-unmap-fn-name had mappings for older Math methods but not the
trig/hyperbolic/log family added later. Added 22 mappings for sin,
cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, asinh, acosh,
atanh, exp, log, log2, log10, expm1, log1p, clz32, imul, fround.
built-ins/Math: 42/45 → 45/45 (100%). conformance.sh: 148/148.
2026-05-08 03:52:21 +00:00
d676bcb6b7 js-on-sx: fn.constructor === Function for function instances
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
Per ES, every function instance's constructor slot points to the
Function global. Was returning undefined for (function () {})
.constructor. Added constructor to the function-property cond in
js-get-prop; returns js-function-global.
conformance.sh: 148/148.
2026-05-08 03:24:31 +00:00
9b07f97341 js-on-sx: js-new-call honours function-typed constructor returns
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
new Object(func) should return func itself (per ES spec - "if value
is a native ECMAScript object, return it"), but js-new-call only
kept the ctor's return when it was dict or list — functions fell
through to the empty wrapper. Added (js-function? ret) to the
accept set.
built-ins/Object: 42/50 → 44/50. conformance.sh: 148/148.
2026-05-08 02:52:11 +00:00
0df2b1c7b2 js-on-sx: hoist var across nested blocks; var-decls become set!
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
JS var is function-scoped, but the transpiler only collected
top-level vars and re-emitted (define) everywhere; for-body var
shadowed the outer (un-hoisted) scope. Three-part fix:
1. js-collect-var-names recurses into js-block/js-for/js-while
   /js-do-while/js-if/js-try/js-switch/js-for-of-in;
2. var-kind decls emit (set! ...) instead of (define ...) since
   the binding is already created at function scope;
3. js-block uses js-transpile-stmt-list (no re-hoist) instead of
   js-transpile-stmts.
built-ins/Array: 17/45 → 18/45, String: 77/99 → 78/99.
conformance.sh: 148/148.
2026-05-08 02:21:54 +00:00
24a67fae97 js-on-sx: arr.length = N extends the array
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 41s
js-list-set! was a no-op for the length key. Added a clause that
pads with js-undefined via js-pad-list! when target > current.
Truncation skipped: the pop-last! SX primitive doesn't actually
mutate the list (length unchanged after the call), so no clean
way to shrink in place from SX. Extension covers common cases.
built-ins/Array: 16/45 → 17/45. conformance.sh: 148/148.
2026-05-08 01:38:51 +00:00
b9dc69a3c1 js-on-sx: arrays inherit from Array.prototype on lookup miss
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
js-get-prop for SX lists fell through to js-undefined for any key
not in its hardcoded method list, so Array.prototype.myprop and
Object.prototype.hasOwnProperty were invisible to arrays.
Switched the fallback to walk Array.prototype via js-dict-get-walk,
which already chains to Object.prototype.
built-ins/Array: 14/45 → 16/45. conformance.sh: 148/148.
2026-05-08 01:00:32 +00:00
c8f9b8be06 js-on-sx: arrays accept numeric-string property keys
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 40s
JS arrays must treat string indices that look like numbers ("0",
"42") as the corresponding integer slot. js-get-prop and js-list-set!
only handled numeric key, falling through to undefined / no-op for
string keys. Added a (and (string-typed key) (numeric? key)) clause
that converts via js-string-to-number and recurses with the integer
key. built-ins/Array: 13/45 → 14/45. conformance.sh: 148/148.
2026-05-08 00:28:36 +00:00
82100603f0 js-on-sx: scope var defines + js-args for call args
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s
JS top-level var was emitting (define <name> X) at SX top level,
permanently rebinding any SX primitive of that name (e.g. var list
= X broke (list ...) globally). Two-part fix:
1. wrap transpiled program in (let () ...) in js-eval so defines
   scope to the eval and don't leak.
2. rename call-args constructor in js-transpile-args from list to
   js-args (a variadic alias) so even within the eval's own scope,
   JS vars named list don't shadow arg construction.
Array-literal transpile keeps list (arrays must be mutable).
built-ins/Object: 41/50 → 42/50. conformance.sh: 148/148.
2026-05-07 23:55:07 +00:00
06a5b5b07c js-on-sx: Object.__callable__ returns this for new Object() no-args
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 43s
js-new-call Object had set obj.__proto__ correctly, but then the
__callable__ returned a fresh (dict), which js-new-call's "use
returned dict over obj" rule honoured — losing the proto. Added
is-new check (this.__proto__ === Object.prototype) and return
this instead of a new dict when invoked as a constructor with
no/null args. Now new Object().__proto__ === Object.prototype.
built-ins/Object: 37/50 → 41/50. conformance.sh: 148/148.
2026-05-07 22:55:35 +00:00
2490c901bf js-on-sx: js-loose-eq unwraps Number and Boolean wrappers
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s
js-loose-eq only had a __js_string_value__ unwrap clause, so
Object(1.1) == 1.1 returned false. Added parallel clauses for
__js_number_value__ and __js_boolean_value__ in both directions.
Now new Number(5) == 5, Object(true) == true, etc.
built-ins/Object: 26/50 → 37/50. conformance.sh: 148/148.
2026-05-07 22:25:01 +00:00
27bfceb1aa js-on-sx: Object(value) wraps primitives in their wrapper class
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s
Per ES spec, Object('s') instanceof String, Object(42).constructor
=== Number, etc. Was passing primitives through as-is. Added cond
clauses to Object.__callable__ that dispatch by type and call
(js-new-call String/Number/Boolean (list arg)). The wrapper
constructors already store __js_*_value__ on this.
built-ins/Object: 16/50 → 26/50. conformance.sh: 148/148.
2026-05-07 22:08:49 +00:00
96a7541d70 js-on-sx: Object(null) and Object(undefined) return new empty object
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
Per ES spec, Object(value) returns a new object when value is null
or undefined. Was returning the argument itself, breaking
Object(null).toString(). Added a cond clause to Object.__callable__
that detects nil/js-undefined and falls through to (dict).
built-ins/Object: 15/50 → 16/50. conformance.sh: 148/148.
2026-05-07 21:19:43 +00:00