mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
The forms the first slice answers now lower: x.toLocaleString() (and an
explicit undefined locale) to icu.numFormatDefault, the argument-free
Date#toLocaleString/toLocaleTimeString to the ICU date formatters, and
Intl.Segmenter({ granularity: "word" }) to the ICU word iterator (a
literal language tag is the locale; the empty string is the default).
Sentence segmentation keeps its refusing construction in JavaScript
dependencies, the grapheme segmenter stays the engine-free fast path,
and the code notes the deletion I4 schedules.
The refusals that named these forms follow: the four stdlib hints, the
Intl identifier hint, the Date method hint and the Segmenter option
messages list what lowers and what still does not (locale negotiation,
options bags, toLocaleDateString, formatter values). The library mode
refuses the icu.* libCalls, whose ambient locale state and data file a
library archive cannot carry, and the ambient process.config comment says
what a compiled binary can honestly answer.
An argument that IS undefined (exactly undefined, or void) means the
absent form and lowers; one whose type merely includes undefined may hold
a locale or an options bag at run time, and the constructor cannot read
either, so it is refused rather than silently treated as absent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
856 B
TypeScript
16 lines
856 B
TypeScript
// The island-backed ambient surface (number methods and Number statics)
|
|
// typechecks against real static types but executes in the embedded
|
|
// engine: in a static build every use site is its own SC2012 naming the
|
|
// flag — never an ICE, never a link error. Static Math methods include
|
|
// the scalar functions and variadic Math.hypot. The .split(string),
|
|
// trim/pad variants, parseInt, isNaN, the global parseFloat/isFinite and
|
|
// Number.parseFloat/Number.parseInt over exactly-typed arguments,
|
|
// string-pattern replacement and toPrecision compile statically now and no
|
|
// longer appear here; toLocaleString at an explicit non-en-US locale still
|
|
// has no lowering (the default-locale form lowers over ICU).)
|
|
const up = Math.cbrt(2);
|
|
const tau = Math.PI * 2;
|
|
const price = (19.99).toLocaleString("de-DE");
|
|
const n = Number.parseFloat("3.14");
|
|
void n;
|