@scriptc/compiler 0.0.0 → 0.0.1
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/LICENSE +202 -0
- package/ambient/package.json +3 -0
- package/ambient/scriptc-node-fallback.d.ts +3001 -0
- package/ambient/scriptc-overrides.d.ts +95 -0
- package/ambient/scriptc.d.ts +74 -0
- package/dist/backend/cc.d.ts +169 -0
- package/dist/backend/cc.js +897 -0
- package/dist/backend/cc.js.map +1 -0
- package/dist/backend/emission/emit-async.d.ts +145 -0
- package/dist/backend/emission/emit-async.js +996 -0
- package/dist/backend/emission/emit-async.js.map +1 -0
- package/dist/backend/emission/emit-exprs.d.ts +3 -0
- package/dist/backend/emission/emit-exprs.js +5947 -0
- package/dist/backend/emission/emit-exprs.js.map +1 -0
- package/dist/backend/emission/emit-island.d.ts +45 -0
- package/dist/backend/emission/emit-island.js +271 -0
- package/dist/backend/emission/emit-island.js.map +1 -0
- package/dist/backend/emission/emit-shapes.d.ts +142 -0
- package/dist/backend/emission/emit-shapes.js +575 -0
- package/dist/backend/emission/emit-shapes.js.map +1 -0
- package/dist/backend/emission/emit-stmts.d.ts +78 -0
- package/dist/backend/emission/emit-stmts.js +960 -0
- package/dist/backend/emission/emit-stmts.js.map +1 -0
- package/dist/backend/emission/emit-types.d.ts +65 -0
- package/dist/backend/emission/emit-types.js +652 -0
- package/dist/backend/emission/emit-types.js.map +1 -0
- package/dist/backend/emission/emit-walkers.d.ts +154 -0
- package/dist/backend/emission/emit-walkers.js +1587 -0
- package/dist/backend/emission/emit-walkers.js.map +1 -0
- package/dist/backend/emission/emitter.d.ts +452 -0
- package/dist/backend/emission/emitter.js +1249 -0
- package/dist/backend/emission/emitter.js.map +1 -0
- package/dist/backend/emission/may-throw.d.ts +15 -0
- package/dist/backend/emission/may-throw.js +250 -0
- package/dist/backend/emission/may-throw.js.map +1 -0
- package/dist/backend/llvm/blocks.d.ts +21 -0
- package/dist/backend/llvm/blocks.js +68 -0
- package/dist/backend/llvm/blocks.js.map +1 -0
- package/dist/backend/llvm/classes.d.ts +84 -0
- package/dist/backend/llvm/classes.js +438 -0
- package/dist/backend/llvm/classes.js.map +1 -0
- package/dist/backend/llvm/dyn.d.ts +123 -0
- package/dist/backend/llvm/dyn.js +2624 -0
- package/dist/backend/llvm/dyn.js.map +1 -0
- package/dist/backend/llvm/emitter.d.ts +3 -0
- package/dist/backend/llvm/emitter.js +10087 -0
- package/dist/backend/llvm/emitter.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +78 -0
- package/dist/backend/llvm/shapes.js +754 -0
- package/dist/backend/llvm/shapes.js.map +1 -0
- package/dist/backend/llvm/unsupported.d.ts +6 -0
- package/dist/backend/llvm/unsupported.js +12 -0
- package/dist/backend/llvm/unsupported.js.map +1 -0
- package/dist/backend/llvm/walkers.d.ts +58 -0
- package/dist/backend/llvm/walkers.js +793 -0
- package/dist/backend/llvm/walkers.js.map +1 -0
- package/dist/backend/mangle.d.ts +124 -0
- package/dist/backend/mangle.js +232 -0
- package/dist/backend/mangle.js.map +1 -0
- package/dist/coverage/report.d.ts +64 -0
- package/dist/coverage/report.js +226 -0
- package/dist/coverage/report.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +140 -0
- package/dist/diagnostics/diagnostic.js +458 -0
- package/dist/diagnostics/diagnostic.js.map +1 -0
- package/dist/diagnostics/render.d.ts +11 -0
- package/dist/diagnostics/render.js +58 -0
- package/dist/diagnostics/render.js.map +1 -0
- package/dist/frontend/cjs-lexer.d.ts +20 -0
- package/dist/frontend/cjs-lexer.js +813 -0
- package/dist/frontend/cjs-lexer.js.map +1 -0
- package/dist/frontend/lowering/http2-constants.d.ts +1 -0
- package/dist/frontend/lowering/http2-constants.js +251 -0
- package/dist/frontend/lowering/http2-constants.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.d.ts +6 -0
- package/dist/frontend/lowering/lib-boundary.js +143 -0
- package/dist/frontend/lowering/lib-boundary.js.map +1 -0
- package/dist/frontend/lowering/lower-assert.d.ts +18 -0
- package/dist/frontend/lowering/lower-assert.js +1269 -0
- package/dist/frontend/lowering/lower-assert.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.d.ts +511 -0
- package/dist/frontend/lowering/lower-builtins.js +5249 -0
- package/dist/frontend/lowering/lower-builtins.js.map +1 -0
- package/dist/frontend/lowering/lower-calls.d.ts +581 -0
- package/dist/frontend/lowering/lower-calls.js +6281 -0
- package/dist/frontend/lowering/lower-calls.js.map +1 -0
- package/dist/frontend/lowering/lower-classes.d.ts +727 -0
- package/dist/frontend/lowering/lower-classes.js +4701 -0
- package/dist/frontend/lowering/lower-classes.js.map +1 -0
- package/dist/frontend/lowering/lower-comptime.d.ts +53 -0
- package/dist/frontend/lowering/lower-comptime.js +244 -0
- package/dist/frontend/lowering/lower-comptime.js.map +1 -0
- package/dist/frontend/lowering/lower-containers.d.ts +483 -0
- package/dist/frontend/lowering/lower-containers.js +6281 -0
- package/dist/frontend/lowering/lower-containers.js.map +1 -0
- package/dist/frontend/lowering/lower-dgram.d.ts +20 -0
- package/dist/frontend/lowering/lower-dgram.js +319 -0
- package/dist/frontend/lowering/lower-dgram.js.map +1 -0
- package/dist/frontend/lowering/lower-emitter.d.ts +10 -0
- package/dist/frontend/lowering/lower-emitter.js +688 -0
- package/dist/frontend/lowering/lower-emitter.js.map +1 -0
- package/dist/frontend/lowering/lower-enums.d.ts +22 -0
- package/dist/frontend/lowering/lower-enums.js +235 -0
- package/dist/frontend/lowering/lower-enums.js.map +1 -0
- package/dist/frontend/lowering/lower-expando.d.ts +35 -0
- package/dist/frontend/lowering/lower-expando.js +276 -0
- package/dist/frontend/lowering/lower-expando.js.map +1 -0
- package/dist/frontend/lowering/lower-exprs.d.ts +524 -0
- package/dist/frontend/lowering/lower-exprs.js +8099 -0
- package/dist/frontend/lowering/lower-exprs.js.map +1 -0
- package/dist/frontend/lowering/lower-generators.d.ts +50 -0
- package/dist/frontend/lowering/lower-generators.js +421 -0
- package/dist/frontend/lowering/lower-generators.js.map +1 -0
- package/dist/frontend/lowering/lower-inspect.d.ts +20 -0
- package/dist/frontend/lowering/lower-inspect.js +1069 -0
- package/dist/frontend/lowering/lower-inspect.js.map +1 -0
- package/dist/frontend/lowering/lower-island.d.ts +108 -0
- package/dist/frontend/lowering/lower-island.js +650 -0
- package/dist/frontend/lowering/lower-island.js.map +1 -0
- package/dist/frontend/lowering/lower-mixins.d.ts +96 -0
- package/dist/frontend/lowering/lower-mixins.js +534 -0
- package/dist/frontend/lowering/lower-mixins.js.map +1 -0
- package/dist/frontend/lowering/lower-modules.d.ts +135 -0
- package/dist/frontend/lowering/lower-modules.js +1613 -0
- package/dist/frontend/lowering/lower-modules.js.map +1 -0
- package/dist/frontend/lowering/lower-namespaces.d.ts +168 -0
- package/dist/frontend/lowering/lower-namespaces.js +706 -0
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -0
- package/dist/frontend/lowering/lower-server.d.ts +90 -0
- package/dist/frontend/lowering/lower-server.js +3471 -0
- package/dist/frontend/lowering/lower-server.js.map +1 -0
- package/dist/frontend/lowering/lower-stmts.d.ts +361 -0
- package/dist/frontend/lowering/lower-stmts.js +5341 -0
- package/dist/frontend/lowering/lower-stmts.js.map +1 -0
- package/dist/frontend/lowering/lower-stream.d.ts +88 -0
- package/dist/frontend/lowering/lower-stream.js +1533 -0
- package/dist/frontend/lowering/lower-stream.js.map +1 -0
- package/dist/frontend/lowering/lower-test.d.ts +27 -0
- package/dist/frontend/lowering/lower-test.js +353 -0
- package/dist/frontend/lowering/lower-test.js.map +1 -0
- package/dist/frontend/lowering/lowerer.d.ts +1748 -0
- package/dist/frontend/lowering/lowerer.js +6256 -0
- package/dist/frontend/lowering/lowerer.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +272 -0
- package/dist/frontend/lowering/surfaces.js +1096 -0
- package/dist/frontend/lowering/surfaces.js.map +1 -0
- package/dist/frontend/npm-static.d.ts +55 -0
- package/dist/frontend/npm-static.js +300 -0
- package/dist/frontend/npm-static.js.map +1 -0
- package/dist/frontend/npm.d.ts +330 -0
- package/dist/frontend/npm.js +1259 -0
- package/dist/frontend/npm.js.map +1 -0
- package/dist/frontend/program.d.ts +186 -0
- package/dist/frontend/program.js +2172 -0
- package/dist/frontend/program.js.map +1 -0
- package/dist/frontend/provenance-registry.d.ts +48 -0
- package/dist/frontend/provenance-registry.js +87 -0
- package/dist/frontend/provenance-registry.js.map +1 -0
- package/dist/frontend/provenance.d.ts +6 -0
- package/dist/frontend/provenance.js +459 -0
- package/dist/frontend/provenance.js.map +1 -0
- package/dist/frontend/resolve.d.ts +56 -0
- package/dist/frontend/resolve.js +682 -0
- package/dist/frontend/resolve.js.map +1 -0
- package/dist/frontend/shared.d.ts +60 -0
- package/dist/frontend/shared.js +232 -0
- package/dist/frontend/shared.js.map +1 -0
- package/dist/frontend/ts7/adapter.d.ts +7 -0
- package/dist/frontend/ts7/adapter.js +54 -0
- package/dist/frontend/ts7/adapter.js.map +1 -0
- package/dist/frontend/ts7/ast.d.ts +50 -0
- package/dist/frontend/ts7/ast.js +211 -0
- package/dist/frontend/ts7/ast.js.map +1 -0
- package/dist/frontend/ts7/census-check.d.ts +1 -0
- package/dist/frontend/ts7/census-check.js +12 -0
- package/dist/frontend/ts7/census-check.js.map +1 -0
- package/dist/frontend/ts7/checker.d.ts +140 -0
- package/dist/frontend/ts7/checker.js +544 -0
- package/dist/frontend/ts7/checker.js.map +1 -0
- package/dist/frontend/ts7/enums.d.ts +18 -0
- package/dist/frontend/ts7/enums.js +43 -0
- package/dist/frontend/ts7/enums.js.map +1 -0
- package/dist/frontend/ts7/program.d.ts +99 -0
- package/dist/frontend/ts7/program.js +278 -0
- package/dist/frontend/ts7/program.js.map +1 -0
- package/dist/frontend/ts7/world-check.d.ts +3 -0
- package/dist/frontend/ts7/world-check.js +34 -0
- package/dist/frontend/ts7/world-check.js.map +1 -0
- package/dist/frontend/types.d.ts +205 -0
- package/dist/frontend/types.js +2485 -0
- package/dist/frontend/types.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +424 -0
- package/dist/index.js.map +1 -0
- package/dist/ir/nodes.d.ts +4334 -0
- package/dist/ir/nodes.js +1906 -0
- package/dist/ir/nodes.js.map +1 -0
- package/dist/ir/serialize.d.ts +4 -0
- package/dist/ir/serialize.js +34 -0
- package/dist/ir/serialize.js.map +1 -0
- package/dist/ir/validate.d.ts +36 -0
- package/dist/ir/validate.js +4884 -0
- package/dist/ir/validate.js.map +1 -0
- package/package.json +30 -6
- package/README.md +0 -3
- package/index.js +0 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as ts from "../ts7/adapter.js";
|
|
2
|
+
import type { Lowerer } from "./lowerer.js";
|
|
3
|
+
import { IrExpr, IrStmt, IrType } from "../../ir/nodes.js";
|
|
4
|
+
type GenType = IrType & {
|
|
5
|
+
kind: "generator";
|
|
6
|
+
};
|
|
7
|
+
/** `yield e` / `yield;` — only inside a generator body the signature
|
|
8
|
+
* collection accepted (L.ctx.generator carries the channels). `yield*`
|
|
9
|
+
* lowers in STATEMENT position only (lowerYieldStarStatement — the value
|
|
10
|
+
* of a delegation needs the whole forwarding loop in expression position,
|
|
11
|
+
* which has no lowering yet). */
|
|
12
|
+
export declare function lowerYield(L: Lowerer, expr: ts.YieldExpression): IrExpr;
|
|
13
|
+
/** `g.next(v)` / `g.return(v)` / `g.throw(e)` on a generator-typed
|
|
14
|
+
* receiver → genResume. Null when this is not that call (the dispatch
|
|
15
|
+
* chain moves on). */
|
|
16
|
+
export declare function lowerGenMethodCall(L: Lowerer, call: ts.CallExpression, access: ts.PropertyAccessExpression): IrExpr | null;
|
|
17
|
+
/** `for (const x of gen)` — the desugared drive:
|
|
18
|
+
*
|
|
19
|
+
* { const %gof = <iterable>; let %gdone = false;
|
|
20
|
+
* while (true) {
|
|
21
|
+
* const %gr = %gof.next(); // genResume
|
|
22
|
+
* if (%gr.done) { %gdone = true; break; }
|
|
23
|
+
* const x = <extract %gr.value>;
|
|
24
|
+
* <body>
|
|
25
|
+
* }
|
|
26
|
+
* if (!%gdone) %gof.return(); // IteratorClose
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* `break` exits the while and lands on the close check (probed: break
|
|
30
|
+
* closes the generator — finallys run, the return value is discarded);
|
|
31
|
+
* `continue` stays in the loop; exhaustion skips the close. A consumer
|
|
32
|
+
* `return`/`throw` abandoning the loop does NOT close (numbered
|
|
33
|
+
* divergence — the desugar cannot ride a finally, whose regions reject
|
|
34
|
+
* the loop's own break). */
|
|
35
|
+
export declare function lowerForOfGenerator(L: Lowerer, stmt: ts.ForOfStatement, iterable: IrExpr & {
|
|
36
|
+
type: GenType;
|
|
37
|
+
}, labels?: string[]): IrStmt;
|
|
38
|
+
/** Statement-position `yield* e;` — the forwarding loop:
|
|
39
|
+
*
|
|
40
|
+
* { const %dele = <e>; let %dr = %dele.next();
|
|
41
|
+
* while (!%dr.done) { %dr = %dele.next(<yield %dr.value>); } }
|
|
42
|
+
*
|
|
43
|
+
* The inner yield value re-yields out of the OUTER generator (coerced
|
|
44
|
+
* across the channels); the consumer's `.next(v)` argument forwards into
|
|
45
|
+
* the delegate; the delegate's return value is this statement's dropped
|
|
46
|
+
* result. Consumer `.return()`/`.throw()` while suspended here unwinds
|
|
47
|
+
* the OUTER generator without forwarding to the delegate (numbered
|
|
48
|
+
* divergence). Null when this is not a yield* statement. */
|
|
49
|
+
export declare function lowerYieldStarStatement(L: Lowerer, expr: ts.Expression): IrStmt | null;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/* Generator lowering: yield / yield* expressions, the consumer surface
|
|
2
|
+
* (.next/.return/.throw → genResume), and the for-of-over-generator
|
|
3
|
+
* desugar. The design: a generator body is an ordinary
|
|
4
|
+
* compiled function on a fiber created suspended; the consumer resumes it
|
|
5
|
+
* synchronously and every resume answers the interned IteratorResult
|
|
6
|
+
* record genResultRecord builds — one shape per channel pair, shared with
|
|
7
|
+
* mapType's IteratorResult alias mapping so unannotated `const r =
|
|
8
|
+
* g.next()` binds and reads flow. */
|
|
9
|
+
import * as ts from "../ts7/adapter.js";
|
|
10
|
+
import { BOOL, DYN, UNDEFINED_T, VOID, isUnitType, typeEquals } from "../../ir/nodes.js";
|
|
11
|
+
import { locOf } from "../program.js";
|
|
12
|
+
import { genResultRecord } from "../types.js";
|
|
13
|
+
import { forOfVarTarget } from "./lower-stmts.js";
|
|
14
|
+
/** The interned IteratorResult record of a generator type (never null for
|
|
15
|
+
* a MAPPED generator — mapType required it to intern). */
|
|
16
|
+
function resultRecordOf(L, genT) {
|
|
17
|
+
const rec = genResultRecord(genT.yieldT, genT.retT, L.shapes, L.unions);
|
|
18
|
+
if (!rec)
|
|
19
|
+
throw new Error("lowerer bug: mapped generator without a result record");
|
|
20
|
+
return rec;
|
|
21
|
+
}
|
|
22
|
+
/** The undefined value coerced into a yield/return channel — `yield;`,
|
|
23
|
+
* `.return()`'s absent argument evaluated as a value. Null when the
|
|
24
|
+
* channel cannot hold undefined. */
|
|
25
|
+
function channelUndefined(L, channel, loc) {
|
|
26
|
+
if (channel.kind === "dyn") {
|
|
27
|
+
return {
|
|
28
|
+
kind: "dynFrom",
|
|
29
|
+
value: { kind: "unitLit", unit: "undefined", type: UNDEFINED_T, loc },
|
|
30
|
+
type: DYN,
|
|
31
|
+
loc,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (channel.kind === "union")
|
|
35
|
+
return L.wrappedUndefined(channel, loc);
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
/** `yield e` / `yield;` — only inside a generator body the signature
|
|
39
|
+
* collection accepted (L.ctx.generator carries the channels). `yield*`
|
|
40
|
+
* lowers in STATEMENT position only (lowerYieldStarStatement — the value
|
|
41
|
+
* of a delegation needs the whole forwarding loop in expression position,
|
|
42
|
+
* which has no lowering yet). */
|
|
43
|
+
export function lowerYield(L, expr) {
|
|
44
|
+
const loc = locOf(expr);
|
|
45
|
+
const gen = L.ctx.generator;
|
|
46
|
+
if (!gen) {
|
|
47
|
+
// A yield in a body this compiler did not lower as a generator (an
|
|
48
|
+
// async generator's, a comptime callback's) — the blanket fence.
|
|
49
|
+
L.unsupported("SC1071", expr);
|
|
50
|
+
}
|
|
51
|
+
if (expr.asteriskToken) {
|
|
52
|
+
L.unsupported("SC1071", expr, "the value of 'yield*' (statement-position delegation compiles: 'yield* inner();' — bind the delegate's return value through its .next() protocol instead)");
|
|
53
|
+
}
|
|
54
|
+
let value;
|
|
55
|
+
if (expr.expression) {
|
|
56
|
+
value = L.lowerExprExpecting(expr.expression, gen.yieldT);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const u = channelUndefined(L, gen.yieldT, loc);
|
|
60
|
+
if (!u) {
|
|
61
|
+
L.unsupported("SC1071", expr, `a bare 'yield;' on a '${L.fmt(gen.yieldT)}' yield channel (it would yield undefined — yield a value)`);
|
|
62
|
+
}
|
|
63
|
+
value = u;
|
|
64
|
+
}
|
|
65
|
+
// An undefined next-channel means the resumed value is always undefined:
|
|
66
|
+
// the expression is void (statement position; the checker types reads of
|
|
67
|
+
// it undefined, whose uses fence downstream).
|
|
68
|
+
const type = gen.nextT.kind === "undefinedT" ? VOID : gen.nextT;
|
|
69
|
+
return { kind: "yieldExpr", value, type, loc };
|
|
70
|
+
}
|
|
71
|
+
/** `g.next(v)` / `g.return(v)` / `g.throw(e)` on a generator-typed
|
|
72
|
+
* receiver → genResume. Null when this is not that call (the dispatch
|
|
73
|
+
* chain moves on). */
|
|
74
|
+
export function lowerGenMethodCall(L, call, access) {
|
|
75
|
+
if (L.chainBlocked(access, call))
|
|
76
|
+
return null;
|
|
77
|
+
const name = access.name.text;
|
|
78
|
+
if (name !== "next" && name !== "return" && name !== "throw")
|
|
79
|
+
return null;
|
|
80
|
+
if (L.mapTypeOf(L.typeOf(access.expression))?.kind !== "generator")
|
|
81
|
+
return null;
|
|
82
|
+
if (call.arguments.some(ts.isSpreadElement)) {
|
|
83
|
+
L.unsupported("SC1090", call, "spread arguments");
|
|
84
|
+
}
|
|
85
|
+
const loc = locOf(call);
|
|
86
|
+
const gen = L.lowerExpr(access.expression);
|
|
87
|
+
if (gen.type.kind !== "generator")
|
|
88
|
+
return null;
|
|
89
|
+
const genT = gen.type;
|
|
90
|
+
const recT = resultRecordOf(L, genT);
|
|
91
|
+
const argNode = call.arguments[0];
|
|
92
|
+
let arg = null;
|
|
93
|
+
if (name === "next") {
|
|
94
|
+
if (argNode === undefined) {
|
|
95
|
+
if (genT.nextT.kind !== "undefinedT" && genT.nextT.kind !== "dyn") {
|
|
96
|
+
L.unsupported("SC1071", call, `a valueless .next() on a '${L.fmt(genT.nextT)}' next channel (it would deliver undefined into a typed yield — pass .next(value))`);
|
|
97
|
+
}
|
|
98
|
+
arg = null; // the runtime sends undefined
|
|
99
|
+
}
|
|
100
|
+
else if (genT.nextT.kind === "undefinedT") {
|
|
101
|
+
// `.next(undefined)` on a valueless channel: the literal is a no-op;
|
|
102
|
+
// anything effectful has no evaluate-then-drop slot here.
|
|
103
|
+
const lowered = L.lowerExpr(argNode);
|
|
104
|
+
if (lowered.kind !== "unitLit") {
|
|
105
|
+
L.unsupported("SC1071", call, ".next(value) on a generator that never reads resumed values (call .next() with no argument)");
|
|
106
|
+
}
|
|
107
|
+
arg = null;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
arg = L.lowerExprExpecting(argNode, genT.nextT);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else if (name === "return") {
|
|
114
|
+
if (argNode === undefined) {
|
|
115
|
+
arg = null; // undefined done-value
|
|
116
|
+
}
|
|
117
|
+
else if (genT.retT.kind === "void") {
|
|
118
|
+
L.unsupported("SC1071", call, ".return(value) on a generator whose return type carries no value (call .return() with no argument)");
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
arg = L.lowerExprExpecting(argNode, genT.retT);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
if (argNode === undefined) {
|
|
126
|
+
L.unsupported("SC1071", call, ".throw() with no argument (Node would throw undefined into the generator — pass the error)");
|
|
127
|
+
}
|
|
128
|
+
arg = L.lowerExpr(argNode);
|
|
129
|
+
if (arg.type.kind === "void" || arg.type.kind === "dyn" || arg.type.kind === "caught" || isUnitType(arg.type)) {
|
|
130
|
+
L.unsupported("SC1090", argNode, `.throw() of a '${L.fmt(arg.type)}' value (throw numbers, strings, booleans, or Error instances)`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return { kind: "genResume", mode: name, gen, arg, type: recT, loc };
|
|
134
|
+
}
|
|
135
|
+
/** Extraction of a suspended resume's yield value out of the result
|
|
136
|
+
* record's V slot, typed back to the yield channel: V IS the channel for
|
|
137
|
+
* dyn (and for a union channel already equal to V); a non-union channel
|
|
138
|
+
* narrows to its arm (sound by construction — done was just tested
|
|
139
|
+
* false, so the slot holds a yield-channel value); a union channel
|
|
140
|
+
* re-tags through the retag helper with the non-channel arms marked
|
|
141
|
+
* trappable (the same proved-away contract, proved here by the desugar's
|
|
142
|
+
* own done test). Null when no extraction exists. */
|
|
143
|
+
function extractYieldValue(L, genT, valueT, read, loc) {
|
|
144
|
+
const yt = genT.yieldT;
|
|
145
|
+
if (valueT.kind === "dyn")
|
|
146
|
+
return read; // the dyn channel: V IS the value
|
|
147
|
+
if (valueT.kind !== "union")
|
|
148
|
+
return null;
|
|
149
|
+
if (typeEquals(valueT, yt))
|
|
150
|
+
return read;
|
|
151
|
+
if (yt.kind !== "union") {
|
|
152
|
+
const tag = L.armTag(valueT.unionId, yt);
|
|
153
|
+
if (tag < 0)
|
|
154
|
+
return null;
|
|
155
|
+
return { kind: "unionNarrow", unionId: valueT.unionId, tag, value: read, type: yt, loc };
|
|
156
|
+
}
|
|
157
|
+
const vDef = L.unions.get(valueT.unionId);
|
|
158
|
+
if (!vDef)
|
|
159
|
+
return null;
|
|
160
|
+
const trappable = new Set();
|
|
161
|
+
vDef.arms.forEach((arm, i) => {
|
|
162
|
+
if (L.armTag(yt.unionId, arm) < 0)
|
|
163
|
+
trappable.add(i);
|
|
164
|
+
});
|
|
165
|
+
const helper = L.unionRetagHelper(valueT.unionId, yt.unionId, loc, trappable);
|
|
166
|
+
if (!helper)
|
|
167
|
+
return null;
|
|
168
|
+
return { kind: "call", callee: helper, args: [read], type: yt, loc };
|
|
169
|
+
}
|
|
170
|
+
/** `for (const x of gen)` — the desugared drive:
|
|
171
|
+
*
|
|
172
|
+
* { const %gof = <iterable>; let %gdone = false;
|
|
173
|
+
* while (true) {
|
|
174
|
+
* const %gr = %gof.next(); // genResume
|
|
175
|
+
* if (%gr.done) { %gdone = true; break; }
|
|
176
|
+
* const x = <extract %gr.value>;
|
|
177
|
+
* <body>
|
|
178
|
+
* }
|
|
179
|
+
* if (!%gdone) %gof.return(); // IteratorClose
|
|
180
|
+
* }
|
|
181
|
+
*
|
|
182
|
+
* `break` exits the while and lands on the close check (probed: break
|
|
183
|
+
* closes the generator — finallys run, the return value is discarded);
|
|
184
|
+
* `continue` stays in the loop; exhaustion skips the close. A consumer
|
|
185
|
+
* `return`/`throw` abandoning the loop does NOT close (numbered
|
|
186
|
+
* divergence — the desugar cannot ride a finally, whose regions reject
|
|
187
|
+
* the loop's own break). */
|
|
188
|
+
export function lowerForOfGenerator(L, stmt, iterable, labels) {
|
|
189
|
+
if (!ts.isVariableDeclarationList(stmt.initializer)) {
|
|
190
|
+
L.unsupported("SC1090", stmt.initializer, "for-of over a pre-declared variable (declare the loop variable in the loop: for (const x of ...))");
|
|
191
|
+
}
|
|
192
|
+
const list = stmt.initializer;
|
|
193
|
+
if ((list.flags & ts.NodeFlags.Using) !== 0) {
|
|
194
|
+
L.unsupported("SC1090", list, "'using' declarations (dispose-at-scope-exit semantics)");
|
|
195
|
+
}
|
|
196
|
+
const isLet = (list.flags & ts.NodeFlags.Let) !== 0;
|
|
197
|
+
const decl = list.declarations[0];
|
|
198
|
+
if (!ts.isIdentifier(decl.name))
|
|
199
|
+
L.unsupported("SC1031", decl.name);
|
|
200
|
+
const genT = iterable.type;
|
|
201
|
+
if (genT.yieldT.kind === "void") {
|
|
202
|
+
L.unsupported("SC1090", stmt.expression, "for-of over a generator that never yields (its element type is never)");
|
|
203
|
+
}
|
|
204
|
+
if (genT.nextT.kind !== "undefinedT" && genT.nextT.kind !== "dyn") {
|
|
205
|
+
L.unsupported("SC1090", stmt.expression, `for-of over a generator whose yields expect .next(value) ('${L.fmt(genT.nextT)}' — drive it with .next() calls instead)`);
|
|
206
|
+
}
|
|
207
|
+
const loc = locOf(stmt);
|
|
208
|
+
const recT = resultRecordOf(L, genT);
|
|
209
|
+
const shape = L.shapes.get(recT.shapeId);
|
|
210
|
+
const valueT = shape.fields.find((f) => f.name === "value").type;
|
|
211
|
+
L.scopes.push(new Map());
|
|
212
|
+
try {
|
|
213
|
+
const g = L.declareHiddenLocal("%gof", genT);
|
|
214
|
+
const done = L.declareHiddenLocal("%gdone", BOOL);
|
|
215
|
+
done.mutable = true;
|
|
216
|
+
const r = L.declareHiddenLocal("%gres", recT);
|
|
217
|
+
const gRef = () => ({ kind: "varRef", localId: g.id, type: genT, loc });
|
|
218
|
+
const rRef = () => ({ kind: "varRef", localId: r.id, type: recT, loc });
|
|
219
|
+
const valueRead = { kind: "recordGet", obj: rRef(), shapeId: recT.shapeId, field: "value", type: valueT, loc };
|
|
220
|
+
const extracted = extractYieldValue(L, genT, valueT, valueRead, loc);
|
|
221
|
+
if (!extracted) {
|
|
222
|
+
L.unsupported("SC1090", stmt.expression, `for-of over a generator yielding '${L.fmt(genT.yieldT)}' (no per-element extraction exists — drive it with .next() and narrow r.value)`);
|
|
223
|
+
}
|
|
224
|
+
// `for (var x of gen)`: the mechanics stay on a hidden per-iteration
|
|
225
|
+
// local; the body opens by assigning into the hoisted var binding.
|
|
226
|
+
const varTarget = forOfVarTarget(L, decl);
|
|
227
|
+
const x = varTarget
|
|
228
|
+
? L.declareHiddenLocal("%vof", genT.yieldT)
|
|
229
|
+
: L.declareLocal(decl.name, decl.name.text, genT.yieldT, isLet);
|
|
230
|
+
const xRef = { kind: "varRef", localId: x.id, type: genT.yieldT, loc };
|
|
231
|
+
const head = [
|
|
232
|
+
{
|
|
233
|
+
kind: "varDecl",
|
|
234
|
+
localId: r.id,
|
|
235
|
+
init: { kind: "genResume", mode: "next", gen: gRef(), arg: null, type: recT, loc },
|
|
236
|
+
loc,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
kind: "if",
|
|
240
|
+
cond: {
|
|
241
|
+
kind: "recordGet",
|
|
242
|
+
obj: rRef(),
|
|
243
|
+
shapeId: recT.shapeId,
|
|
244
|
+
field: "done",
|
|
245
|
+
type: BOOL,
|
|
246
|
+
loc,
|
|
247
|
+
},
|
|
248
|
+
then: [
|
|
249
|
+
{ kind: "assign", localId: done.id, value: { kind: "boolLit", value: true, type: BOOL, loc }, loc },
|
|
250
|
+
{ kind: "break", loc },
|
|
251
|
+
],
|
|
252
|
+
else_: null,
|
|
253
|
+
loc,
|
|
254
|
+
},
|
|
255
|
+
{ kind: "varDecl", localId: x.id, init: extracted, loc },
|
|
256
|
+
...(varTarget
|
|
257
|
+
? [{ kind: "assign", localId: varTarget.id, value: L.coerceInto(decl.name, xRef, varTarget.type), loc }]
|
|
258
|
+
: []),
|
|
259
|
+
];
|
|
260
|
+
const body = L.inCtl("loop", () => L.lowerScopedBlock(stmt.statement), labels);
|
|
261
|
+
return {
|
|
262
|
+
kind: "block",
|
|
263
|
+
body: [
|
|
264
|
+
{ kind: "varDecl", localId: g.id, init: iterable, loc },
|
|
265
|
+
{ kind: "varDecl", localId: done.id, init: { kind: "boolLit", value: false, type: BOOL, loc }, loc },
|
|
266
|
+
{
|
|
267
|
+
kind: "while",
|
|
268
|
+
cond: { kind: "boolLit", value: true, type: BOOL, loc },
|
|
269
|
+
body: [...head, ...body],
|
|
270
|
+
...(labels && { labels }),
|
|
271
|
+
loc,
|
|
272
|
+
},
|
|
273
|
+
// IteratorClose: an early exit (break) closes the generator —
|
|
274
|
+
// finallys run; the .return() result record is dropped.
|
|
275
|
+
{
|
|
276
|
+
kind: "if",
|
|
277
|
+
cond: {
|
|
278
|
+
kind: "unary",
|
|
279
|
+
op: "!",
|
|
280
|
+
operand: { kind: "varRef", localId: done.id, type: BOOL, loc },
|
|
281
|
+
type: BOOL,
|
|
282
|
+
loc,
|
|
283
|
+
},
|
|
284
|
+
then: [
|
|
285
|
+
{
|
|
286
|
+
kind: "exprStmt",
|
|
287
|
+
expr: { kind: "genResume", mode: "return", gen: gRef(), arg: null, type: recT, loc },
|
|
288
|
+
loc,
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
else_: null,
|
|
292
|
+
loc,
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
loc,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
finally {
|
|
299
|
+
L.scopes.pop();
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/** Statement-position `yield* e;` — the forwarding loop:
|
|
303
|
+
*
|
|
304
|
+
* { const %dele = <e>; let %dr = %dele.next();
|
|
305
|
+
* while (!%dr.done) { %dr = %dele.next(<yield %dr.value>); } }
|
|
306
|
+
*
|
|
307
|
+
* The inner yield value re-yields out of the OUTER generator (coerced
|
|
308
|
+
* across the channels); the consumer's `.next(v)` argument forwards into
|
|
309
|
+
* the delegate; the delegate's return value is this statement's dropped
|
|
310
|
+
* result. Consumer `.return()`/`.throw()` while suspended here unwinds
|
|
311
|
+
* the OUTER generator without forwarding to the delegate (numbered
|
|
312
|
+
* divergence). Null when this is not a yield* statement. */
|
|
313
|
+
export function lowerYieldStarStatement(L, expr) {
|
|
314
|
+
if (!ts.isYieldExpression(expr) || expr.asteriskToken === undefined)
|
|
315
|
+
return null;
|
|
316
|
+
const gen = L.ctx.generator;
|
|
317
|
+
if (!gen)
|
|
318
|
+
L.unsupported("SC1071", expr);
|
|
319
|
+
if (!expr.expression)
|
|
320
|
+
L.unsupported("SC1071", expr, "'yield*' with no operand");
|
|
321
|
+
const loc = locOf(expr);
|
|
322
|
+
const delegate = L.lowerExpr(expr.expression);
|
|
323
|
+
if (delegate.type.kind !== "generator") {
|
|
324
|
+
L.unsupported("SC1071", expr, `'yield*' over '${L.fmt(delegate.type)}' (only generator delegates have a lowering — spell out the loop for other iterables)`);
|
|
325
|
+
}
|
|
326
|
+
const dT = delegate.type;
|
|
327
|
+
if (dT.nextT.kind !== "undefinedT" && dT.nextT.kind !== "dyn" && !typeEquals(dT.nextT, gen.nextT)) {
|
|
328
|
+
L.unsupported("SC1071", expr, `'yield*' into a '${L.fmt(dT.nextT)}' next channel from a '${gen.nextT.kind === "undefinedT" ? "undefined" : L.fmt(gen.nextT)}' one (the consumer's .next(v) cannot forward across these channels)`);
|
|
329
|
+
}
|
|
330
|
+
const recT = resultRecordOf(L, dT);
|
|
331
|
+
const shape = L.shapes.get(recT.shapeId);
|
|
332
|
+
const valueT = shape.fields.find((f) => f.name === "value").type;
|
|
333
|
+
L.scopes.push(new Map());
|
|
334
|
+
try {
|
|
335
|
+
const d = L.declareHiddenLocal("%dele", dT);
|
|
336
|
+
const r = L.declareHiddenLocal("%dres", recT);
|
|
337
|
+
r.mutable = true;
|
|
338
|
+
const dRef = () => ({ kind: "varRef", localId: d.id, type: dT, loc });
|
|
339
|
+
const rRef = () => ({ kind: "varRef", localId: r.id, type: recT, loc });
|
|
340
|
+
const valueRead = { kind: "recordGet", obj: rRef(), shapeId: recT.shapeId, field: "value", type: valueT, loc };
|
|
341
|
+
const inner = extractYieldValue(L, dT, valueT, valueRead, loc);
|
|
342
|
+
if (!inner) {
|
|
343
|
+
L.unsupported("SC1071", expr, `'yield*' over a generator yielding '${L.fmt(dT.yieldT)}' (no per-element extraction exists)`);
|
|
344
|
+
}
|
|
345
|
+
// The re-yield: the delegate's value coerced into the outer yield
|
|
346
|
+
// channel; the resumed value (outer nextT) forwards into the
|
|
347
|
+
// delegate's next slot (or drops on an undefined channel).
|
|
348
|
+
const reYield = {
|
|
349
|
+
kind: "yieldExpr",
|
|
350
|
+
value: typeEquals(dT.yieldT, gen.yieldT) && typeEquals(inner.type, gen.yieldT)
|
|
351
|
+
? inner
|
|
352
|
+
: L.coerceInto(expr.expression, inner, gen.yieldT),
|
|
353
|
+
type: gen.nextT.kind === "undefinedT" ? VOID : gen.nextT,
|
|
354
|
+
loc,
|
|
355
|
+
};
|
|
356
|
+
let forwarded;
|
|
357
|
+
if (dT.nextT.kind === "undefinedT") {
|
|
358
|
+
forwarded = null; // reYield still evaluates as the arg? no — see below
|
|
359
|
+
}
|
|
360
|
+
else if (reYield.type.kind === "void") {
|
|
361
|
+
forwarded = null;
|
|
362
|
+
}
|
|
363
|
+
else if (dT.nextT.kind === "dyn" && reYield.type.kind !== "dyn") {
|
|
364
|
+
forwarded = { kind: "dynFrom", value: reYield, type: DYN, loc };
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
forwarded = reYield;
|
|
368
|
+
}
|
|
369
|
+
const resumeArg = forwarded;
|
|
370
|
+
// When the yield's value cannot ride the resume argument (undefined
|
|
371
|
+
// channels), it must still EXECUTE before the delegate resumes: the
|
|
372
|
+
// loop body becomes [exprStmt(yield), assign(next)].
|
|
373
|
+
const loopBody = resumeArg === null
|
|
374
|
+
? [
|
|
375
|
+
{ kind: "exprStmt", expr: reYield, loc },
|
|
376
|
+
{
|
|
377
|
+
kind: "assign",
|
|
378
|
+
localId: r.id,
|
|
379
|
+
value: { kind: "genResume", mode: "next", gen: dRef(), arg: null, type: recT, loc },
|
|
380
|
+
loc,
|
|
381
|
+
},
|
|
382
|
+
]
|
|
383
|
+
: [
|
|
384
|
+
{
|
|
385
|
+
kind: "assign",
|
|
386
|
+
localId: r.id,
|
|
387
|
+
value: { kind: "genResume", mode: "next", gen: dRef(), arg: resumeArg, type: recT, loc },
|
|
388
|
+
loc,
|
|
389
|
+
},
|
|
390
|
+
];
|
|
391
|
+
return {
|
|
392
|
+
kind: "block",
|
|
393
|
+
body: [
|
|
394
|
+
{ kind: "varDecl", localId: d.id, init: delegate, loc },
|
|
395
|
+
{
|
|
396
|
+
kind: "varDecl",
|
|
397
|
+
localId: r.id,
|
|
398
|
+
init: { kind: "genResume", mode: "next", gen: dRef(), arg: null, type: recT, loc },
|
|
399
|
+
loc,
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
kind: "while",
|
|
403
|
+
cond: {
|
|
404
|
+
kind: "unary",
|
|
405
|
+
op: "!",
|
|
406
|
+
operand: { kind: "recordGet", obj: rRef(), shapeId: recT.shapeId, field: "done", type: BOOL, loc },
|
|
407
|
+
type: BOOL,
|
|
408
|
+
loc,
|
|
409
|
+
},
|
|
410
|
+
body: loopBody,
|
|
411
|
+
loc,
|
|
412
|
+
},
|
|
413
|
+
],
|
|
414
|
+
loc,
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
finally {
|
|
418
|
+
L.scopes.pop();
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
//# sourceMappingURL=lower-generators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lower-generators.js","sourceRoot":"","sources":["../../../src/frontend/lowering/lower-generators.ts"],"names":[],"mappings":"AAAA;;;;;;;qCAOqC;AACrC,OAAO,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAkC,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD;0DAC0D;AAC1D,SAAS,cAAc,CAAC,CAAU,EAAE,IAAa;IAC/C,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EA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AAE,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;oBAClF,GAAG;iBACJ;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE;wBACJ,IAAI,EAAE,OAAO;wBACb,EAAE,EAAE,GAAG;wBACP,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;wBAClG,IAAI,EAAE,IAAI;wBACV,GAAG;qBACJ;oBACD,IAAI,EAAE,QAAQ;oBACd,GAAG;iBACJ;aACF;YACD,GAAG;SACJ,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as ts from "../ts7/adapter.js";
|
|
2
|
+
import type { Lowerer } from "./lowerer.js";
|
|
3
|
+
import { IrExpr, SrcLoc } from "../../ir/nodes.js";
|
|
4
|
+
/** strEscape's quote ladder over a COMPILE-TIME string (record field
|
|
5
|
+
* names, format-string chunks never pass through here — only keys).
|
|
6
|
+
* Mirrors scr_inspect.c's insp_quote_into byte-for-byte. */
|
|
7
|
+
export declare function inspectQuote(s: string): string;
|
|
8
|
+
/** util.format(...) / util.formatWithOptions({}, ...): the compile-time
|
|
9
|
+
* %-substitution over a literal format string (formatWithOptionsInternal
|
|
10
|
+
* ported exactly — the arg cursor, the args-exhausted guard, %c's
|
|
11
|
+
* consume-and-drop), with per-static-type conversions. Non-literal
|
|
12
|
+
* format strings lower only in the substitution-free shapes. */
|
|
13
|
+
export declare function lowerFormatCall(L: Lowerer, expr: ts.CallExpression, loc: SrcLoc, withOptions: boolean): IrExpr;
|
|
14
|
+
/** The spoke's entry, called from both the named-import and namespace/
|
|
15
|
+
* default-import call paths. Null for other modules and members (the
|
|
16
|
+
* module tables' fence takes over). */
|
|
17
|
+
export declare function lowerUtilModuleCall(L: Lowerer, expr: ts.CallExpression, bi: {
|
|
18
|
+
module: string;
|
|
19
|
+
member: string;
|
|
20
|
+
}, loc: SrcLoc): IrExpr | null;
|