Files
Zachary D. Rowitsch 257b93c56b
Some checks failed
ci / fast (linux) (push) Has been cancelled
Implement unary plus operator (ES262 §13.5.4)
The parser had no arm for `TokenKind::Plus` in `parse_unary` and the AST
had no `UnaryOp::Plus` variant, so `+x` errored with "unexpected token:
'+'". Wired through end-to-end:

- AST: add `UnaryOp::Plus` variant
- Parser: handle `Plus` in `parse_unary`, mirroring `Neg`
- Bytecode compiler: emit `Opcode::ToNumber` (already existed) for Plus
- AST interpreter: `eval_unary` arm performing `coerce_to_number`

Promoted 26 Test262 known_fail cases that exercised unary `+` directly
or transitively (exponentiation A1-A18, abstract/strict comparisons,
ASI tests). Test262 pass rate: 768 → 794 (73% → 75%).

Found while loading google.com — Google's bootstrap calls `eval(...)`
with code containing `k(+(f=...))`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 13:43:55 -04:00
..