mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-24 06:14:01 +08:00
* Support Date instance lowering - Lower read-only Date values and constructors through the C and LLVM backends. - Add portable calendar helpers, differential coverage, and documented surface contracts. - Fence unsupported mutation, identity, locale, and component-constructor forms. Co-authored-by: sensei-woo <sensei-woo@users.noreply.github.com> * Fix Date exception and timezone semantics * fix: harden Date lowering edge cases * fix Date lowering edge cases * Fix Date union fences and offset clipping --------- Co-authored-by: sensei-woo <sensei-woo@users.noreply.github.com>
23 lines
598 B
TypeScript
23 lines
598 B
TypeScript
// Compiler-synthesized `T | undefined` slots must observe the same Date
|
|
// union fence as source-written unions. Each construct below used to reach
|
|
// IR validation as an SC9001 internal compiler error.
|
|
|
|
function defaultDate(value: Date = new Date(0)): number {
|
|
return value.getTime();
|
|
}
|
|
defaultDate();
|
|
|
|
function* dates(): Generator<Date, void, unknown> {
|
|
yield new Date(0);
|
|
}
|
|
for (const value of dates()) console.log(value.getTime());
|
|
|
|
class DeferredDate {
|
|
value!: Date;
|
|
initialize(): void {
|
|
this.value = new Date(0);
|
|
}
|
|
}
|
|
const deferred = new DeferredDate();
|
|
deferred.initialize();
|