Fix root cause: parse-int in primitives table handles 2-arg form

The CSSX colour resolution failure was NOT a JIT compiler bug.
CALL_PRIM looks up primitives table (not env), and parse-int in
the primitives table only handled 1-arg calls. The 2-arg form
(parse-int "699" nil) returned Nil, causing cssx-resolve's colour
branch to fail its and-condition.

Fix: update Sx_primitives.register "parse-int" with same 2-arg
handling as the env binding. Remove the vm-reset-fn workaround.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 17:02:14 +00:00
parent b1de591e9e
commit 9ff913c312
2 changed files with 4 additions and 11 deletions

View File

@@ -119,7 +119,10 @@ let () =
register "parse-int" (fun args ->
match args with
| [String s] -> (match int_of_string_opt s with Some n -> Number (float_of_int n) | None -> Nil)
| [Number n] -> Number (float_of_int (int_of_float n))
| [String s; default_val] ->
(match int_of_string_opt s with Some n -> Number (float_of_int n) | None -> default_val)
| [Number n] | [Number n; _] -> Number (float_of_int (int_of_float n))
| [_; default_val] -> default_val
| _ -> Nil);
register "parse-float" (fun args ->
match args with