Files
scriptc/tests/corpus/for-multiple-bindings.ts
T
Chris Tate 537ea4d28d Compile three.js spatial queries and vertex attributes
- 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.
2026-09-29 21:51:28 -05:00

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());