Commit Graph

1941 Commits

Author SHA1 Message Date
b59f08a1b8 js-on-sx: expose more built-ins on js-global (Function, Errors, Promise, etc.)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 43s
2026-05-09 10:58:38 +00:00
3e8aae77d5 js-on-sx: expression statements support comma operator
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 43s
2026-05-09 10:19:24 +00:00
d145532afe js-on-sx: instanceof accepts function operands (fn instanceof Function/Object)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 44s
2026-05-09 09:44:48 +00:00
86f7a351fb js-on-sx: relational ops ToPrimitive operands + NaN-safe le/ge
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
2026-05-09 09:13:06 +00:00
e4c92a19d4 js-on-sx: Error/TypeError/etc return instance when called without new
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
2026-05-09 08:35:11 +00:00
21d0be58ec js-on-sx: typeof <ident> returns "undefined" for unresolvable references
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s
2026-05-09 08:04:21 +00:00
5632830118 js-on-sx: js-loose-eq honours NaN inequality across numeric/string paths
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
2026-05-09 07:33:03 +00:00
dcde14a471 js-on-sx: lexer treats } as ending regex context
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
2026-05-09 07:01:11 +00:00
cb272317bc js-on-sx: js-to-number returns NaN for functions, coerces lists
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
2026-05-09 06:29:06 +00:00
013ce15357 js-on-sx: js-add ToPrimitive's Date and plain Objects via valueOf/toString
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
2026-05-09 05:56:01 +00:00
76d6528c51 js-on-sx: js-add unwraps wrapper objects before string-concat decision
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 20s
2026-05-09 05:25:06 +00:00
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