js-on-sx: parser handles comma operator (a, b, c)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
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.
This commit is contained in:
@@ -418,17 +418,43 @@
|
|||||||
(dict-set! st :idx saved)
|
(dict-set! st :idx saved)
|
||||||
(jp-advance! st)
|
(jp-advance! st)
|
||||||
(let
|
(let
|
||||||
((e (jp-parse-assignment st)))
|
((e (jp-parse-comma-seq st)))
|
||||||
(jp-expect! st "punct" ")")
|
(jp-expect! st "punct" ")")
|
||||||
e)))
|
e)))
|
||||||
(do
|
(do
|
||||||
(dict-set! st :idx saved)
|
(dict-set! st :idx saved)
|
||||||
(jp-advance! st)
|
(jp-advance! st)
|
||||||
(let
|
(let
|
||||||
((e (jp-parse-assignment st)))
|
((e (jp-parse-comma-seq st)))
|
||||||
(jp-expect! st "punct" ")")
|
(jp-expect! st "punct" ")")
|
||||||
e)))))))
|
e)))))))
|
||||||
|
|
||||||
|
(define
|
||||||
|
jp-parse-comma-seq
|
||||||
|
(fn
|
||||||
|
(st)
|
||||||
|
(let
|
||||||
|
((first-expr (jp-parse-assignment st)))
|
||||||
|
(if
|
||||||
|
(jp-at? st "punct" ",")
|
||||||
|
(jp-parse-comma-seq-rest st (list first-expr))
|
||||||
|
first-expr))))
|
||||||
|
|
||||||
|
(define
|
||||||
|
jp-parse-comma-seq-rest
|
||||||
|
(fn
|
||||||
|
(st acc)
|
||||||
|
(do
|
||||||
|
(jp-advance! st)
|
||||||
|
(let
|
||||||
|
((next-expr (jp-parse-assignment st)))
|
||||||
|
(let
|
||||||
|
((acc2 (append acc (list next-expr))))
|
||||||
|
(if
|
||||||
|
(jp-at? st "punct" ",")
|
||||||
|
(jp-parse-comma-seq-rest st acc2)
|
||||||
|
(cons (quote js-comma) (list acc2))))))))
|
||||||
|
|
||||||
(define
|
(define
|
||||||
jp-collect-params
|
jp-collect-params
|
||||||
(fn
|
(fn
|
||||||
|
|||||||
@@ -1,45 +1,37 @@
|
|||||||
{
|
{
|
||||||
"totals": {
|
"totals": {
|
||||||
"pass": 46,
|
"pass": 46,
|
||||||
"fail": 2,
|
"fail": 4,
|
||||||
"skip": 0,
|
"skip": 0,
|
||||||
"timeout": 2,
|
"timeout": 0,
|
||||||
"total": 50,
|
"total": 50,
|
||||||
"runnable": 50,
|
"runnable": 50,
|
||||||
"pass_rate": 92.0
|
"pass_rate": 92.0
|
||||||
},
|
},
|
||||||
"categories": [
|
"categories": [
|
||||||
{
|
{
|
||||||
"category": "built-ins/Number",
|
"category": "built-ins/Object",
|
||||||
"total": 50,
|
"total": 50,
|
||||||
"pass": 46,
|
"pass": 46,
|
||||||
"fail": 2,
|
"fail": 4,
|
||||||
"skip": 0,
|
"skip": 0,
|
||||||
"timeout": 2,
|
"timeout": 0,
|
||||||
"pass_rate": 92.0,
|
"pass_rate": 92.0,
|
||||||
"top_failures": [
|
"top_failures": [
|
||||||
[
|
[
|
||||||
"Timeout",
|
"ReferenceError (undefined symbol)",
|
||||||
2
|
4
|
||||||
],
|
|
||||||
[
|
|
||||||
"Test262Error (assertion failed)",
|
|
||||||
2
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"top_failure_modes": [
|
"top_failure_modes": [
|
||||||
[
|
[
|
||||||
"Timeout",
|
"ReferenceError (undefined symbol)",
|
||||||
2
|
4
|
||||||
],
|
|
||||||
[
|
|
||||||
"Test262Error (assertion failed)",
|
|
||||||
2
|
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33",
|
"pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33",
|
||||||
"elapsed_seconds": 71.0,
|
"elapsed_seconds": 64.1,
|
||||||
"workers": 1
|
"workers": 1
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,22 @@
|
|||||||
# test262 scoreboard
|
# test262 scoreboard
|
||||||
|
|
||||||
Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33`
|
Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33`
|
||||||
Wall time: 71.0s
|
Wall time: 64.1s
|
||||||
|
|
||||||
**Total:** 46/50 runnable passed (92.0%). Raw: pass=46 fail=2 skip=0 timeout=2 total=50.
|
**Total:** 46/50 runnable passed (92.0%). Raw: pass=46 fail=4 skip=0 timeout=0 total=50.
|
||||||
|
|
||||||
## Top failure modes
|
## Top failure modes
|
||||||
|
|
||||||
- **2x** Timeout
|
- **4x** ReferenceError (undefined symbol)
|
||||||
- **2x** Test262Error (assertion failed)
|
|
||||||
|
|
||||||
## Categories (worst pass-rate first, min 10 runnable)
|
## Categories (worst pass-rate first, min 10 runnable)
|
||||||
|
|
||||||
| Category | Pass | Fail | Skip | Timeout | Total | Pass % |
|
| Category | Pass | Fail | Skip | Timeout | Total | Pass % |
|
||||||
|---|---:|---:|---:|---:|---:|---:|
|
|---|---:|---:|---:|---:|---:|---:|
|
||||||
| built-ins/Number | 46 | 2 | 0 | 2 | 50 | 92.0% |
|
| built-ins/Object | 46 | 4 | 0 | 0 | 50 | 92.0% |
|
||||||
|
|
||||||
## Per-category top failures (min 10 runnable, worst first)
|
## Per-category top failures (min 10 runnable, worst first)
|
||||||
|
|
||||||
### built-ins/Number (46/50 — 92.0%)
|
### built-ins/Object (46/50 — 92.0%)
|
||||||
|
|
||||||
- **2x** Timeout
|
- **4x** ReferenceError (undefined symbol)
|
||||||
- **2x** Test262Error (assertion failed)
|
|
||||||
|
|||||||
@@ -165,6 +165,8 @@
|
|||||||
(js-transpile-new (nth ast 1) (nth ast 2)))
|
(js-transpile-new (nth ast 1) (nth ast 2)))
|
||||||
((js-tag? ast "js-class")
|
((js-tag? ast "js-class")
|
||||||
(js-transpile-class (nth ast 1) (nth ast 2) (nth ast 3)))
|
(js-transpile-class (nth ast 1) (nth ast 2) (nth ast 3)))
|
||||||
|
((js-tag? ast "js-comma")
|
||||||
|
(cons (js-sym "begin") (map js-transpile (nth ast 1))))
|
||||||
((js-tag? ast "js-throw") (js-transpile-throw (nth ast 1)))
|
((js-tag? ast "js-throw") (js-transpile-throw (nth ast 1)))
|
||||||
((js-tag? ast "js-try")
|
((js-tag? ast "js-try")
|
||||||
(js-transpile-try (nth ast 1) (nth ast 2) (nth ast 3)))
|
(js-transpile-try (nth ast 1) (nth ast 2) (nth ast 3)))
|
||||||
|
|||||||
@@ -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.
|
Append-only record of completed iterations. Loop writes one line per iteration: date, what was done, test count delta.
|
||||||
|
|
||||||
|
- 2026-05-08 — **Comma operator `(a, b, c)` parses and evaluates left-to-right, returning last.** Was failing with `Expected punct ')' got punct ','` because `jp-try-arrow-or-paren` only consumed a single assignment expression. Added `jp-parse-comma-seq` / `jp-parse-comma-seq-rest` helpers that build a `js-comma` AST node with the list of expressions; the transpiler emits `(begin ...)` which evaluates each in order and returns the last. Fixes `Object((null,2,3),1,2)`-style tests. built-ins/Object: 44/50 → 46/50. conformance.sh: 148/148.
|
||||||
|
|
||||||
- 2026-05-08 — **ToPrimitive treats functions as non-primitive in `js-to-string` / `js-to-number`.** Per ES, ToPrimitive only accepts strings/numbers/booleans/null/undefined as primitives — objects AND functions must trigger the next conversion step. Was treating function returns from toString/valueOf as primitives (recursing to extract a string), so a `toString` returning a function wouldn't fall through to `valueOf`. Widened the dict-only check to `(or (= type "dict") (js-function? result))` in both ToPrimitive paths. Now `var o = {toString: () => function(){}, valueOf: () => { throw 'x' }}; new String(o)` propagates `'x'` from valueOf. built-ins/String: 85/99 → 86/99. conformance.sh: 148/148.
|
- 2026-05-08 — **ToPrimitive treats functions as non-primitive in `js-to-string` / `js-to-number`.** Per ES, ToPrimitive only accepts strings/numbers/booleans/null/undefined as primitives — objects AND functions must trigger the next conversion step. Was treating function returns from toString/valueOf as primitives (recursing to extract a string), so a `toString` returning a function wouldn't fall through to `valueOf`. Widened the dict-only check to `(or (= type "dict") (js-function? result))` in both ToPrimitive paths. Now `var o = {toString: () => function(){}, valueOf: () => { throw 'x' }}; new String(o)` propagates `'x'` from valueOf. built-ins/String: 85/99 → 86/99. conformance.sh: 148/148.
|
||||||
|
|
||||||
- 2026-05-08 — **`fn.toString()` and `String(fn)` honour `Function.prototype.toString` overrides.** Two hardcoded paths returned `"function () { [native code] }"` regardless of any user override: the function-method dispatch in `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 (`recv`/`v`) when available, falling back to the native marker only if no override exists. Now `Function.prototype.toString = ...; (function(){}).toString()` returns the override, and `new String(fn)` stores the override result. built-ins/String: 84/99 → 85/99. conformance.sh: 148/148.
|
- 2026-05-08 — **`fn.toString()` and `String(fn)` honour `Function.prototype.toString` overrides.** Two hardcoded paths returned `"function () { [native code] }"` regardless of any user override: the function-method dispatch in `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 (`recv`/`v`) when available, falling back to the native marker only if no override exists. Now `Function.prototype.toString = ...; (function(){}).toString()` returns the override, and `new String(fn)` stores the override result. built-ins/String: 84/99 → 85/99. conformance.sh: 148/148.
|
||||||
|
|||||||
Reference in New Issue
Block a user