Files
scriptc/tests/corpus/expression-runtime-values.ts
T
Chris Tate f668fc4bfd Support native runtime values used by OpenTUI
- Add shared ArrayBuffer storage and native Unicode grapheme segmentation.
- Preserve builtin modules, globals, and byte views across JavaScript bindings.
- Compile package initialization expressions and optional native callables.
2026-09-28 19:01:50 -05:00

17 lines
629 B
TypeScript

const n: number = 3;
const t = n > 0 ? "pos" : "neg";
const o = { ...{ a: 1 } };
const b = "a" in { a: 1 };
const m = typeof "ab".indexOf("b"); // a CALL operand — pure computations fold now
const u = n === 3 ? 1 : 2;
const s: string = "abc";
const mixed = n === 3 && s;
console.log(t, m, u, b, mixed, o.a);
let effects = "";
function produce(): number { effects += "called"; return 17; }
console.log(typeof produce(), effects);
function fail(): number { effects += ":throw"; throw new Error("operand"); }
try { console.log(typeof fail()); } catch (error) {
if (error instanceof Error) console.log(error.message, effects);
}