@kernlang/core 3.5.9-canary.218.1.77aa9b0c → 4.0.0
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/dist/capability-matrix.js +8 -6
- package/dist/capability-matrix.js.map +1 -1
- package/dist/closure-eligibility.d.ts +104 -0
- package/dist/closure-eligibility.js +443 -0
- package/dist/closure-eligibility.js.map +1 -0
- package/dist/closure-python-lowering.d.ts +26 -0
- package/dist/closure-python-lowering.js +132 -22
- package/dist/closure-python-lowering.js.map +1 -1
- package/dist/codegen/body-ts.js +13 -0
- package/dist/codegen/body-ts.js.map +1 -1
- package/dist/codegen/type-system.js +50 -3
- package/dist/codegen/type-system.js.map +1 -1
- package/dist/codegen-core.js +29 -0
- package/dist/codegen-core.js.map +1 -1
- package/dist/codegen-expression.js +7 -0
- package/dist/codegen-expression.js.map +1 -1
- package/dist/constructor-super.d.ts +34 -0
- package/dist/constructor-super.js +122 -0
- package/dist/constructor-super.js.map +1 -0
- package/dist/core-contracts/boolean.d.ts +147 -0
- package/dist/core-contracts/boolean.js +110 -0
- package/dist/core-contracts/boolean.js.map +1 -0
- package/dist/core-contracts/function.d.ts +6 -0
- package/dist/core-contracts/function.js +7 -0
- package/dist/core-contracts/function.js.map +1 -0
- package/dist/core-contracts/index.d.ts +1032 -0
- package/dist/core-contracts/index.js +30 -0
- package/dist/core-contracts/index.js.map +1 -0
- package/dist/core-contracts/list.d.ts +87 -0
- package/dist/core-contracts/list.js +54 -0
- package/dist/core-contracts/list.js.map +1 -0
- package/dist/core-contracts/nullish.d.ts +12 -0
- package/dist/core-contracts/nullish.js +13 -0
- package/dist/core-contracts/nullish.js.map +1 -0
- package/dist/core-contracts/number.d.ts +291 -0
- package/dist/core-contracts/number.js +214 -0
- package/dist/core-contracts/number.js.map +1 -0
- package/dist/core-contracts/record.d.ts +60 -0
- package/dist/core-contracts/record.js +32 -0
- package/dist/core-contracts/record.js.map +1 -0
- package/dist/core-contracts/schema.d.ts +71 -0
- package/dist/core-contracts/schema.js +98 -0
- package/dist/core-contracts/schema.js.map +1 -0
- package/dist/core-contracts/semantics.d.ts +7 -0
- package/dist/core-contracts/semantics.js +221 -0
- package/dist/core-contracts/semantics.js.map +1 -0
- package/dist/core-contracts/string.d.ts +414 -0
- package/dist/core-contracts/string.js +335 -0
- package/dist/core-contracts/string.js.map +1 -0
- package/dist/core-runtime/contract-adapter.d.ts +8 -0
- package/dist/core-runtime/contract-adapter.js +73 -0
- package/dist/core-runtime/contract-adapter.js.map +1 -0
- package/dist/core-runtime/index.d.ts +109 -0
- package/dist/core-runtime/index.js +1946 -0
- package/dist/core-runtime/index.js.map +1 -0
- package/dist/core-runtime/shape-validator.d.ts +61 -0
- package/dist/core-runtime/shape-validator.js +564 -0
- package/dist/core-runtime/shape-validator.js.map +1 -0
- package/dist/core-runtime/value-brand.d.ts +2 -0
- package/dist/core-runtime/value-brand.js +6 -0
- package/dist/core-runtime/value-brand.js.map +1 -0
- package/dist/decompiler.js +46 -0
- package/dist/decompiler.js.map +1 -1
- package/dist/eligibility-taxonomy.d.ts +58 -0
- package/dist/eligibility-taxonomy.generated.d.ts +472 -0
- package/dist/eligibility-taxonomy.generated.js +566 -0
- package/dist/eligibility-taxonomy.generated.js.map +1 -0
- package/dist/eligibility-taxonomy.js +55 -0
- package/dist/eligibility-taxonomy.js.map +1 -0
- package/dist/index.d.ts +19 -2
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/instanceof-rhs.d.ts +53 -0
- package/dist/instanceof-rhs.js +74 -0
- package/dist/instanceof-rhs.js.map +1 -0
- package/dist/ir/semantics/lambda.js +9 -1
- package/dist/ir/semantics/lambda.js.map +1 -1
- package/dist/native-eligibility-ast.d.ts +5 -0
- package/dist/native-eligibility-ast.js +242 -63
- package/dist/native-eligibility-ast.js.map +1 -1
- package/dist/parser-expression.d.ts +1 -1
- package/dist/parser-expression.js +90 -1
- package/dist/parser-expression.js.map +1 -1
- package/dist/rag-assertions.d.ts +3 -0
- package/dist/rag-assertions.js +15 -0
- package/dist/rag-assertions.js.map +1 -0
- package/dist/rag-runtime.d.ts +169 -0
- package/dist/rag-runtime.js +823 -0
- package/dist/rag-runtime.js.map +1 -0
- package/dist/schema.d.ts +1 -0
- package/dist/schema.js +197 -2
- package/dist/schema.js.map +1 -1
- package/dist/semantic-substrate.d.ts +108 -0
- package/dist/semantic-substrate.js +263 -0
- package/dist/semantic-substrate.js.map +1 -0
- package/dist/semantic-validator.d.ts +332 -0
- package/dist/semantic-validator.js +3387 -0
- package/dist/semantic-validator.js.map +1 -1
- package/dist/spec.d.ts +2 -2
- package/dist/spec.js +15 -1
- package/dist/spec.js.map +1 -1
- package/dist/value-ir.d.ts +11 -1
- package/dist/value-ir.js.map +1 -1
- package/package.json +5 -1
|
@@ -126,15 +126,17 @@ const PY_CORE_CAPABILITIES = [
|
|
|
126
126
|
support: 'unsupported',
|
|
127
127
|
note: 'mapTsTypeToPython has no tuple branch; alias passthrough emits raw TS form',
|
|
128
128
|
},
|
|
129
|
-
// Slice 2b
|
|
130
|
-
//
|
|
131
|
-
//
|
|
132
|
-
//
|
|
129
|
+
// Slice 2b / enum-python-parity — the `enum` node now lowers to a PLAIN
|
|
130
|
+
// Python namespace class (`class Status:` with bare int/str members), NOT
|
|
131
|
+
// enum.Enum / IntEnum / a metaclass and with NO runtime import (tribunal
|
|
132
|
+
// run-1781176354539). Bare members give equality/arithmetic/JSON/fmt parity
|
|
133
|
+
// with the TS enum by construction. See generatePythonEnum in
|
|
134
|
+
// packages/python/src/generators/data.ts.
|
|
133
135
|
{
|
|
134
136
|
feature: 'enum-type',
|
|
135
137
|
position: 'top-level',
|
|
136
|
-
support: '
|
|
137
|
-
note: '
|
|
138
|
+
support: 'lowered',
|
|
139
|
+
note: 'lowers to a plain namespace class with bare int/str members (no enum.Enum, no runtime import)',
|
|
138
140
|
},
|
|
139
141
|
// Slice 2c — Python has dict[K, V] / TypedDict but the FastAPI generator
|
|
140
142
|
// does not yet emit either form from an `indexer` child. Mark unsupported.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability-matrix.js","sourceRoot":"","sources":["../src/capability-matrix.ts"],"names":[],"mappings":"AAAA;;iEAEiE;AAiBjE,MAAM,oBAAoB,GAAsB;IAC9C,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE;IACvE,EAAE,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE;IACnF,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE;IACxE,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE;IACrE,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE;IACxE,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE;IACvE;QACE,OAAO,EAAE,6BAA6B;QACtC,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,sCAAsC;KAC7C;IACD,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE;IACxE,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE;IAC1E,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE;IAChE,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE;IAC1E,kFAAkF;IAClF,sGAAsG;IACtG,EAAE,OAAO,EAAE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,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,EAAE,OAAO,IAAI,aAAa,CAAC;AACzG,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/** v1 closure gate — fail-closed eligibility predicate AND emission
|
|
2
|
+
* precondition for block-bodied arrow functions in native KERN bodies.
|
|
3
|
+
*
|
|
4
|
+
* Architecture (council + tribunal decided, Option B′ "TS-AST-grounded raw
|
|
5
|
+
* body"): the lambda IR carries the raw block text (`bodyBlock.raw`) for
|
|
6
|
+
* verbatim TS re-emit ONLY. Every analyzer/consumer reads the TS AST obtained
|
|
7
|
+
* through `parseClosureBlockAst` here — never scans the string. The IR does
|
|
8
|
+
* NOT store the `ts.Block` (serialization safety); this helper recomputes it
|
|
9
|
+
* (cheap; memoized via a module-level `Map`).
|
|
10
|
+
*
|
|
11
|
+
* The gate is the SINGLE owner of "is this block body supported" — used by:
|
|
12
|
+
* - the parser (parse-time validation, fail-closed)
|
|
13
|
+
* - the migrator eligibility classifier (`native-eligibility-ast.ts`)
|
|
14
|
+
* - the Python lowerer precondition (`codegen-body-python.ts`)
|
|
15
|
+
* so nothing eligible can fail to lower.
|
|
16
|
+
*
|
|
17
|
+
* ── Mutation v1 (the closure-mutation slice) ───────────────────────────────
|
|
18
|
+
* The gate now ACCEPTS in statement position:
|
|
19
|
+
* (a) assignments to bare identifiers — block-LOCAL or FREE alike. The gate
|
|
20
|
+
* is a SHAPE classifier: it sees only the block (params live on the arrow
|
|
21
|
+
* and are stripped before the block is parsed), so it CANNOT tell a free
|
|
22
|
+
* capture from a closure param. Both are accepted here; the Python
|
|
23
|
+
* EMITTER (`emitBlockClosurePy`) decides pinned-vs-`nonlocal` using the
|
|
24
|
+
* enclosing loop context it alone can see, and the LOWERER excludes
|
|
25
|
+
* params from the written-free set (so a param write stays a plain local
|
|
26
|
+
* assignment, never `nonlocal`). The compound forms `+=,-=,*=,/=,%=` are
|
|
27
|
+
* accepted; statement-position `++`/`--` lower to `+= 1`/`-= 1`.
|
|
28
|
+
* (b) member/index writes on any non-`this` base (`acc.total = 1`,
|
|
29
|
+
* `acc[i] = v`, compound forms) — by-reference parity, no `nonlocal`.
|
|
30
|
+
* It KEEPS REJECTING, with precise reasons:
|
|
31
|
+
* - `this`-rooted targets → `closure-this` (unchanged).
|
|
32
|
+
* - destructuring / parenthesized targets → `closure-unsupported-assign-target`.
|
|
33
|
+
* - assignment operators outside {=,+=,-=,*=,/=,%=} (e.g. `&=`, `|=`, `<<=`)
|
|
34
|
+
* → `closure-unsupported-operator`.
|
|
35
|
+
* - value-position `++`/`--` (operand of a larger expression, e.g.
|
|
36
|
+
* `arr.push(x++)`) → `closure-incdec-value-position`.
|
|
37
|
+
* The eligibility≢lowerability gap for PINNED captures (a free write to a
|
|
38
|
+
* per-iteration loop binding) is intentional and surfaces as a LOUD compile
|
|
39
|
+
* error at emission (`closure-pinned-write`), not here: the single-statement
|
|
40
|
+
* gate cannot see the enclosing loop header.
|
|
41
|
+
*
|
|
42
|
+
* v1 is deliberately NARROWER than the lowering machinery
|
|
43
|
+
* (`lowerJsClosureBodyToPython` supports try/for-of; the gate rejects them).
|
|
44
|
+
* Widening the gate is a future slice. */
|
|
45
|
+
import ts from 'typescript';
|
|
46
|
+
/** Parse a raw closure block (`{ ... }`, braces included) into a `ts.Block`,
|
|
47
|
+
* or `null` if it does not parse cleanly as a single function body block.
|
|
48
|
+
*
|
|
49
|
+
* Generalized from the former `parseClosureBlock` in
|
|
50
|
+
* closure-python-lowering.ts (which now imports this). Route behavior is
|
|
51
|
+
* unchanged: the lowerer still validates the same way. */
|
|
52
|
+
export declare function parseClosureBlockAst(raw: string): ts.Block | null;
|
|
53
|
+
/** Collect the set of free identifier NAMES referenced in a closure block —
|
|
54
|
+
* identifiers used in the block that are NOT declared inside the block and
|
|
55
|
+
* NOT in `paramNames` (the closure's own parameters). These are exactly the
|
|
56
|
+
* names the closure CAPTURES from its enclosing scope.
|
|
57
|
+
*
|
|
58
|
+
* Slice-2 loop-variable pinning consumes this: a captured name whose binding
|
|
59
|
+
* resolves at-or-inside the enclosing loop body must be pinned via a Python
|
|
60
|
+
* default arg, so each closure sees its own iteration's value (JS per-iteration
|
|
61
|
+
* capture) instead of late-binding to the last value.
|
|
62
|
+
*
|
|
63
|
+
* Uses the TS AST (via `parseClosureBlockAst`) — never string scanning.
|
|
64
|
+
* Excludes, per the spec:
|
|
65
|
+
* - the `.name` side of a member access (`a.b` references only `a`),
|
|
66
|
+
* - object-literal property keys (`{ a: 1 }` — `a` is a key, not a ref),
|
|
67
|
+
* - declaration names themselves (`const x = …` — `x` is the bound name),
|
|
68
|
+
* - shorthand-property assignment names are NOT excluded: `{ a }` reads `a`,
|
|
69
|
+
* so the shorthand identifier IS a real reference and stays in the set.
|
|
70
|
+
*
|
|
71
|
+
* A name both declared-inside and referenced (a block-local, or a shadowing
|
|
72
|
+
* re-declaration) is NOT free — `collectLocalDeclaredNames` removes it. The
|
|
73
|
+
* block is parsed once (memoized); a parse failure yields an empty set (the
|
|
74
|
+
* gate already rejected such bodies, so this is defensive). */
|
|
75
|
+
export declare function collectFreeIdentifierNames(raw: string, paramNames: string[]): Set<string>;
|
|
76
|
+
/** The assignment operators the mutation-v1 gate accepts (mirrored by the
|
|
77
|
+
* Python lowerer, which emits the same compound operator directly). Anything
|
|
78
|
+
* else (`&=`, `|=`, `^=`, `<<=`, `>>=`, `>>>=`, `**=`, `&&=`, `||=`, `??=`)
|
|
79
|
+
* rejects with `closure-unsupported-operator`. The lowerer SHARES this set so
|
|
80
|
+
* the gate and the emitter never drift. */
|
|
81
|
+
export declare const CLOSURE_ASSIGN_OPERATORS: ReadonlySet<ts.SyntaxKind>;
|
|
82
|
+
/** Classify a closure block body. Returns `null` if the body is supported by
|
|
83
|
+
* the v1 gate, or a distinct reject-reason string otherwise.
|
|
84
|
+
*
|
|
85
|
+
* ACCEPT set: `let`/`const` (identifier names + initializers, no
|
|
86
|
+
* destructuring), `return` (with or without expression), expression
|
|
87
|
+
* statements, `if`/`else` (block or single-statement branches, nesting fine).
|
|
88
|
+
* Statement-position MUTATIONS are now accepted: assignments to a bare
|
|
89
|
+
* identifier (local OR free) and to a non-`this` member/index target, with the
|
|
90
|
+
* operators {=,+=,-=,*=,/=,%=}, plus statement-position `++`/`--`.
|
|
91
|
+
*
|
|
92
|
+
* REJECT (whole-block walk): `this` (incl. a `this`-rooted assign target →
|
|
93
|
+
* `closure-this`), nested arrow/function/class, `yield`, `await`, any loop,
|
|
94
|
+
* `throw`, `try`, `switch`, `break`/`continue`, `var`, parameter default
|
|
95
|
+
* values, spread, labeled statements, `with`; a destructuring/parenthesized
|
|
96
|
+
* assign target (`closure-unsupported-assign-target`); an assignment operator
|
|
97
|
+
* outside the accepted set (`closure-unsupported-operator`); and a
|
|
98
|
+
* value-position `++`/`--` (`closure-incdec-value-position`). Member/index
|
|
99
|
+
* mutation and method calls on a captured object (`acc.push(x)`) are allowed.
|
|
100
|
+
* Any statement outside the accept set rejects. NOTE: a free write to a
|
|
101
|
+
* PINNED per-iteration loop capture passes the gate but is rejected LOUDLY at
|
|
102
|
+
* Python emission (`closure-pinned-write`) — the single-statement gate cannot
|
|
103
|
+
* see the enclosing loop header (eligibility≢lowerability, by design). */
|
|
104
|
+
export declare function classifyClosureBlock(raw: string): null | string;
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
/** v1 closure gate — fail-closed eligibility predicate AND emission
|
|
2
|
+
* precondition for block-bodied arrow functions in native KERN bodies.
|
|
3
|
+
*
|
|
4
|
+
* Architecture (council + tribunal decided, Option B′ "TS-AST-grounded raw
|
|
5
|
+
* body"): the lambda IR carries the raw block text (`bodyBlock.raw`) for
|
|
6
|
+
* verbatim TS re-emit ONLY. Every analyzer/consumer reads the TS AST obtained
|
|
7
|
+
* through `parseClosureBlockAst` here — never scans the string. The IR does
|
|
8
|
+
* NOT store the `ts.Block` (serialization safety); this helper recomputes it
|
|
9
|
+
* (cheap; memoized via a module-level `Map`).
|
|
10
|
+
*
|
|
11
|
+
* The gate is the SINGLE owner of "is this block body supported" — used by:
|
|
12
|
+
* - the parser (parse-time validation, fail-closed)
|
|
13
|
+
* - the migrator eligibility classifier (`native-eligibility-ast.ts`)
|
|
14
|
+
* - the Python lowerer precondition (`codegen-body-python.ts`)
|
|
15
|
+
* so nothing eligible can fail to lower.
|
|
16
|
+
*
|
|
17
|
+
* ── Mutation v1 (the closure-mutation slice) ───────────────────────────────
|
|
18
|
+
* The gate now ACCEPTS in statement position:
|
|
19
|
+
* (a) assignments to bare identifiers — block-LOCAL or FREE alike. The gate
|
|
20
|
+
* is a SHAPE classifier: it sees only the block (params live on the arrow
|
|
21
|
+
* and are stripped before the block is parsed), so it CANNOT tell a free
|
|
22
|
+
* capture from a closure param. Both are accepted here; the Python
|
|
23
|
+
* EMITTER (`emitBlockClosurePy`) decides pinned-vs-`nonlocal` using the
|
|
24
|
+
* enclosing loop context it alone can see, and the LOWERER excludes
|
|
25
|
+
* params from the written-free set (so a param write stays a plain local
|
|
26
|
+
* assignment, never `nonlocal`). The compound forms `+=,-=,*=,/=,%=` are
|
|
27
|
+
* accepted; statement-position `++`/`--` lower to `+= 1`/`-= 1`.
|
|
28
|
+
* (b) member/index writes on any non-`this` base (`acc.total = 1`,
|
|
29
|
+
* `acc[i] = v`, compound forms) — by-reference parity, no `nonlocal`.
|
|
30
|
+
* It KEEPS REJECTING, with precise reasons:
|
|
31
|
+
* - `this`-rooted targets → `closure-this` (unchanged).
|
|
32
|
+
* - destructuring / parenthesized targets → `closure-unsupported-assign-target`.
|
|
33
|
+
* - assignment operators outside {=,+=,-=,*=,/=,%=} (e.g. `&=`, `|=`, `<<=`)
|
|
34
|
+
* → `closure-unsupported-operator`.
|
|
35
|
+
* - value-position `++`/`--` (operand of a larger expression, e.g.
|
|
36
|
+
* `arr.push(x++)`) → `closure-incdec-value-position`.
|
|
37
|
+
* The eligibility≢lowerability gap for PINNED captures (a free write to a
|
|
38
|
+
* per-iteration loop binding) is intentional and surfaces as a LOUD compile
|
|
39
|
+
* error at emission (`closure-pinned-write`), not here: the single-statement
|
|
40
|
+
* gate cannot see the enclosing loop header.
|
|
41
|
+
*
|
|
42
|
+
* v1 is deliberately NARROWER than the lowering machinery
|
|
43
|
+
* (`lowerJsClosureBodyToPython` supports try/for-of; the gate rejects them).
|
|
44
|
+
* Widening the gate is a future slice. */
|
|
45
|
+
import ts from 'typescript';
|
|
46
|
+
/** Memoize parsed blocks. Keyed by the raw (trimmed) source. A `null` value is
|
|
47
|
+
* a cached "does not parse / not a single block" verdict. */
|
|
48
|
+
const blockCache = new Map();
|
|
49
|
+
/** Parse a raw closure block (`{ ... }`, braces included) into a `ts.Block`,
|
|
50
|
+
* or `null` if it does not parse cleanly as a single function body block.
|
|
51
|
+
*
|
|
52
|
+
* Generalized from the former `parseClosureBlock` in
|
|
53
|
+
* closure-python-lowering.ts (which now imports this). Route behavior is
|
|
54
|
+
* unchanged: the lowerer still validates the same way. */
|
|
55
|
+
export function parseClosureBlockAst(raw) {
|
|
56
|
+
const trimmed = raw.trim();
|
|
57
|
+
if (blockCache.has(trimmed))
|
|
58
|
+
return blockCache.get(trimmed) ?? null;
|
|
59
|
+
const result = parseClosureBlockUncached(trimmed);
|
|
60
|
+
blockCache.set(trimmed, result);
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
function parseClosureBlockUncached(trimmed) {
|
|
64
|
+
if (trimmed.length < 2 || trimmed[0] !== '{' || trimmed[trimmed.length - 1] !== '}')
|
|
65
|
+
return null;
|
|
66
|
+
const source = `function __kern_closure__() ${trimmed}`;
|
|
67
|
+
const sf = ts.createSourceFile('__kern_closure__.ts', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
68
|
+
const diags = sf.parseDiagnostics;
|
|
69
|
+
if (diags && diags.length > 0)
|
|
70
|
+
return null;
|
|
71
|
+
const fn = sf.statements[0];
|
|
72
|
+
if (!fn || !ts.isFunctionDeclaration(fn) || !fn.body)
|
|
73
|
+
return null;
|
|
74
|
+
return fn.body;
|
|
75
|
+
}
|
|
76
|
+
/** Collect identifier names bound by `let`/`const` declarations directly inside
|
|
77
|
+
* the closure block (including inside nested if/else branches the gate
|
|
78
|
+
* accepts). Used to distinguish a free-variable write (rejected) from an
|
|
79
|
+
* assignment to a closure-local (allowed). v1 only admits identifier-named
|
|
80
|
+
* declarations, so destructured names never enter this set. */
|
|
81
|
+
function collectLocalDeclaredNames(block) {
|
|
82
|
+
const names = new Set();
|
|
83
|
+
const visit = (node) => {
|
|
84
|
+
if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name)) {
|
|
85
|
+
names.add(node.name.text);
|
|
86
|
+
}
|
|
87
|
+
ts.forEachChild(node, visit);
|
|
88
|
+
};
|
|
89
|
+
ts.forEachChild(block, visit);
|
|
90
|
+
return names;
|
|
91
|
+
}
|
|
92
|
+
/** Collect the set of free identifier NAMES referenced in a closure block —
|
|
93
|
+
* identifiers used in the block that are NOT declared inside the block and
|
|
94
|
+
* NOT in `paramNames` (the closure's own parameters). These are exactly the
|
|
95
|
+
* names the closure CAPTURES from its enclosing scope.
|
|
96
|
+
*
|
|
97
|
+
* Slice-2 loop-variable pinning consumes this: a captured name whose binding
|
|
98
|
+
* resolves at-or-inside the enclosing loop body must be pinned via a Python
|
|
99
|
+
* default arg, so each closure sees its own iteration's value (JS per-iteration
|
|
100
|
+
* capture) instead of late-binding to the last value.
|
|
101
|
+
*
|
|
102
|
+
* Uses the TS AST (via `parseClosureBlockAst`) — never string scanning.
|
|
103
|
+
* Excludes, per the spec:
|
|
104
|
+
* - the `.name` side of a member access (`a.b` references only `a`),
|
|
105
|
+
* - object-literal property keys (`{ a: 1 }` — `a` is a key, not a ref),
|
|
106
|
+
* - declaration names themselves (`const x = …` — `x` is the bound name),
|
|
107
|
+
* - shorthand-property assignment names are NOT excluded: `{ a }` reads `a`,
|
|
108
|
+
* so the shorthand identifier IS a real reference and stays in the set.
|
|
109
|
+
*
|
|
110
|
+
* A name both declared-inside and referenced (a block-local, or a shadowing
|
|
111
|
+
* re-declaration) is NOT free — `collectLocalDeclaredNames` removes it. The
|
|
112
|
+
* block is parsed once (memoized); a parse failure yields an empty set (the
|
|
113
|
+
* gate already rejected such bodies, so this is defensive). */
|
|
114
|
+
export function collectFreeIdentifierNames(raw, paramNames) {
|
|
115
|
+
const block = parseClosureBlockAst(raw);
|
|
116
|
+
if (block === null)
|
|
117
|
+
return new Set();
|
|
118
|
+
const declared = collectLocalDeclaredNames(block);
|
|
119
|
+
const params = new Set(paramNames);
|
|
120
|
+
const free = new Set();
|
|
121
|
+
const visit = (node) => {
|
|
122
|
+
if (ts.isIdentifier(node)) {
|
|
123
|
+
const parent = node.parent;
|
|
124
|
+
// `a.b` — only `a` is a reference; skip the `.b` name side.
|
|
125
|
+
if (parent && ts.isPropertyAccessExpression(parent) && parent.name === node)
|
|
126
|
+
return;
|
|
127
|
+
// `a?.b` qualified-name / similar — defensive (PropertyAccess covers the
|
|
128
|
+
// common case; QualifiedName appears only in type positions, which the
|
|
129
|
+
// gate rejects, but skip the right-hand name there too for safety).
|
|
130
|
+
if (parent && ts.isQualifiedName(parent) && parent.right === node)
|
|
131
|
+
return;
|
|
132
|
+
// Object-literal property KEY (`{ a: 1 }`) — `a` is a key, not a ref.
|
|
133
|
+
// Shorthand (`{ a }`) is a ShorthandPropertyAssignment whose `.name` IS
|
|
134
|
+
// a real read of `a`, so it is NOT excluded here.
|
|
135
|
+
if (parent && ts.isPropertyAssignment(parent) && parent.name === node)
|
|
136
|
+
return;
|
|
137
|
+
// Declaration name (`const x = …`, `let x`, a binding-element name).
|
|
138
|
+
if (parent && ts.isVariableDeclaration(parent) && parent.name === node)
|
|
139
|
+
return;
|
|
140
|
+
if (parent && ts.isBindingElement(parent) && parent.name === node)
|
|
141
|
+
return;
|
|
142
|
+
// A binding element's property name (`const { p: local } = o` — `p`).
|
|
143
|
+
if (parent && ts.isBindingElement(parent) && parent.propertyName === node)
|
|
144
|
+
return;
|
|
145
|
+
const name = node.text;
|
|
146
|
+
if (declared.has(name) || params.has(name))
|
|
147
|
+
return;
|
|
148
|
+
free.add(name);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
ts.forEachChild(node, visit);
|
|
152
|
+
};
|
|
153
|
+
ts.forEachChild(block, visit);
|
|
154
|
+
return free;
|
|
155
|
+
}
|
|
156
|
+
/** True when `target` is itself a bare identifier (not a member/index). A bare
|
|
157
|
+
* identifier write rebinds the variable; a member/index write mutates an
|
|
158
|
+
* object the closure captured. Both are accepted under mutation-v1. */
|
|
159
|
+
function isBareIdentifierTarget(target) {
|
|
160
|
+
return ts.isIdentifier(target);
|
|
161
|
+
}
|
|
162
|
+
/** The assignment operators the mutation-v1 gate accepts (mirrored by the
|
|
163
|
+
* Python lowerer, which emits the same compound operator directly). Anything
|
|
164
|
+
* else (`&=`, `|=`, `^=`, `<<=`, `>>=`, `>>>=`, `**=`, `&&=`, `||=`, `??=`)
|
|
165
|
+
* rejects with `closure-unsupported-operator`. The lowerer SHARES this set so
|
|
166
|
+
* the gate and the emitter never drift. */
|
|
167
|
+
export const CLOSURE_ASSIGN_OPERATORS = new Set([
|
|
168
|
+
ts.SyntaxKind.EqualsToken,
|
|
169
|
+
ts.SyntaxKind.PlusEqualsToken,
|
|
170
|
+
ts.SyntaxKind.MinusEqualsToken,
|
|
171
|
+
ts.SyntaxKind.AsteriskEqualsToken,
|
|
172
|
+
ts.SyntaxKind.SlashEqualsToken,
|
|
173
|
+
ts.SyntaxKind.PercentEqualsToken,
|
|
174
|
+
]);
|
|
175
|
+
/** Classify an assignment/update TARGET inside a closure block. Returns `null`
|
|
176
|
+
* when the target SHAPE is accepted (bare identifier — local or free; or a
|
|
177
|
+
* non-`this` member/index write), or a precise reject reason otherwise.
|
|
178
|
+
*
|
|
179
|
+
* The gate is a shape classifier and cannot distinguish a free capture from a
|
|
180
|
+
* closure param (params are stripped before the block is parsed). Both bare
|
|
181
|
+
* cases accept here; `nonlocal`-vs-pinned-vs-local is the Python emitter's
|
|
182
|
+
* decision (see the header doc + `emitBlockClosurePy`). */
|
|
183
|
+
function classifyAssignTarget(target) {
|
|
184
|
+
if (isBareIdentifierTarget(target)) {
|
|
185
|
+
// Bare identifier — local OR free, both accepted. The lowerer/emitter
|
|
186
|
+
// decide whether a `nonlocal` declaration is needed.
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
if (ts.isPropertyAccessExpression(target) || ts.isElementAccessExpression(target)) {
|
|
190
|
+
// A `this`-rooted target (`this.x = …`) is first and foremost a `this`
|
|
191
|
+
// usage — surface the more precise reason the rest of the gate uses.
|
|
192
|
+
let current = target;
|
|
193
|
+
while (ts.isPropertyAccessExpression(current) || ts.isElementAccessExpression(current)) {
|
|
194
|
+
current = current.expression;
|
|
195
|
+
}
|
|
196
|
+
if (current.kind === ts.SyntaxKind.ThisKeyword)
|
|
197
|
+
return 'closure-this';
|
|
198
|
+
// Member/index write on a non-`this` base — by-reference mutation, accepted.
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
// Destructuring (`({a} = x)`, `[a] = x`) or parenthesized (`(a) = x`) target —
|
|
202
|
+
// could smuggle a free write past the bare-identifier check. Fail closed.
|
|
203
|
+
return 'closure-unsupported-assign-target';
|
|
204
|
+
}
|
|
205
|
+
/** Walk the whole block rejecting any v1-unsupported construct. Returns a
|
|
206
|
+
* distinct reject reason string, or `null` if no unsupported construct is
|
|
207
|
+
* found. Statement-level shape (only let/const/return/expr/if accepted) is
|
|
208
|
+
* checked separately by `classifyStatementShape`. */
|
|
209
|
+
function findUnsupportedConstruct(block) {
|
|
210
|
+
let reason = null;
|
|
211
|
+
const visit = (node) => {
|
|
212
|
+
if (reason !== null)
|
|
213
|
+
return;
|
|
214
|
+
// Nested functions of any kind — closures cannot nest in v1.
|
|
215
|
+
if (ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node)) {
|
|
216
|
+
reason = 'closure-nested-function';
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (ts.isClassDeclaration(node) || ts.isClassExpression(node)) {
|
|
220
|
+
reason = 'closure-class';
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (node.kind === ts.SyntaxKind.ThisKeyword) {
|
|
224
|
+
reason = 'closure-this';
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (ts.isYieldExpression(node)) {
|
|
228
|
+
reason = 'closure-yield';
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (ts.isAwaitExpression(node)) {
|
|
232
|
+
reason = 'closure-await';
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (ts.isSpreadElement(node) || ts.isSpreadAssignment(node)) {
|
|
236
|
+
reason = 'closure-spread';
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
// Any loop.
|
|
240
|
+
if (ts.isForStatement(node) ||
|
|
241
|
+
ts.isForOfStatement(node) ||
|
|
242
|
+
ts.isForInStatement(node) ||
|
|
243
|
+
ts.isWhileStatement(node) ||
|
|
244
|
+
ts.isDoStatement(node)) {
|
|
245
|
+
reason = 'closure-loop';
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (ts.isThrowStatement(node)) {
|
|
249
|
+
reason = 'closure-throw';
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (ts.isTryStatement(node)) {
|
|
253
|
+
reason = 'closure-try';
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (ts.isSwitchStatement(node)) {
|
|
257
|
+
reason = 'closure-switch';
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (ts.isBreakStatement(node) || ts.isContinueStatement(node)) {
|
|
261
|
+
reason = 'closure-break-continue';
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (ts.isLabeledStatement(node)) {
|
|
265
|
+
reason = 'closure-labeled';
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (ts.isWithStatement(node)) {
|
|
269
|
+
reason = 'closure-with';
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
// `var` declarations.
|
|
273
|
+
if (ts.isVariableStatement(node)) {
|
|
274
|
+
const flags = node.declarationList.flags;
|
|
275
|
+
if ((flags & ts.NodeFlags.Let) === 0 && (flags & ts.NodeFlags.Const) === 0) {
|
|
276
|
+
reason = 'closure-var';
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
for (const decl of node.declarationList.declarations) {
|
|
280
|
+
if (!ts.isIdentifier(decl.name)) {
|
|
281
|
+
reason = 'closure-destructure';
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (!decl.initializer) {
|
|
285
|
+
reason = 'closure-uninitialized-decl';
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
// Parameter default values (params live on the closure itself, but the
|
|
291
|
+
// gate is also called on nested constructs defensively; closures with
|
|
292
|
+
// their own params are the only legal owner and have no defaults in v1).
|
|
293
|
+
if (ts.isParameter(node) && node.initializer) {
|
|
294
|
+
reason = 'closure-param-default';
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
// ASSIGNMENT EXPRESSIONS — mutation v1 lowers them structurally (the
|
|
298
|
+
// Python lowerer emits assignment STATEMENTS from this AST; the TS target
|
|
299
|
+
// re-emits the raw block verbatim). The gate validates only the TARGET
|
|
300
|
+
// SHAPE and the OPERATOR:
|
|
301
|
+
// - bare identifier (local or free): accepted (the emitter decides
|
|
302
|
+
// pinned-vs-`nonlocal`-vs-local). `acc.push(x)` is a CALL on a captured
|
|
303
|
+
// object — also accepted, the original v1 mutation story.
|
|
304
|
+
// - member/index target on a non-`this` base (`acc.x = 1`, `acc[i] = v`):
|
|
305
|
+
// accepted — by-reference mutation, no `nonlocal`.
|
|
306
|
+
// - `this`-rooted target (`this.x = …`): 'closure-this'.
|
|
307
|
+
// - destructuring (`({a} = obj)`) / parenthesized (`(x) = 1`) target:
|
|
308
|
+
// 'closure-unsupported-assign-target' (could smuggle a free write past
|
|
309
|
+
// the bare-identifier check — fail closed).
|
|
310
|
+
// - assignment operator outside {=,+=,-=,*=,/=,%=}: 'closure-unsupported-
|
|
311
|
+
// operator'.
|
|
312
|
+
if (ts.isBinaryExpression(node)) {
|
|
313
|
+
const op = node.operatorToken.kind;
|
|
314
|
+
if (op >= ts.SyntaxKind.FirstAssignment && op <= ts.SyntaxKind.LastAssignment) {
|
|
315
|
+
// STATEMENT position only — mirror the ++/-- guard (agon review,
|
|
316
|
+
// claude 0.85): a value-position assignment (`arr.push(x = 5)`,
|
|
317
|
+
// `const y = (x = 5)`, `return (x = 5)`, chained `x = (y = 2)`)
|
|
318
|
+
// passes shape checks but the lowerer can only emit an assignment
|
|
319
|
+
// that is the direct expression of an ExpressionStatement — anything
|
|
320
|
+
// else routes through the expression callback, which has no
|
|
321
|
+
// assignment grammar. Reject here so eligible ≡ lowerable holds.
|
|
322
|
+
// Paren-wrapped statement assignments (`({ a } = x);` — JS REQUIRES
|
|
323
|
+
// the parens there) count as statement position: walk up through
|
|
324
|
+
// parens so the precise TARGET reason (e.g. destructuring) survives.
|
|
325
|
+
let posParent = node.parent;
|
|
326
|
+
while (posParent && ts.isParenthesizedExpression(posParent))
|
|
327
|
+
posParent = posParent.parent;
|
|
328
|
+
if (!posParent || !ts.isExpressionStatement(posParent)) {
|
|
329
|
+
reason = 'closure-assign-value-position';
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
if (!CLOSURE_ASSIGN_OPERATORS.has(op)) {
|
|
333
|
+
reason = 'closure-unsupported-operator';
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const targetReason = classifyAssignTarget(node.left);
|
|
337
|
+
if (targetReason !== null) {
|
|
338
|
+
reason = targetReason;
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
// Accepted assignment — keep walking its subexpressions (the RHS may
|
|
342
|
+
// contain an unsupported construct, e.g. a nested arrow or `this`).
|
|
343
|
+
ts.forEachChild(node, visit);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
if (ts.isPostfixUnaryExpression(node) || ts.isPrefixUnaryExpression(node)) {
|
|
348
|
+
const op = node.operator;
|
|
349
|
+
if (op === ts.SyntaxKind.PlusPlusToken || op === ts.SyntaxKind.MinusMinusToken) {
|
|
350
|
+
// `++`/`--` is only a statement-position mutation when its IMMEDIATE
|
|
351
|
+
// parent is an ExpressionStatement (`x++;`). In any other position
|
|
352
|
+
// (`arr.push(x++)`, `f(--x)`, `a = x++`) it is a value-producing
|
|
353
|
+
// sub-expression v1 does not lower — reject with the actionable reason.
|
|
354
|
+
if (!node.parent || !ts.isExpressionStatement(node.parent)) {
|
|
355
|
+
reason = 'closure-incdec-value-position';
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const targetReason = classifyAssignTarget(node.operand);
|
|
359
|
+
if (targetReason !== null) {
|
|
360
|
+
reason = targetReason;
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
ts.forEachChild(node, visit);
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
ts.forEachChild(node, visit);
|
|
368
|
+
};
|
|
369
|
+
ts.forEachChild(block, visit);
|
|
370
|
+
return reason;
|
|
371
|
+
}
|
|
372
|
+
/** True when `stmt` is one of the v1-accepted statement shapes (let/const with
|
|
373
|
+
* identifier names + initializers, return, expression statement, if/else).
|
|
374
|
+
* Branch bodies may be blocks or single statements; this recurses into them. */
|
|
375
|
+
function isAcceptedStatementShape(stmt) {
|
|
376
|
+
if (ts.isVariableStatement(stmt)) {
|
|
377
|
+
const flags = stmt.declarationList.flags;
|
|
378
|
+
if ((flags & ts.NodeFlags.Let) === 0 && (flags & ts.NodeFlags.Const) === 0)
|
|
379
|
+
return false;
|
|
380
|
+
for (const decl of stmt.declarationList.declarations) {
|
|
381
|
+
if (!ts.isIdentifier(decl.name) || !decl.initializer)
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
if (ts.isReturnStatement(stmt))
|
|
387
|
+
return true;
|
|
388
|
+
if (ts.isExpressionStatement(stmt))
|
|
389
|
+
return true;
|
|
390
|
+
if (ts.isIfStatement(stmt)) {
|
|
391
|
+
if (!isAcceptedBranch(stmt.thenStatement))
|
|
392
|
+
return false;
|
|
393
|
+
if (stmt.elseStatement && !isAcceptedBranch(stmt.elseStatement))
|
|
394
|
+
return false;
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
function isAcceptedBranch(node) {
|
|
400
|
+
if (ts.isBlock(node))
|
|
401
|
+
return node.statements.every(isAcceptedStatementShape);
|
|
402
|
+
return isAcceptedStatementShape(node);
|
|
403
|
+
}
|
|
404
|
+
/** Classify a closure block body. Returns `null` if the body is supported by
|
|
405
|
+
* the v1 gate, or a distinct reject-reason string otherwise.
|
|
406
|
+
*
|
|
407
|
+
* ACCEPT set: `let`/`const` (identifier names + initializers, no
|
|
408
|
+
* destructuring), `return` (with or without expression), expression
|
|
409
|
+
* statements, `if`/`else` (block or single-statement branches, nesting fine).
|
|
410
|
+
* Statement-position MUTATIONS are now accepted: assignments to a bare
|
|
411
|
+
* identifier (local OR free) and to a non-`this` member/index target, with the
|
|
412
|
+
* operators {=,+=,-=,*=,/=,%=}, plus statement-position `++`/`--`.
|
|
413
|
+
*
|
|
414
|
+
* REJECT (whole-block walk): `this` (incl. a `this`-rooted assign target →
|
|
415
|
+
* `closure-this`), nested arrow/function/class, `yield`, `await`, any loop,
|
|
416
|
+
* `throw`, `try`, `switch`, `break`/`continue`, `var`, parameter default
|
|
417
|
+
* values, spread, labeled statements, `with`; a destructuring/parenthesized
|
|
418
|
+
* assign target (`closure-unsupported-assign-target`); an assignment operator
|
|
419
|
+
* outside the accepted set (`closure-unsupported-operator`); and a
|
|
420
|
+
* value-position `++`/`--` (`closure-incdec-value-position`). Member/index
|
|
421
|
+
* mutation and method calls on a captured object (`acc.push(x)`) are allowed.
|
|
422
|
+
* Any statement outside the accept set rejects. NOTE: a free write to a
|
|
423
|
+
* PINNED per-iteration loop capture passes the gate but is rejected LOUDLY at
|
|
424
|
+
* Python emission (`closure-pinned-write`) — the single-statement gate cannot
|
|
425
|
+
* see the enclosing loop header (eligibility≢lowerability, by design). */
|
|
426
|
+
export function classifyClosureBlock(raw) {
|
|
427
|
+
const block = parseClosureBlockAst(raw);
|
|
428
|
+
if (block === null)
|
|
429
|
+
return 'closure-parse-error';
|
|
430
|
+
// Whole-block walk for unsupported constructs (this/await/loops/…).
|
|
431
|
+
const constructReason = findUnsupportedConstruct(block);
|
|
432
|
+
if (constructReason !== null)
|
|
433
|
+
return constructReason;
|
|
434
|
+
// Statement-level shape: every top-level (and nested if/else branch)
|
|
435
|
+
// statement must be in the accept set.
|
|
436
|
+
for (const stmt of block.statements) {
|
|
437
|
+
if (!isAcceptedStatementShape(stmt)) {
|
|
438
|
+
return `closure-unsupported-stmt-${ts.SyntaxKind[stmt.kind]}`;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=closure-eligibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closure-eligibility.js","sourceRoot":"","sources":["../src/closure-eligibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CA2C2C;AAE3C,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;8DAC8D;AAC9D,MAAM,UAAU,GAAG,IAAI,GAAG,EAA2B,CAAC;AAEtD;;;;;2DAK2D;AAC3D,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3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