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.
This commit is contained in:
Chris Tate
2026-09-28 19:01:50 -05:00
committed by GitHub
parent 2a23ddc37d
commit f668fc4bfd
79 changed files with 3726 additions and 512 deletions
+6 -14
View File
@@ -1,14 +1,6 @@
// The DataView fences: `.buffer` escaping the one composed position that
// consumes it and a constructor
// over something that isn't a typed array's `.buffer`.
const buf = new Uint8Array(8);
const view = new DataView(buf.buffer);
// '.buffer' only compiles inside new DataView(x.buffer, ...).
const escaped = buf.buffer;
// The constructor wants a typed array's own '.buffer'.
const ab = new ArrayBuffer(8);
const direct = new DataView(ab);
void view;
// Stored ArrayBuffers and DataViews lower; Float16 accessors remain unsupported.
const buffer = new ArrayBuffer(16);
const view = new DataView(buffer);
view.setFloat16(0, 1.5);
console.log(view.getFloat16(0));
// End of the diagnostic fixture.
-9
View File
@@ -1,9 +0,0 @@
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);
+5
View File
@@ -0,0 +1,5 @@
// The native implementation covers default Unicode grapheme segmentation.
new Intl.Segmenter("en-US");
new Intl.Segmenter(undefined, { granularity: "word" });
new Intl.Segmenter(undefined, { granularity: "sentence" });
// End of the diagnostic fixture.