f5fad52d47f0255c905066aeb5150e127600bcbe
Replace complex template literal handling with a simple format-based
approach. Template literals like `hello ${x}` now compile to:
<push x>
OP_format_template expr_count=1, cpool_idx=N
where cpool[N] = "hello {0}"
The opcode handler parses the format string, substitutes {N} placeholders
with stringified stack values, and produces the result string.
Key implementation details:
- Uses PPretext (parser pretext) with pjs_malloc to avoid GC issues
- Re-reads b->cpool[cpool_idx] after any GC-triggering operation
- Opcode layout is u16 expr_count followed by u32 cpool_idx - the u16
must come first because compute_stack_size reads the pop count from
position 1 for npop_u16 format opcodes
Removed:
- OP_template_concat opcode and handler
- Tagged template literal support (users can use format() directly)
- FuncCallType enum (FUNC_CALL_TEMPLATE case no longer needed)
- Complex template object creation logic in js_parse_template
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Read the docs to get started.
Description
v0.9.2
Latest
Languages
C
99.4%
C++
0.4%