Files
scriptc/tests/diagnostics/arrow-bind.ts
Chris Tate 3d9a5a59da Compile bound inline arrow callbacks without a JavaScript engine
- Preserve lexical captures, callback identity, receiver effects, and default arguments in native bound arrows.
- Keep bound function name and length available through JavaScript aliases and checked storage.
2026-09-28 07:41:55 -05:00

8 lines
410 B
TypeScript

// Preset arguments, rest arrows, non-inline arrows and ordinary functions
// retain their explicit Function.prototype.bind refusal.
const preset = ((value: number) => value).bind(null, 1);
const rest = ((...values: number[]) => values.length).bind(null);
const arrow = (value: number) => value + 1;
const alias = arrow.bind(null);
const ordinary = (function (value: number) { return value + 2; }).bind(null);