@geastack/compiler 1.0.32 → 1.0.34
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/README.md +1 -1
- package/dist/cli-coverage.js +2 -4
- package/dist/cli-emit.js +1 -1
- package/dist/cli-module-graph.js +1 -1
- package/dist/cli.js +2 -1
- package/dist/compiler.js +35 -28
- package/dist/conversion/array-view.js +9 -0
- package/dist/conversion/build.js +15 -8
- package/dist/conversion/dictionary-view.js +2 -2
- package/dist/conversion/nodes.d.ts +7 -0
- package/dist/conversion/nodes.js +58 -11
- package/dist/identity/ids.d.ts +4 -0
- package/dist/identity/ids.js +4 -0
- package/dist/ir/build.d.ts +4 -3
- package/dist/ir/build.js +14 -5
- package/dist/ir/call-dispatch.js +67 -7
- package/dist/ir/call-entry.js +1 -1
- package/dist/ir/callable-class-flow.d.ts +4 -0
- package/dist/ir/callable-class-flow.js +123 -1
- package/dist/ir/certify/parallel-region.js +698 -20
- package/dist/ir/certify.d.ts +3 -0
- package/dist/ir/certify.js +44 -9
- package/dist/ir/class-allocation-domain.js +2 -2
- package/dist/ir/class-construction-status.d.ts +10 -0
- package/dist/ir/class-construction-status.js +36 -0
- package/dist/ir/convert-carriers.d.ts +10 -1
- package/dist/ir/convert-carriers.js +18 -1
- package/dist/ir/dynamic-constructor-conversions.js +4 -2
- package/dist/ir/finite-iterator-close.d.ts +14 -0
- package/dist/ir/finite-iterator-close.js +50 -0
- package/dist/ir/host-template-conversions.js +9 -0
- package/dist/ir/lower-allocation.js +1 -1
- package/dist/ir/lower-flow.js +24 -3
- package/dist/ir/lower-operands.js +88 -7
- package/dist/ir/lower-protocol.js +1 -1
- package/dist/ir/lower.js +22 -6
- package/dist/ir/model.d.ts +41 -1
- package/dist/ir/native-accessor-definition.d.ts +3 -2
- package/dist/ir/native-accessor-definition.js +29 -10
- package/dist/ir/native-array-transport.js +2 -2
- package/dist/ir/native-field-view-domains.d.ts +23 -0
- package/dist/ir/native-field-view-domains.js +115 -9
- package/dist/ir/native-field-view-facts.d.ts +46 -2
- package/dist/ir/native-field-view-facts.js +159 -4
- package/dist/ir/native-iterable.d.ts +17 -0
- package/dist/ir/native-iterable.js +72 -0
- package/dist/ir/native-key-query.js +1 -1
- package/dist/ir/operation-conversions.js +15 -3
- package/dist/ir/program-conversions.js +2 -2
- package/dist/ir/publish-native-field-view-facts.js +9 -4
- package/dist/ir/pure-conversion-reuse.d.ts +58 -0
- package/dist/ir/pure-conversion-reuse.js +263 -0
- package/dist/ir/queries.js +1 -0
- package/dist/ir/reflection-demand.js +70 -18
- package/dist/ir/shake.js +2 -2
- package/dist/ir/unobserved-callable-inputs.d.ts +37 -0
- package/dist/ir/unobserved-callable-inputs.js +111 -0
- package/dist/native-signatures.d.ts +1 -1
- package/dist/native-signatures.js +27 -2
- package/dist/plugins/gea/component-classes.d.ts +2 -1
- package/dist/plugins/gea/component-classes.js +3 -3
- package/dist/plugins/gea/contract.d.ts +26 -3
- package/dist/plugins/gea/contract.js +42 -43
- package/dist/plugins/gea/host.d.ts +9 -0
- package/dist/plugins/gea/host.js +25 -4
- package/dist/plugins/gea/plugin.js +12 -6
- package/dist/plugins/gea/producer.d.ts +2 -2
- package/dist/plugins/gea/producer.js +2 -2
- package/dist/plugins/load.js +18 -1
- package/dist/plugins/model.d.ts +5 -0
- package/dist/plugins/native-iterable-providers.d.ts +18 -0
- package/dist/plugins/native-iterable-providers.js +51 -0
- package/dist/project-preparation.d.ts +8 -0
- package/dist/project-preparation.js +49 -7
- package/dist/projection/bindings.d.ts +13 -0
- package/dist/projection/bindings.js +20 -1
- package/dist/projection/classes.d.ts +4 -2
- package/dist/projection/classes.js +12 -5
- package/dist/representation/collections.js +2 -0
- package/dist/representation/derive.js +1 -0
- package/dist/representation/model.d.ts +2 -0
- package/dist/representation/model.js +1 -0
- package/dist/representation/policies.d.ts +2 -0
- package/dist/representation/primitive-domain.d.ts +1 -1
- package/dist/representation/primitive-domain.js +1 -1
- package/dist/representation/unassigned-binding-cells.d.ts +4 -3
- package/dist/representation/unassigned-binding-cells.js +19 -2
- package/dist/representation/union.js +6 -6
- package/dist/semantics/frontend.d.ts +2 -0
- package/dist/semantics/frontend.js +34 -5
- package/dist/semantics/host-methods.js +4 -1
- package/dist/semantics/jsx-runtime-provider.d.ts +5 -0
- package/dist/semantics/jsx-runtime-provider.js +16 -0
- package/dist/semantics/model/native-iterable.d.ts +14 -0
- package/dist/semantics/model/native-iterable.js +7 -0
- package/dist/semantics/model/operands.d.ts +30 -0
- package/dist/semantics/model/operations.d.ts +15 -0
- package/dist/semantics/model/primitive-domain.d.ts +15 -0
- package/dist/semantics/model/primitive-domain.js +27 -4
- package/dist/semantics/module-resolution.js +13 -2
- package/dist/semantics/normalize/any-cast-member-call.d.ts +1 -1
- package/dist/semantics/normalize/callback-parameter-contracts.d.ts +32 -4
- package/dist/semantics/normalize/callback-parameter-contracts.js +66 -6
- package/dist/semantics/normalize/census.d.ts +3 -0
- package/dist/semantics/normalize/census.js +17 -12
- package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +4 -1
- package/dist/semantics/normalize/deferred-intrinsic-protocols.js +29 -9
- package/dist/semantics/normalize/flow/callable-reach.js +94 -3
- package/dist/semantics/normalize/flow/component-solver.js +144 -55
- package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +9 -0
- package/dist/semantics/normalize/flow/member-call-forwarding.js +30 -4
- package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +2 -0
- package/dist/semantics/normalize/flow/proof-hypotheses.js +27 -0
- package/dist/semantics/normalize/flow/source-callable-own-data.js +87 -14
- package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +2 -0
- package/dist/semantics/normalize/flow/source-commonjs-exports.js +2 -0
- package/dist/semantics/normalize/flow/source-native-iterable-integrity.d.ts +17 -0
- package/dist/semantics/normalize/flow/source-native-iterable-integrity.js +125 -0
- package/dist/semantics/normalize/flow/source-native-origin.d.ts +6 -0
- package/dist/semantics/normalize/flow/source-native-origin.js +38 -0
- package/dist/semantics/normalize/flow/source-proxy-operation.d.ts +37 -0
- package/dist/semantics/normalize/flow/source-proxy-operation.js +201 -0
- package/dist/semantics/normalize/flow/source-raw-constructor-entry.d.ts +20 -0
- package/dist/semantics/normalize/flow/source-raw-constructor-entry.js +73 -0
- package/dist/semantics/normalize/flow/source-value-session.d.ts +50 -1
- package/dist/semantics/normalize/flow/source-value-session.js +596 -57
- package/dist/semantics/normalize/flow/value-flow.d.ts +17 -0
- package/dist/semantics/normalize/flow/value-flow.js +84 -0
- package/dist/semantics/normalize/fresh-dictionary-storage.js +2 -2
- package/dist/semantics/normalize/fresh-table-last-use.d.ts +52 -0
- package/dist/semantics/normalize/fresh-table-last-use.js +129 -0
- package/dist/semantics/normalize/gating.js +5 -1
- package/dist/semantics/normalize/global-host-mutations.js +190 -13
- package/dist/semantics/normalize/identities.js +20 -1
- package/dist/semantics/normalize/local-bindings.js +2 -2
- package/dist/semantics/normalize/parameter-bindings.js +10 -1
- package/dist/semantics/normalize/producer-context.d.ts +5 -0
- package/dist/semantics/normalize/producers/binding-kind.js +2 -0
- package/dist/semantics/normalize/producers/cited-value-type.d.ts +2 -2
- package/dist/semantics/normalize/producers/cited-value-type.js +2 -2
- package/dist/semantics/normalize/producers/class-lifecycle.js +39 -9
- package/dist/semantics/normalize/producers/computations.js +36 -5
- package/dist/semantics/normalize/producers/conditional-guard.d.ts +6 -0
- package/dist/semantics/normalize/producers/conditional-guard.js +5 -0
- package/dist/semantics/normalize/producers/control.js +7 -1
- package/dist/semantics/normalize/producers/destructuring.js +8 -9
- package/dist/semantics/normalize/producers/invocations.js +55 -2
- package/dist/semantics/normalize/producers/properties.d.ts +13 -0
- package/dist/semantics/normalize/producers/properties.js +21 -3
- package/dist/semantics/normalize/producers/references.js +8 -4
- package/dist/semantics/normalize/reachability.d.ts +15 -3
- package/dist/semantics/normalize/reachability.js +128 -20
- package/dist/semantics/normalize/return-bindings.js +3 -3
- package/dist/semantics/normalize/source-native-iterable.d.ts +19 -0
- package/dist/semantics/normalize/source-native-iterable.js +74 -0
- package/dist/semantics/normalize/structural-any-binding-consumer.d.ts +1 -1
- package/dist/semantics/normalize/structural-declarations.js +1 -1
- package/dist/semantics/normalize/structural-indexed-access.js +9 -0
- package/dist/semantics/normalize/structural.js +11 -0
- package/dist/semantics/normalize/unshared-array-result.d.ts +42 -0
- package/dist/semantics/normalize/unshared-array-result.js +269 -0
- package/dist/semantics/package-sources.js +3 -2
- package/dist/semantics/program.d.ts +8 -0
- package/dist/semantics/program.js +55 -0
- package/dist/semantics/source-transform-exports.d.ts +8 -0
- package/dist/semantics/source-transform-exports.js +145 -0
- package/dist/semantics/source-transform-protocol.d.ts +22 -0
- package/dist/semantics/this-constructor-source-transform.js +19 -1
- package/dist/targets/cpp/class-layout.d.ts +2 -0
- package/dist/targets/cpp/class-layout.js +35 -1
- package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +11 -1
- package/dist/targets/cpp/class-properties/emit-class-properties.js +33 -4
- package/dist/targets/cpp/conversions.js +6 -3
- package/dist/targets/cpp/emit-callable.js +73 -7
- package/dist/targets/cpp/emit-context.d.ts +23 -9
- package/dist/targets/cpp/emit-context.js +19 -8
- package/dist/targets/cpp/emit-equality.js +41 -1
- package/dist/targets/cpp/emit-exceptions.js +29 -11
- package/dist/targets/cpp/emit-iterator-object-view.js +2 -2
- package/dist/targets/cpp/emit-iterator.js +33 -9
- package/dist/targets/cpp/emit-live-field-view.js +6 -1
- package/dist/targets/cpp/emit-narrowing.d.ts +11 -3
- package/dist/targets/cpp/emit-narrowing.js +58 -18
- package/dist/targets/cpp/emit-native-field-view.d.ts +3 -1
- package/dist/targets/cpp/emit-native-field-view.js +84 -8
- package/dist/targets/cpp/emit-properties.d.ts +1 -0
- package/dist/targets/cpp/emit-properties.js +26 -7
- package/dist/targets/cpp/emit-protocol-iterator.js +5 -2
- package/dist/targets/cpp/emit-record-view.js +14 -2
- package/dist/targets/cpp/emit-tostring.js +23 -1
- package/dist/targets/cpp/emit-union-properties.js +1 -1
- package/dist/targets/cpp/emit.d.ts +1 -1
- package/dist/targets/cpp/emit.js +132 -21
- package/dist/targets/cpp/host/emit-host-invoke.js +2 -2
- package/dist/targets/cpp/host/emit-host-object.js +28 -2
- package/dist/targets/cpp/host/emit-host-properties.js +9 -1
- package/dist/targets/cpp/host/emit-host-value.d.ts +1 -1
- package/dist/targets/cpp/host/emit-host-value.js +8 -6
- package/dist/targets/cpp/host/host-members.js +2 -1
- package/dist/targets/cpp/prototype/emit-prototype-array.js +69 -5
- package/dist/targets/cpp/prototype/emit-prototype-invoke.js +9 -9
- package/dist/targets/cpp/prototype/emit-prototype-iterator.js +2 -2
- package/dist/targets/cpp/prototype/emit-prototype-promise.js +7 -7
- package/dist/targets/cpp/records.d.ts +1 -0
- package/dist/targets/cpp/records.js +16 -7
- package/dist/targets/cpp/translation-unit.js +30 -16
- package/package.json +8 -7
- package/src/targets/cpp/runtime/gea_dynamic_proxy.h +42 -3
- package/src/targets/cpp/runtime/gea_eval.h +3 -0
- package/src/targets/cpp/runtime/gea_runtime.h +2407 -684
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { sourceBindingValuesOf } from './value-provenance.js';
|
|
3
|
+
import { sourceValueSessionOf } from './source-value-session.js';
|
|
4
|
+
import { closedValueOriginAuthorityOf } from './callable-reach.js';
|
|
5
|
+
import { closedScriptScopeOf, statedModuleSetOf } from './targets.js';
|
|
6
|
+
import { unwrapErasedExpression } from '../producers/erasure.js';
|
|
7
|
+
/** A closed first domain: unknown receivers and opaque consumers remain
|
|
8
|
+
* possible mutation routes. Narrow annotations cannot erase actual alias
|
|
9
|
+
* inputs; source value transport is consulted before native carrier facts.
|
|
10
|
+
*/
|
|
11
|
+
export const sourceNativeIterableIntegrityOf = (checker, flow, source, provider, nativeCarrierOf, readOnlyCalls) => {
|
|
12
|
+
if (!statedModuleSetOf(flow) && !closedScriptScopeOf(flow))
|
|
13
|
+
return null;
|
|
14
|
+
if (nativeCarrierOf(checker.getTypeAtLocation(unwrapErasedExpression(source)), source) !== provider.receiverNative)
|
|
15
|
+
return null;
|
|
16
|
+
const session = sourceValueSessionOf(checker, flow);
|
|
17
|
+
const pending = new Set();
|
|
18
|
+
const answers = new Map();
|
|
19
|
+
const mayReach = (input) => {
|
|
20
|
+
const node = unwrapErasedExpression(input);
|
|
21
|
+
if (answers.has(node))
|
|
22
|
+
return answers.get(node);
|
|
23
|
+
if (pending.has(node))
|
|
24
|
+
return true;
|
|
25
|
+
pending.add(node);
|
|
26
|
+
let answer = true;
|
|
27
|
+
const through = (values) => values === null || values.some(mayReach);
|
|
28
|
+
try {
|
|
29
|
+
if (ts.isIdentifier(node)) {
|
|
30
|
+
const declaration = flow.targetOf(node)?.declaration;
|
|
31
|
+
if (declaration && ts.isVariableDeclaration(declaration)) {
|
|
32
|
+
answer = through(sourceBindingValuesOf(checker, flow, declaration));
|
|
33
|
+
return answer;
|
|
34
|
+
}
|
|
35
|
+
if (declaration && ts.isParameter(declaration)) {
|
|
36
|
+
answer = through(session.parameterSourceExpressionsOf(declaration));
|
|
37
|
+
return answer;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (ts.isConditionalExpression(node)) {
|
|
41
|
+
answer = mayReach(node.whenTrue) || mayReach(node.whenFalse);
|
|
42
|
+
return answer;
|
|
43
|
+
}
|
|
44
|
+
if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {
|
|
45
|
+
const values = closedValueOriginAuthorityOf(checker, flow, node).fieldValuesOf(node);
|
|
46
|
+
if (values !== null) {
|
|
47
|
+
answer = through(values);
|
|
48
|
+
return answer;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
if (ts.isCallExpression(node) || ts.isNewExpression(node) || ts.isIdentifier(node))
|
|
53
|
+
return true;
|
|
54
|
+
if (ts.isObjectLiteralExpression(node) || ts.isArrayLiteralExpression(node)) {
|
|
55
|
+
answer = false;
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const type = checker.getTypeAtLocation(node);
|
|
59
|
+
if ((type.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.TypeParameter)) !== 0)
|
|
60
|
+
return true;
|
|
61
|
+
if ((type.flags &
|
|
62
|
+
(ts.TypeFlags.StringLike |
|
|
63
|
+
ts.TypeFlags.NumberLike |
|
|
64
|
+
ts.TypeFlags.BooleanLike |
|
|
65
|
+
ts.TypeFlags.BigIntLike |
|
|
66
|
+
ts.TypeFlags.ESSymbolLike |
|
|
67
|
+
ts.TypeFlags.Null |
|
|
68
|
+
ts.TypeFlags.Undefined |
|
|
69
|
+
ts.TypeFlags.Never)) !==
|
|
70
|
+
0) {
|
|
71
|
+
answer = false;
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
// A stated unrelated native type is not an allocation-disjointness
|
|
75
|
+
// witness. An assertion or user getter could have supplied that type.
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// An origin query that cannot close is not evidence of disjointness.
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
pending.delete(node);
|
|
84
|
+
answers.set(node, answer);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
// A property read can invoke an ambient/source accessor without a syntactic
|
|
88
|
+
// call site. Only closed source data origins or the already authenticated
|
|
89
|
+
// consumer member may bypass this first-domain refusal.
|
|
90
|
+
const writeSites = new Set(flow.allWrites.map((write) => write.propertyAccess));
|
|
91
|
+
const consumerMembers = new Set([...readOnlyCalls].map((call) => unwrapErasedExpression(call.expression)));
|
|
92
|
+
for (const access of flow.propertyAccesses) {
|
|
93
|
+
if (ts.findAncestor(access, (node) => ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)))
|
|
94
|
+
continue;
|
|
95
|
+
if (consumerMembers.has(access) || writeSites.has(access))
|
|
96
|
+
continue;
|
|
97
|
+
const values = closedValueOriginAuthorityOf(checker, flow, access).fieldValuesOf(access);
|
|
98
|
+
if (values === null)
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const writes = [];
|
|
102
|
+
for (const write of flow.allWrites) {
|
|
103
|
+
if (!write.propertyAccess)
|
|
104
|
+
continue;
|
|
105
|
+
writes.push(write.site);
|
|
106
|
+
if (mayReach(write.propertyAccess.expression))
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const calls = [];
|
|
110
|
+
for (const site of flow.calls) {
|
|
111
|
+
calls.push(site.call);
|
|
112
|
+
if (readOnlyCalls.has(site.call))
|
|
113
|
+
continue;
|
|
114
|
+
if (ts.isCallExpression(site.call)) {
|
|
115
|
+
const targets = session.invocationTargetsOf(site.call);
|
|
116
|
+
if (targets?.length && targets.every((target) => !target.getSourceFile().isDeclarationFile))
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
// A foreign call can discover a retained collection through a container,
|
|
120
|
+
// closure, global or prototype, even with no direct collection operand.
|
|
121
|
+
// Only an independently authenticated effect contract can admit it.
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return { source, provider, writes, calls };
|
|
125
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ValueFlowIndex } from './model.js';
|
|
3
|
+
/** A native annotation cannot create a host-owned value. Only an exact
|
|
4
|
+
* installed root or closed transport of such roots supplies this provenance.
|
|
5
|
+
*/
|
|
6
|
+
export declare const sourceNativeOriginIsClosed: (checker: ts.TypeChecker, flow: ValueFlowIndex, source: ts.Expression, installedRoot: (node: ts.Expression) => boolean) => boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { sourceBindingValuesOf } from './value-provenance.js';
|
|
3
|
+
import { sourceValueSessionOf } from './source-value-session.js';
|
|
4
|
+
import { unwrapErasedExpression } from '../producers/erasure.js';
|
|
5
|
+
/** A native annotation cannot create a host-owned value. Only an exact
|
|
6
|
+
* installed root or closed transport of such roots supplies this provenance.
|
|
7
|
+
*/
|
|
8
|
+
export const sourceNativeOriginIsClosed = (checker, flow, source, installedRoot) => {
|
|
9
|
+
const session = sourceValueSessionOf(checker, flow);
|
|
10
|
+
const pending = new Set();
|
|
11
|
+
const visit = (input) => {
|
|
12
|
+
const node = unwrapErasedExpression(input);
|
|
13
|
+
if (pending.has(node))
|
|
14
|
+
return false;
|
|
15
|
+
pending.add(node);
|
|
16
|
+
try {
|
|
17
|
+
if (installedRoot(node))
|
|
18
|
+
return true;
|
|
19
|
+
const through = (values) => values !== null && values.length > 0 && values.every(visit);
|
|
20
|
+
if (ts.isIdentifier(node)) {
|
|
21
|
+
const declaration = flow.targetOf(node)?.declaration;
|
|
22
|
+
if (declaration && ts.isVariableDeclaration(declaration))
|
|
23
|
+
return through(sourceBindingValuesOf(checker, flow, declaration));
|
|
24
|
+
if (declaration && ts.isParameter(declaration))
|
|
25
|
+
return through(session.parameterSourceExpressionsOf(declaration));
|
|
26
|
+
}
|
|
27
|
+
if (ts.isConditionalExpression(node))
|
|
28
|
+
return visit(node.whenTrue) && visit(node.whenFalse);
|
|
29
|
+
// Property reads can invoke getters; calls can manufacture annotated
|
|
30
|
+
// values. Neither acquires native provenance from its checker result.
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
pending.delete(node);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return visit(source);
|
|
38
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ValueFlowIndex } from './model.js';
|
|
3
|
+
import { type SourceConstructorProxyResultIdentity } from './source-value-session.js';
|
|
4
|
+
export interface SourceProxyOperationFrame {
|
|
5
|
+
readonly construction: ts.NewExpression;
|
|
6
|
+
readonly trap: string;
|
|
7
|
+
/** The actual target operand, never the returned Proxy identity. */
|
|
8
|
+
readonly target: ts.Expression;
|
|
9
|
+
}
|
|
10
|
+
/** A first trap argument supplied by authenticated native Proxy operations.
|
|
11
|
+
* This is deliberately not a source call/constructor frame. The query closes
|
|
12
|
+
* every use of the particular handler allocation; another possible handler at
|
|
13
|
+
* the same construction does not change this allocation's operation target.
|
|
14
|
+
* It makes no claim about target origin, handler results, or other arguments.
|
|
15
|
+
* @semanticCategory generic-primitive
|
|
16
|
+
*/
|
|
17
|
+
export declare const sourceProxyOperationFramesOf: (checker: ts.TypeChecker, flow: ValueFlowIndex, parameter: ts.ParameterDeclaration) => readonly SourceProxyOperationFrame[] | null;
|
|
18
|
+
/** One native [[Get]] entry. The receiver is the returned Proxy, while the
|
|
19
|
+
* target is the distinct construction operand recorded by its result frame.
|
|
20
|
+
* This names the real trap and operation roles; it does NOT answer the trap's
|
|
21
|
+
* completion, a target descriptor, or an eventual callable's logical this.
|
|
22
|
+
* @semanticCategory generic-primitive
|
|
23
|
+
*/
|
|
24
|
+
export interface SourceProxyGetOperation {
|
|
25
|
+
readonly operation: ts.PropertyAccessExpression | ts.ElementAccessExpression;
|
|
26
|
+
readonly context: SourceConstructorProxyResultIdentity;
|
|
27
|
+
readonly body: ts.MethodDeclaration | ts.FunctionExpression | ts.ArrowFunction;
|
|
28
|
+
readonly key: string;
|
|
29
|
+
readonly receiver: ts.NewExpression;
|
|
30
|
+
}
|
|
31
|
+
/** Direct-new property reads are the first exact operation-entry domain.
|
|
32
|
+
* Aliased results, symbols, optional access and absent/inherited traps need
|
|
33
|
+
* their own source transport/descriptor proof and refuse here. No declared
|
|
34
|
+
* class member is substituted for a Proxy trap's answer.
|
|
35
|
+
* @semanticCategory generic-primitive
|
|
36
|
+
*/
|
|
37
|
+
export declare const sourceProxyGetOperationsOf: (checker: ts.TypeChecker, flow: ValueFlowIndex, operation: ts.PropertyAccessExpression | ts.ElementAccessExpression) => readonly SourceProxyGetOperation[] | null;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { sourceBindingWritesAreComplete } from './value-provenance.js';
|
|
3
|
+
import { inProgramImportReferencesOf } from './export-importers.js';
|
|
4
|
+
import { isModuleExportedDeclaration, isTypePositionReference, runtimeParametersOf } from './targets.js';
|
|
5
|
+
import { outermostErasureOf, unwrapErasedExpression } from '../producers/erasure.js';
|
|
6
|
+
import { literalSourcePropertyKeyOf } from './source-property-key.js';
|
|
7
|
+
import { deferredIntrinsicProtocolLedgerOf } from '../deferred-intrinsic-protocols.js';
|
|
8
|
+
import { sourceValueSessionOf } from './source-value-session.js';
|
|
9
|
+
const propertyKey = (name) => ts.isIdentifier(name) || ts.isStringLiteralLike(name) || ts.isNumericLiteral(name)
|
|
10
|
+
? name.text
|
|
11
|
+
: ts.isComputedPropertyName(name)
|
|
12
|
+
? literalSourcePropertyKeyOf(name.expression)
|
|
13
|
+
: null;
|
|
14
|
+
const trapNames = new Set([
|
|
15
|
+
'get',
|
|
16
|
+
'set',
|
|
17
|
+
'has',
|
|
18
|
+
'deleteProperty',
|
|
19
|
+
'defineProperty',
|
|
20
|
+
'getOwnPropertyDescriptor',
|
|
21
|
+
'getPrototypeOf',
|
|
22
|
+
'setPrototypeOf',
|
|
23
|
+
'isExtensible',
|
|
24
|
+
'preventExtensions',
|
|
25
|
+
'ownKeys',
|
|
26
|
+
'apply',
|
|
27
|
+
'construct'
|
|
28
|
+
]);
|
|
29
|
+
/** A first trap argument supplied by authenticated native Proxy operations.
|
|
30
|
+
* This is deliberately not a source call/constructor frame. The query closes
|
|
31
|
+
* every use of the particular handler allocation; another possible handler at
|
|
32
|
+
* the same construction does not change this allocation's operation target.
|
|
33
|
+
* It makes no claim about target origin, handler results, or other arguments.
|
|
34
|
+
* @semanticCategory generic-primitive
|
|
35
|
+
*/
|
|
36
|
+
export const sourceProxyOperationFramesOf = (checker, flow, parameter) => {
|
|
37
|
+
const body = parameter.parent;
|
|
38
|
+
if (runtimeParametersOf(body)[0] !== parameter || parameter.initializer || parameter.dotDotDotToken)
|
|
39
|
+
return null;
|
|
40
|
+
if (flow.writesToDeclaration(parameter).some((write) => write.slot === 'whole' && write.edge !== 'call-argument'))
|
|
41
|
+
return null;
|
|
42
|
+
const property = ts.isMethodDeclaration(body)
|
|
43
|
+
? body
|
|
44
|
+
: (ts.isArrowFunction(body) || ts.isFunctionExpression(body)) &&
|
|
45
|
+
ts.isPropertyAssignment(body.parent) &&
|
|
46
|
+
body.parent.initializer === body
|
|
47
|
+
? body.parent
|
|
48
|
+
: null;
|
|
49
|
+
if (!property || !ts.isObjectLiteralExpression(property.parent))
|
|
50
|
+
return null;
|
|
51
|
+
const handler = property.parent;
|
|
52
|
+
const trap = propertyKey(property.name);
|
|
53
|
+
if (trap === null || !trapNames.has(trap))
|
|
54
|
+
return null;
|
|
55
|
+
// Accessors, spreads, duplicate traps and detached callable values need
|
|
56
|
+
// their own effect/invocation proof, not a spelling-based exemption.
|
|
57
|
+
const names = new Set();
|
|
58
|
+
for (const member of handler.properties) {
|
|
59
|
+
if (!ts.isMethodDeclaration(member) && !ts.isPropertyAssignment(member))
|
|
60
|
+
return null;
|
|
61
|
+
const name = propertyKey(member.name);
|
|
62
|
+
if (name === null || !trapNames.has(name) || names.has(name))
|
|
63
|
+
return null;
|
|
64
|
+
names.add(name);
|
|
65
|
+
const callable = ts.isMethodDeclaration(member) ? member : unwrapErasedExpression(member.initializer);
|
|
66
|
+
if (!ts.isMethodDeclaration(callable) && !ts.isArrowFunction(callable) && !ts.isFunctionExpression(callable))
|
|
67
|
+
return null;
|
|
68
|
+
if (ts.isFunctionExpression(callable) && callable.name)
|
|
69
|
+
return null;
|
|
70
|
+
let hiddenReceiverUse = false;
|
|
71
|
+
const inspect = (node) => {
|
|
72
|
+
// A native trap receiver is the handler. Calling another trap through
|
|
73
|
+
// `this` or arguments.callee would add a non-native argument route.
|
|
74
|
+
if (node.kind === ts.SyntaxKind.ThisKeyword ||
|
|
75
|
+
node.kind === ts.SyntaxKind.SuperKeyword ||
|
|
76
|
+
(ts.isIdentifier(node) && (node.text === 'arguments' || node.text === 'eval')))
|
|
77
|
+
hiddenReceiverUse = true;
|
|
78
|
+
ts.forEachChild(node, inspect);
|
|
79
|
+
};
|
|
80
|
+
inspect(callable);
|
|
81
|
+
if (hiddenReceiverUse)
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
const pending = [handler];
|
|
85
|
+
const visited = new Set();
|
|
86
|
+
const frames = new Map();
|
|
87
|
+
const binding = (declaration) => {
|
|
88
|
+
if (visited.has(declaration))
|
|
89
|
+
return true;
|
|
90
|
+
visited.add(declaration);
|
|
91
|
+
if (!ts.isIdentifier(declaration.name) || !sourceBindingWritesAreComplete(checker, flow, declaration))
|
|
92
|
+
return false;
|
|
93
|
+
const imported = isModuleExportedDeclaration(checker, declaration, null) ? inProgramImportReferencesOf(checker, flow, declaration) : [];
|
|
94
|
+
if (imported === null)
|
|
95
|
+
return false;
|
|
96
|
+
for (const reference of [...flow.referencesToDeclaration(declaration), ...imported]) {
|
|
97
|
+
if (reference === declaration.name || isTypePositionReference(reference))
|
|
98
|
+
continue;
|
|
99
|
+
if (!ts.isExpression(reference))
|
|
100
|
+
return false;
|
|
101
|
+
pending.push(reference);
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
};
|
|
105
|
+
while (pending.length > 0) {
|
|
106
|
+
const expression = pending.pop();
|
|
107
|
+
const reference = outermostErasureOf(expression);
|
|
108
|
+
if (visited.has(reference))
|
|
109
|
+
continue;
|
|
110
|
+
visited.add(reference);
|
|
111
|
+
const parent = reference.parent;
|
|
112
|
+
if (!parent)
|
|
113
|
+
return null;
|
|
114
|
+
if (ts.isVariableDeclaration(parent) && parent.initializer === reference) {
|
|
115
|
+
if (!binding(parent))
|
|
116
|
+
return null;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (ts.isConditionalExpression(parent) && (parent.whenTrue === reference || parent.whenFalse === reference)) {
|
|
120
|
+
pending.push(parent);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (ts.isReturnStatement(parent) && parent.expression === reference) {
|
|
124
|
+
let owner = parent.parent;
|
|
125
|
+
while (owner && !ts.isFunctionLike(owner))
|
|
126
|
+
owner = owner.parent;
|
|
127
|
+
if (!owner || !ts.isFunctionLike(owner))
|
|
128
|
+
return null;
|
|
129
|
+
// An unentered source getter/export cannot hand this handler outside
|
|
130
|
+
// the stated program. Entered factories need full return-use transport.
|
|
131
|
+
const callers = sourceValueSessionOf(checker, flow).callerSitesOf(owner);
|
|
132
|
+
if (callers === null || callers.length !== 0)
|
|
133
|
+
return null;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (ts.isNewExpression(parent) && parent.arguments?.length === 2 && parent.arguments[1] === reference) {
|
|
137
|
+
const [target] = parent.arguments;
|
|
138
|
+
if (!target || ts.isSpreadElement(target))
|
|
139
|
+
return null;
|
|
140
|
+
const callee = unwrapErasedExpression(parent.expression);
|
|
141
|
+
const symbol = checker.getSymbolAtLocation(callee);
|
|
142
|
+
const declaration = checker.getResolvedSignature(parent)?.getDeclaration();
|
|
143
|
+
const owner = declaration?.parent;
|
|
144
|
+
if (!ts.isIdentifier(callee) ||
|
|
145
|
+
callee.text !== 'Proxy' ||
|
|
146
|
+
!symbol?.valueDeclaration?.getSourceFile().hasNoDefaultLib ||
|
|
147
|
+
!owner ||
|
|
148
|
+
!ts.isInterfaceDeclaration(owner) ||
|
|
149
|
+
owner.name.text !== 'ProxyConstructor' ||
|
|
150
|
+
!owner.getSourceFile().hasNoDefaultLib ||
|
|
151
|
+
deferredIntrinsicProtocolLedgerOf(flow)?.requireStandardGlobalBinding('Proxy', parent) !== true)
|
|
152
|
+
return null;
|
|
153
|
+
frames.set(parent, { construction: parent, trap, target });
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
// Property reads can expose the trap as an ordinary callable; writes can
|
|
157
|
+
// replace it. Unknown calls/exports and all other consumers remain open.
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
return [...frames.values()];
|
|
161
|
+
};
|
|
162
|
+
/** Direct-new property reads are the first exact operation-entry domain.
|
|
163
|
+
* Aliased results, symbols, optional access and absent/inherited traps need
|
|
164
|
+
* their own source transport/descriptor proof and refuse here. No declared
|
|
165
|
+
* class member is substituted for a Proxy trap's answer.
|
|
166
|
+
* @semanticCategory generic-primitive
|
|
167
|
+
*/
|
|
168
|
+
export const sourceProxyGetOperationsOf = (checker, flow, operation) => {
|
|
169
|
+
if (operation.questionDotToken)
|
|
170
|
+
return null;
|
|
171
|
+
const construction = unwrapErasedExpression(operation.expression);
|
|
172
|
+
const key = ts.isPropertyAccessExpression(operation) ? operation.name.text : literalSourcePropertyKeyOf(operation.argumentExpression);
|
|
173
|
+
if (!ts.isNewExpression(construction) || key === null)
|
|
174
|
+
return null;
|
|
175
|
+
const contexts = sourceValueSessionOf(checker, flow).constructorProxyResultIdentitiesOf(construction);
|
|
176
|
+
if (!contexts?.length)
|
|
177
|
+
return null;
|
|
178
|
+
const answer = [];
|
|
179
|
+
for (const context of contexts) {
|
|
180
|
+
for (const handler of context.handlers) {
|
|
181
|
+
if (!ts.isObjectLiteralExpression(handler))
|
|
182
|
+
return null;
|
|
183
|
+
const member = handler.properties.find((candidate) => (ts.isMethodDeclaration(candidate) || ts.isPropertyAssignment(candidate)) && propertyKey(candidate.name) === 'get');
|
|
184
|
+
const body = member && ts.isMethodDeclaration(member)
|
|
185
|
+
? member
|
|
186
|
+
: member && ts.isPropertyAssignment(member)
|
|
187
|
+
? unwrapErasedExpression(member.initializer)
|
|
188
|
+
: null;
|
|
189
|
+
if (!body || (!ts.isMethodDeclaration(body) && !ts.isArrowFunction(body) && !ts.isFunctionExpression(body)))
|
|
190
|
+
return null;
|
|
191
|
+
const first = runtimeParametersOf(body)[0];
|
|
192
|
+
if (!first)
|
|
193
|
+
return null;
|
|
194
|
+
const entries = sourceProxyOperationFramesOf(checker, flow, first);
|
|
195
|
+
if (!entries?.some((entry) => entry.trap === 'get' && entry.construction === context.result))
|
|
196
|
+
return null;
|
|
197
|
+
answer.push({ operation, context, body, key, receiver: context.result });
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return answer.length ? answer : null;
|
|
201
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ValueFlowIndex } from './model.js';
|
|
3
|
+
export interface SourceRawConstructorAllocation {
|
|
4
|
+
readonly kind: 'base-constructor-initial-allocation';
|
|
5
|
+
readonly receiver: ts.ThisExpression;
|
|
6
|
+
readonly constructor: ts.ConstructorDeclaration;
|
|
7
|
+
readonly entries: readonly {
|
|
8
|
+
readonly construction: ts.NewExpression;
|
|
9
|
+
readonly newTarget: ts.ClassDeclaration | ts.ClassExpression;
|
|
10
|
+
/** Initial class prototype identities, not a post-mutation chain proof. */
|
|
11
|
+
readonly initialPrototypeOwners: readonly (ts.ClassDeclaration | ts.ClassExpression)[];
|
|
12
|
+
}[];
|
|
13
|
+
}
|
|
14
|
+
/** The initial receiver allocated for a source BASE class constructor.
|
|
15
|
+
* Derived `this` after super can already be a returned Proxy and is refused.
|
|
16
|
+
* The construction result is not returned here or equated with this receiver.
|
|
17
|
+
* Consumers still owe effects/prototype integrity at their operation position.
|
|
18
|
+
* @semanticCategory generic-primitive
|
|
19
|
+
*/
|
|
20
|
+
export declare const sourceRawConstructorAllocationOf: (checker: ts.TypeChecker, flow: ValueFlowIndex, receiver: ts.ThisExpression) => SourceRawConstructorAllocation | null;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { classConstructorBindingUsesAreClosed, sourceConstructorSelectionsOf } from './member-call-forwarding.js';
|
|
3
|
+
import { sourceClassFamilyOf } from './owned-class-receivers.js';
|
|
4
|
+
import { sourceValueSessionOf } from './source-value-session.js';
|
|
5
|
+
/** The initial receiver allocated for a source BASE class constructor.
|
|
6
|
+
* Derived `this` after super can already be a returned Proxy and is refused.
|
|
7
|
+
* The construction result is not returned here or equated with this receiver.
|
|
8
|
+
* Consumers still owe effects/prototype integrity at their operation position.
|
|
9
|
+
* @semanticCategory generic-primitive
|
|
10
|
+
*/
|
|
11
|
+
export const sourceRawConstructorAllocationOf = (checker, flow, receiver) => {
|
|
12
|
+
let frame = receiver.parent;
|
|
13
|
+
while (frame && (!ts.isFunctionLike(frame) || ts.isArrowFunction(frame)))
|
|
14
|
+
frame = frame.parent;
|
|
15
|
+
if (!frame || !ts.isConstructorDeclaration(frame) || !frame.body)
|
|
16
|
+
return null;
|
|
17
|
+
const owner = frame.parent;
|
|
18
|
+
if (owner.heritageClauses?.some((clause) => clause.token === ts.SyntaxKind.ExtendsKeyword))
|
|
19
|
+
return null;
|
|
20
|
+
const family = sourceClassFamilyOf(checker, flow, new Set([owner]));
|
|
21
|
+
if (family === null)
|
|
22
|
+
return null;
|
|
23
|
+
for (const type of family.values())
|
|
24
|
+
if (!classConstructorBindingUsesAreClosed(checker, flow, type))
|
|
25
|
+
return null;
|
|
26
|
+
const entries = [];
|
|
27
|
+
for (const site of flow.calls) {
|
|
28
|
+
if (!ts.isNewExpression(site.call))
|
|
29
|
+
continue;
|
|
30
|
+
const selections = sourceConstructorSelectionsOf(checker, flow, site.call.expression);
|
|
31
|
+
if (selections === null) {
|
|
32
|
+
const symbol = checker.getTypeAtLocation(site.call).getSymbol();
|
|
33
|
+
if (symbol?.declarations?.some((declaration) => family.has(declaration)))
|
|
34
|
+
return null;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
for (const selected of selections) {
|
|
38
|
+
if (!family.has(selected))
|
|
39
|
+
continue;
|
|
40
|
+
// An escaped result can expose its constructor through the default
|
|
41
|
+
// instance/prototype constructor property, with no further spelled
|
|
42
|
+
// class-binding reference. Closing that value is a separate obligation
|
|
43
|
+
// from preserving `new`'s result identity. Unsupported returned Proxy
|
|
44
|
+
// ownership remains refused rather than being replaced by the raw this.
|
|
45
|
+
if (sourceValueSessionOf(checker, flow).closedValuesOf(site.call) === null)
|
|
46
|
+
return null;
|
|
47
|
+
if (!ts.isClassDeclaration(selected) && !ts.isClassExpression(selected))
|
|
48
|
+
return null;
|
|
49
|
+
const chain = [];
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
let current = selected;
|
|
52
|
+
for (;;) {
|
|
53
|
+
if (seen.has(current))
|
|
54
|
+
return null;
|
|
55
|
+
seen.add(current);
|
|
56
|
+
chain.push(current);
|
|
57
|
+
if (current === owner)
|
|
58
|
+
break;
|
|
59
|
+
const bases = current.heritageClauses?.filter((clause) => clause.token === ts.SyntaxKind.ExtendsKeyword) ?? [];
|
|
60
|
+
if (bases.length !== 1 || bases[0]?.types.length !== 1)
|
|
61
|
+
return null;
|
|
62
|
+
const heritage = bases[0].types[0];
|
|
63
|
+
const choices = heritage ? sourceConstructorSelectionsOf(checker, flow, heritage.expression) : null;
|
|
64
|
+
const base = choices?.length === 1 ? choices[0] : null;
|
|
65
|
+
if (!base || (!ts.isClassDeclaration(base) && !ts.isClassExpression(base)))
|
|
66
|
+
return null;
|
|
67
|
+
current = base;
|
|
68
|
+
}
|
|
69
|
+
entries.push({ construction: site.call, newTarget: selected, initialPrototypeOwners: chain });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return entries.length === 0 ? null : { kind: 'base-constructor-initial-allocation', receiver, constructor: frame, entries };
|
|
73
|
+
};
|
|
@@ -8,6 +8,9 @@ type ObjectRoot = ts.CallExpression | ts.NewExpression | ts.ObjectLiteralExpress
|
|
|
8
8
|
type Query = {
|
|
9
9
|
readonly kind: 'value';
|
|
10
10
|
readonly node: ts.Expression;
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'proxy-result' | 'proxy-target' | 'proxy-handler';
|
|
13
|
+
readonly node: ts.NewExpression;
|
|
11
14
|
} | {
|
|
12
15
|
readonly kind: 'parameter';
|
|
13
16
|
readonly node: ts.ParameterDeclaration;
|
|
@@ -27,7 +30,7 @@ type Query = {
|
|
|
27
30
|
readonly kind: 'construct-targets';
|
|
28
31
|
readonly node: ts.CallExpression | ts.NewExpression;
|
|
29
32
|
} | {
|
|
30
|
-
readonly kind: 'frame-receiver' | 'frame-argument' | 'frame-parameter' | 'frame-value' | 'frame-completion';
|
|
33
|
+
readonly kind: 'frame-receiver' | 'frame-argument' | 'frame-parameter' | 'frame-value' | 'frame-completion' | 'constructor-value' | 'constructor-parameter' | 'constructor-completion';
|
|
31
34
|
readonly node: ts.CallExpression | ts.NewExpression;
|
|
32
35
|
readonly body: ts.SignatureDeclaration;
|
|
33
36
|
readonly subject: ts.Expression | ts.ParameterDeclaration | null;
|
|
@@ -53,6 +56,10 @@ type Query = {
|
|
|
53
56
|
} | {
|
|
54
57
|
readonly kind: 'unknown-reads';
|
|
55
58
|
readonly node: ObjectRoot;
|
|
59
|
+
} | {
|
|
60
|
+
readonly kind: 'key-reads';
|
|
61
|
+
readonly node: ObjectRoot;
|
|
62
|
+
readonly key: string;
|
|
56
63
|
} | {
|
|
57
64
|
readonly kind: 'callers';
|
|
58
65
|
readonly node: ts.SignatureDeclaration;
|
|
@@ -61,6 +68,30 @@ interface Cause {
|
|
|
61
68
|
readonly reason: string;
|
|
62
69
|
readonly node: ts.Node;
|
|
63
70
|
}
|
|
71
|
+
/** Operand identities of an authenticated native Proxy allocation. This is
|
|
72
|
+
* not a closure, trap-effect, member-lookup or construction-result proof. */
|
|
73
|
+
export interface SourceProxyResultIdentity {
|
|
74
|
+
readonly result: ts.NewExpression;
|
|
75
|
+
readonly targets: readonly Value[];
|
|
76
|
+
readonly handlers: readonly Value[];
|
|
77
|
+
}
|
|
78
|
+
/** A normal completion from one direct BASE-class construction. ASTs name
|
|
79
|
+
* source allocation-origin families, not equality of repeated executions.
|
|
80
|
+
* No member lookup, effects, prototype integrity or closed consumer proof. */
|
|
81
|
+
export interface SourceConstructorProxyResultIdentity {
|
|
82
|
+
readonly construction: ts.NewExpression;
|
|
83
|
+
readonly constructor: ts.ConstructorDeclaration;
|
|
84
|
+
readonly result: ts.NewExpression;
|
|
85
|
+
readonly targets: readonly ({
|
|
86
|
+
readonly kind: 'base-constructor-allocation';
|
|
87
|
+
readonly construction: ts.NewExpression;
|
|
88
|
+
readonly constructor: ts.ConstructorDeclaration;
|
|
89
|
+
} | {
|
|
90
|
+
readonly kind: 'source-object';
|
|
91
|
+
readonly value: Value;
|
|
92
|
+
})[];
|
|
93
|
+
readonly handlers: readonly Value[];
|
|
94
|
+
}
|
|
64
95
|
/** Source values, their storage, invocations and escape obligations share one
|
|
65
96
|
* graph. No transfer calls a recursive origin/receiver/callable proof. The
|
|
66
97
|
* construction and declared-descriptor queries below are independent leaves.
|
|
@@ -77,6 +108,8 @@ export interface SourceValueSession {
|
|
|
77
108
|
readonly ordinaryOwnCallableOperandsOf: (call: ts.CallExpression) => FlowInvocationOperands | null;
|
|
78
109
|
/** One fully closed installed body, including an immutable detached read. */
|
|
79
110
|
readonly ordinaryOwnCallableSourceOf: (call: ts.CallExpression) => SourceCallableObject | null;
|
|
111
|
+
readonly proxyResultIdentityOf: (expression: ts.NewExpression) => SourceProxyResultIdentity | null;
|
|
112
|
+
readonly constructorProxyResultIdentitiesOf: (construction: ts.NewExpression) => readonly SourceConstructorProxyResultIdentity[] | null;
|
|
80
113
|
readonly valuesOf: (expression: ts.Expression) => readonly Value[] | null;
|
|
81
114
|
/** The same value family after every actual consumer of each root is accounted for. */
|
|
82
115
|
readonly closedValuesOf: (expression: ts.Expression) => readonly Value[] | null;
|
|
@@ -177,4 +210,20 @@ export declare const sourceValueSessionOf: (checker: ts.TypeChecker, flow: Value
|
|
|
177
210
|
* program.
|
|
178
211
|
*/
|
|
179
212
|
export declare const retireSourceValueSession: (flow: ValueFlowIndex) => void;
|
|
213
|
+
/**
|
|
214
|
+
* Hands `next` the live session of `previous`, when `next` has none yet.
|
|
215
|
+
*
|
|
216
|
+
* A session's every answer is a function of the checker and its index alone
|
|
217
|
+
* (`createSession` is handed nothing else, and everything it consults is keyed
|
|
218
|
+
* on that index), so two indices that state the same content
|
|
219
|
+
* (`sameValueFlowContent`) have the same session. The binding fixpoint builds
|
|
220
|
+
* one index per round, and the round that settles it rebuilds exactly the
|
|
221
|
+
* index the round before it built: solving that round's session again from
|
|
222
|
+
* nothing reproduced every answer the previous round's solver already held.
|
|
223
|
+
*
|
|
224
|
+
* The two flows then hold ONE session entry: retiring either retires both, so
|
|
225
|
+
* the caller retires only the flow it keeps. Answers `false` -- and changes
|
|
226
|
+
* nothing -- when `previous` has no live session or `next` already has one.
|
|
227
|
+
*/
|
|
228
|
+
export declare const shareSourceValueSession: (previous: ValueFlowIndex, next: ValueFlowIndex) => boolean;
|
|
180
229
|
export {};
|