@scriptc/compiler 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ambient/scriptc-node-fallback.d.ts +13 -0
- package/dist/backend/cc.js +14 -0
- package/dist/backend/cc.js.map +1 -1
- package/dist/backend/emission/emit-exprs.js +244 -17
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emit-types.d.ts +3 -0
- package/dist/backend/emission/emit-types.js +12 -0
- package/dist/backend/emission/emit-types.js.map +1 -1
- package/dist/backend/emission/emit-walkers.d.ts +7 -5
- package/dist/backend/emission/emit-walkers.js +52 -12
- package/dist/backend/emission/emit-walkers.js.map +1 -1
- package/dist/backend/emission/emitter.d.ts +1 -1
- package/dist/backend/emission/emitter.js +30 -9
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +1 -0
- package/dist/backend/llvm/dyn.js +83 -1
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.js +357 -20
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +73 -14
- package/dist/diagnostics/diagnostic.js +112 -31
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/render.js +8 -0
- package/dist/diagnostics/render.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.js +11 -1
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +16 -0
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.d.ts +24 -0
- package/dist/frontend/lowering/lower-builtins.js +256 -3
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +71 -11
- package/dist/frontend/lowering/lower-calls.js +942 -18
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +27 -1
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +21 -2
- package/dist/frontend/lowering/lower-containers.js +386 -53
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +92 -17
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-emitter.js +54 -0
- package/dist/frontend/lowering/lower-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +231 -17
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +33 -2
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +25 -11
- package/dist/frontend/lowering/lower-namespaces.js +50 -15
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +211 -4
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +1 -5
- package/dist/frontend/lowering/lower-stmts.js +660 -19
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +92 -5
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +102 -15
- package/dist/frontend/lowering/lowerer.js +378 -30
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.js +20 -3
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/npm-static-rewrite.d.ts +7 -2
- package/dist/frontend/npm-static-rewrite.js +566 -138
- package/dist/frontend/npm-static-rewrite.js.map +1 -1
- package/dist/frontend/npm-static.js +11 -2
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/program.js +5 -5
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/shared.d.ts +6 -1
- package/dist/frontend/shared.js +46 -1
- package/dist/frontend/shared.js.map +1 -1
- package/dist/frontend/types.d.ts +13 -0
- package/dist/frontend/types.js +88 -9
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.js +169 -32
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +230 -12
- package/dist/ir/nodes.js +85 -6
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +109 -9
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/fence-eval.d.ts +77 -0
- package/dist/library/fence-eval.js +385 -0
- package/dist/library/fence-eval.js.map +1 -0
- package/dist/library/profile.d.ts +11 -1
- package/dist/library/profile.js +102 -18
- package/dist/library/profile.js.map +1 -1
- package/package.json +2 -2
- package/surface-manifest.json +10 -3
|
@@ -373,6 +373,36 @@ export declare const TIMER_MODULE_MEMBERS: ReadonlySet<string>;
|
|
|
373
373
|
* timer function (the caller's fence machinery takes over). */
|
|
374
374
|
export declare function lowerTimersMemberCall(L: Lowerer, expr: ts.CallExpression, member: string, loc: SrcLoc): IrExpr | null;
|
|
375
375
|
export declare function lowerCall(L: Lowerer, expr: ts.CallExpression): IrExpr;
|
|
376
|
+
/** The RUNTIME-ARITY spread call — `f(...args)`, the rest-forwarding idiom
|
|
377
|
+
* (`const f = (...args) => from(...args)`): a spread whose length is a
|
|
378
|
+
* runtime fact has no home in the compile-time completion, so the call
|
|
379
|
+
* rides a dynamic boundary instead. Two lanes, picked by the spread
|
|
380
|
+
* source's tier:
|
|
381
|
+
*
|
|
382
|
+
* - CHECKED-DYNAMIC (dyn spread sources — a JS rest binding, a dyn
|
|
383
|
+
* value): box the callee (dynFrom; a dyn callee is already boxed),
|
|
384
|
+
* convert every argument into dyn, and emit the spread-marked dynCall
|
|
385
|
+
* — the emitters build one fresh DOM argument array (spreads flatten
|
|
386
|
+
* left-to-right, non-iterables throw V8's TypeError) and apply through
|
|
387
|
+
* it; the boxed thunk delivers JS arity exactly. Result dyn, checked
|
|
388
|
+
* per use like every any-origin value.
|
|
389
|
+
* - ISLAND (a jsval spread source — the --dynamic rest binding is the
|
|
390
|
+
* engine's own arguments array): marshal the callee in and emit jsOp
|
|
391
|
+
* callSpread — the prelude helper's REAL `f(...pre, ...s)`, so
|
|
392
|
+
* iterator protocols and the not-iterable TypeError are the engine's
|
|
393
|
+
* own. One trailing spread after the fixed arguments is the modeled
|
|
394
|
+
* shape (exactly the forwarding idiom).
|
|
395
|
+
*
|
|
396
|
+
* Answers null when neither lane fits (typed .ts spreads keep
|
|
397
|
+
* completeArgs' rest packing and its fences). JS sources only — the
|
|
398
|
+
* same guard as the over-arity dynCall precedent. */
|
|
399
|
+
export declare function lowerSpreadArgsCall(L: Lowerer, expr: ts.CallExpression, callee: IrExpr, loc: SrcLoc): IrExpr | null;
|
|
400
|
+
/** True when a spread argument lands where the compile-time completion
|
|
401
|
+
* cannot take it — a FIXED parameter position, or a dynamic rest slot
|
|
402
|
+
* (dynRest/islandRest, whose packs are built per-argument): the shapes
|
|
403
|
+
* the runtime-arity lane (lowerSpreadArgsCall) serves. Typed `rest`
|
|
404
|
+
* slots keep completeArgs' same-element spread packing. */
|
|
405
|
+
export declare function spreadNeedsRuntimeArity(shapes: readonly ParamShape[], argNodes: readonly ts.Expression[]): boolean;
|
|
376
406
|
/** The SHARED prototype names scr_dyn_invoke dispatches at runtime (the
|
|
377
407
|
* subset of DOM_PROTO_METHOD_NAMES with a receiver-kind dispatch): the
|
|
378
408
|
* runtime runs the real method for the receiver's kind, throws Node's
|
|
@@ -547,6 +577,47 @@ export declare function objLitGenericFnInfoOf(L: Lowerer, blame: ts.Node, name:
|
|
|
547
577
|
* bindings are read-only — no other file can write one. Cached per
|
|
548
578
|
* symbol (the scan walks the whole file once). */
|
|
549
579
|
export declare function bindingNeverReassigned(L: Lowerer, sym: ts.Symbol, decl: ts.Node): boolean;
|
|
580
|
+
/** Strips the value-preserving wrappers off an expression: parens,
|
|
581
|
+
* non-null assertions, `as`/`satisfies`/angle-bracket casts. What
|
|
582
|
+
* remains is the expression that actually evaluates. */
|
|
583
|
+
export declare function stripValueWrappers(e: ts.Expression): ts.Expression;
|
|
584
|
+
/** The nullish unit `e` provably evaluates to: a bare null/undefined
|
|
585
|
+
* literal (assertion-wrapped — `null as any`, `null!`), or a read of a
|
|
586
|
+
* registered NULLISH binding (nullishGenericBindingUnitOf). Null when
|
|
587
|
+
* the value could be anything else. */
|
|
588
|
+
export declare function nullishExprUnitOf(L: Lowerer, e: ts.Expression): "null" | "undefined" | null;
|
|
589
|
+
/** The nullish unit a binding provably holds FOREVER, by VALUE alone: its
|
|
590
|
+
* initializer is nullish (`const i: I<A & B> = null as any`) and every
|
|
591
|
+
* write in its declaring file is nullish too (`a = b` where b is
|
|
592
|
+
* another nullish binding). No type condition — callers add their own
|
|
593
|
+
* (nullishGenericBindingUnitOf gates the no-storage family on
|
|
594
|
+
* unmappable types; the generic-method call path rescues its fence with
|
|
595
|
+
* the value fact alone). Cached per symbol; the pre-seeded null entry
|
|
596
|
+
* guards probe cycles (mutually-assigned bindings resolve link by link,
|
|
597
|
+
* declaration order). */
|
|
598
|
+
export declare function nullishValueUnitOf(L: Lowerer, sym: ts.Symbol | null): "null" | "undefined" | null;
|
|
599
|
+
/** nullishValueUnitOf gated on a declared type that CANNOT hold the
|
|
600
|
+
* value — the NO-STORAGE family: an unmappable type has no other story,
|
|
601
|
+
* and a RECORD-mapped one (`const i: I<A & B> = null as any` — an
|
|
602
|
+
* interface whose members are all generic signatures interns an empty
|
|
603
|
+
* shape) has a slot null can never inhabit, so storing would throw the
|
|
604
|
+
* representation error where Node stores null silently. Either way the
|
|
605
|
+
* declaration emits nothing and reads know the value. Null-tolerant
|
|
606
|
+
* mappings (unions with a null/undefined arm, dyn) keep their real
|
|
607
|
+
* storage and every ordinary lowering. */
|
|
608
|
+
export declare function nullishGenericBindingUnitOf(L: Lowerer, sym: ts.Symbol | null): "null" | "undefined" | null;
|
|
609
|
+
/** True when `sym` — a binding whose type has NO static mapping — is DEAD:
|
|
610
|
+
* never read anywhere in the program, not exported through a specifier,
|
|
611
|
+
* declared with no initializer or a side-effect-free one, and written
|
|
612
|
+
* (if at all) only by plain assignments of side-effect-free values. Node
|
|
613
|
+
* materializes those values and drops them — zero observable effect —
|
|
614
|
+
* so the declaration and its writes lower to NOTHING instead of fencing
|
|
615
|
+
* on a type the program never consumes (`var xs2: typeof Array;`, the
|
|
616
|
+
* write-only `var f2: { <T, U>(x: T, y: U): T }`). TS program files
|
|
617
|
+
* only: JS bindings keep their checked-dynamic fallbacks. Positive
|
|
618
|
+
* answers register in L.deadBindings (the assignment lowering skips
|
|
619
|
+
* writes by the same set). */
|
|
620
|
+
export declare function deadUnmappableBinding(L: Lowerer, sym: ts.Symbol | null, decl: ts.VariableDeclaration): boolean;
|
|
550
621
|
/** The generic function-like INITIALIZER behind a binding declaration —
|
|
551
622
|
* `const f = <T>(x: T) => x` or `const f = function g<T>(x: T) {...}`
|
|
552
623
|
* (parens stripped). Null when the declaration isn't that shape; the
|
|
@@ -600,17 +671,6 @@ export declare function bindingGenericFnAliasInfoOf(L: Lowerer, decl: ts.Variabl
|
|
|
600
671
|
* structurally identical literal with a DIFFERENT body, which static
|
|
601
672
|
* resolution would silently miss. */
|
|
602
673
|
export declare function requireObjLitGenericReceiver(L: Lowerer, blame: ts.Node, recvExpr: ts.Expression, literal: ts.ObjectLiteralExpression, name: string): void;
|
|
603
|
-
/** `o.m(args)` where `m` is an object-literal GENERIC method (own type
|
|
604
|
-
* parameters — the member is excluded from the record shape, see
|
|
605
|
-
* isGenericCallableMemberType): monomorphized per call site against the
|
|
606
|
-
* DEFINING literal's declaration, exactly like top-level generic
|
|
607
|
-
* functions. Resolution is static, so the receiver must provably BE the
|
|
608
|
-
* defining literal: a const binding whose initializer is that literal,
|
|
609
|
-
* read directly. The receiver read is pure and the compiled instance is
|
|
610
|
-
* a plain module function (no `this`, fenced), so the call lowers to a
|
|
611
|
-
* direct `call` of the instance with the receiver unevaluated. Claims
|
|
612
|
-
* every call whose member is generic-callable — lowering it or fencing
|
|
613
|
-
* with a named message. */
|
|
614
674
|
export declare function lowerObjLitGenericMethodCall(L: Lowerer, call: ts.CallExpression, access: ts.PropertyAccessExpression): IrExpr | null;
|
|
615
675
|
/** `obj.method(args)` — whole-program devirtualization decides the form:
|
|
616
676
|
* a method some strict subclass of the receiver's STATIC class overrides
|