mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-28 06:53:42 +08:00
- Support published three.js rotations, bounds, ray intersections, culling, and vertex attributes on native and WASM targets without a JavaScript engine. - Preserve JavaScript class defaults, data descriptors, and captured loop bindings in static code. - Handle typed-array input unions and constructor identities while keeping unsupported method overrides explicit.
25 lines
732 B
TypeScript
25 lines
732 B
TypeScript
const callbacks: (() => string)[] = [];
|
|
for (let i = 0, label = 'a'; i < 3; i++) {
|
|
callbacks.push(() => `${i}:${label}`);
|
|
label += 'b';
|
|
if (i === 1) continue;
|
|
}
|
|
console.log(callbacks.map((fn) => fn()).join(','));
|
|
let initial: () => number = () => -1;
|
|
const body: (() => number)[] = [];
|
|
for (let i = 0, save = (initial = () => i); i < 2; i++) {
|
|
body.push(() => i);
|
|
}
|
|
console.log(initial(), body.map((fn) => fn()).join(','));
|
|
let sum = 0;
|
|
for (let i = 1, end = i + 3; i < end; i++) sum += i;
|
|
console.log(sum);
|
|
let escaped: () => number = () => -1;
|
|
outer: for (let i = 0, n = 3; i < n; i++) {
|
|
for (let j = 0, m = 2; j < m; j++) {
|
|
escaped = () => i + j + n + m;
|
|
if (j === 1) break outer;
|
|
}
|
|
}
|
|
console.log(escaped());
|