code wiki / _hdl_build / nx_js_accessor_probe.nx
nx_js_accessor_probe.nx source
↩ module page · 36 lines · 2222 B
1// nx_js_accessor_probe.nx -- JS-SOTA: name the construct at the netflix frontier (2026-07-29).
2// After the Unicode-identifier fix, netflix's bundle fails inside TypeScript's downlevel
3// async helper at `t.trys.push([0,4,,5])` -- an ARRAY LITERAL WITH AN ELISION (hole).
4// Controls first, so a FAIL row is a named gap and not a broken probe.
5import "nx_syscalls.nx"
6import "nx_js_eval.nx"
7
8func bp_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
9func bp_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
10func bp_try(label: *u8, src: *u8) -> i64 {
11 let out: *i64 = sys_mmap(16) as *i64
12 let rc: i64 = js_run_source(src, bp_len(src), out)
13 bp_p(label)
14 if rc == 0 { bp_p(" OK\x0a\x00" as *u8); return 1 }
15 bp_p(" FAIL\x0a\x00" as *u8)
16 return 0
17}
18
19
20func main() -> i64 {
21 let c1: i64 = bp_try("C1 plain method {m(){}} \x00" as *u8, "var o={m(){return 1}}; o.m();\x00" as *u8)
22 let c2: i64 = bp_try("C2 get as PLAIN KEY {get:fn} \x00" as *u8, "var o={get:function(t){return t}}; o.get(1);\x00" as *u8)
23 let c3: i64 = bp_try("C3 new + call new R('a') \x00" as *u8, "var r=new RegExp('a'); 1;\x00" as *u8)
24 let s1: i64 = bp_try("S1 GETTER {get k(){}} \x00" as *u8, "var o={get k(){return 7}}; 1;\x00" as *u8)
25 let s2: i64 = bp_try("S2 SETTER {set k(v){}} \x00" as *u8, "var o={set k(v){}}; 1;\x00" as *u8)
26 let s3: i64 = bp_try("S3 new + MEMBER CALL new R('a').exec \x00" as *u8, "var m=new RegExp('a').exec('a'); 1;\x00" as *u8)
27 let s4: i64 = bp_try("S4 generator function*g(){} \x00" as *u8, "function* g(){ yield 1; } 1;\x00" as *u8)
28 let s5: i64 = bp_try("S5 yield* delegate yield* x \x00" as *u8, "function* g(){ yield* [1,2]; } 1;\x00" as *u8)
29 let tot: i64 = c1+c2+c3+s1+s2+s3+s4+s5
30 bp_p("accessor-probe passed=\x00" as *u8)
31 let d: *u8 = sys_mmap(8); var tv: i64 = tot; if tv >= 10 { d[0]=(48+tv/10) as u8; sys_write(1,d,1); tv = tv%10 } d[0] = (48 + tv) as u8; sys_write(1, d, 1)
32 bp_p("/8\x0a\x00" as *u8)
33 if tot == 8 { sys_exit(0) }
34 sys_exit(1)
35 return 0
36}