@geastack/compiler 1.0.24 → 1.0.26
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/ir/build.d.ts +1 -1
- package/dist/ir/build.js +2 -1
- package/dist/ir/dense-loops.d.ts +11 -2
- package/dist/ir/dense-loops.js +58 -9
- package/dist/ir/integers.js +27 -3
- package/dist/ir/lower-invocation.js +1 -1
- package/dist/ir/model.d.ts +2 -0
- package/dist/ir/numeric-intrinsics.d.ts +1 -1
- package/dist/ir/numeric-intrinsics.js +10 -3
- package/dist/projection/callee.d.ts +7 -0
- package/dist/projection/callee.js +12 -2
- package/dist/projection/class-property-presence.d.ts +12 -4
- package/dist/projection/class-property-presence.js +14 -9
- package/dist/semantics/callable-origins.js +6 -3
- package/dist/semantics/frontend.js +5 -1
- package/dist/semantics/normalize/structural.d.ts +2 -1
- package/dist/semantics/normalize/structural.js +30 -6
- package/dist/semantics/normalize/symbol-keyed-this-slots.d.ts +46 -0
- package/dist/semantics/normalize/symbol-keyed-this-slots.js +270 -0
- package/dist/targets/cpp/class-properties/emit-class-properties.js +7 -2
- package/dist/targets/cpp/emit-arrays.js +2 -2
- package/dist/targets/cpp/emit-callable.js +23 -3
- package/dist/targets/cpp/emit-properties.js +15 -2
- package/dist/targets/cpp/emit-union-properties.js +18 -3
- package/dist/targets/cpp/emit.d.ts +0 -26
- package/dist/targets/cpp/emit.js +26 -2
- package/package.json +1 -1
- package/src/targets/cpp/runtime/gea_runtime.h +584 -14
- package/dist/representation/any-null-record-members.d.ts +0 -41
- package/dist/representation/any-null-record-members.js +0 -115
- package/dist/semantics/any-null-member-declarations.d.ts +0 -32
- package/dist/semantics/any-null-member-declarations.js +0 -90
- package/dist/semantics/normalize/fresh-array-result.d.ts +0 -32
- package/dist/semantics/normalize/fresh-array-result.js +0 -125
package/dist/ir/build.d.ts
CHANGED
|
@@ -126,7 +126,7 @@ export interface IrBodyBuilder {
|
|
|
126
126
|
readonly allocateOrdinaryObject: (block: IrBlockId, lineage: SemanticResultId, representation: Representation) => IrValueId;
|
|
127
127
|
readonly allocateArrayObject: (block: IrBlockId, lineage: SemanticResultId, elements: readonly IrArrayElement[], representation: Representation) => IrValueId;
|
|
128
128
|
readonly allocateCallable: (block: IrBlockId, lineage: SemanticResultId, functionId: FunctionId, captures: readonly IrOperand[], representation: Representation) => IrValueId;
|
|
129
|
-
readonly bindCallable: (block: IrBlockId, lineage: SemanticResultId, source: IrOperand, sourceFunctionId: FunctionId | null, sourceAbi: CallableAbi, thisArgument: IrOperand | null, receiver: IrOperand | null, bound: readonly IrOperand[], representation: Representation, detached?: boolean | 'holder', unboxedMethod?: UnboxedMethodAssumption) => IrValueId;
|
|
129
|
+
readonly bindCallable: (block: IrBlockId, lineage: SemanticResultId, source: IrOperand, sourceFunctionId: FunctionId | null, sourceAbi: CallableAbi, thisArgument: IrOperand | null, receiver: IrOperand | null, bound: readonly IrOperand[], representation: Representation, detached?: boolean | 'holder', unboxedMethod?: UnboxedMethodAssumption, shadowGuarded?: true) => IrValueId;
|
|
130
130
|
readonly allocateConstructor: (block: IrBlockId, lineage: SemanticResultId, declaration: DeclarationId, captures: readonly IrOperand[], representation: Representation, heritage?: IrOperand) => IrValueId;
|
|
131
131
|
readonly allocateProxy: (block: IrBlockId, lineage: SemanticResultId, target: IrOperand, handler: IrOperand, representation: Representation) => IrValueId;
|
|
132
132
|
readonly proxyPart: (block: IrBlockId, lineage: SemanticResultId, proxy: IrOperand, part: 'target' | 'handler', representation: Representation) => IrValueId;
|
package/dist/ir/build.js
CHANGED
|
@@ -293,7 +293,7 @@ export const createIrBodyBuilder = (owner, sourceOwner, abi, constructAbi = null
|
|
|
293
293
|
append(block, { kind: 'allocate-callable', lineage, functionId, captures, result });
|
|
294
294
|
return result.id;
|
|
295
295
|
};
|
|
296
|
-
const bindCallable = (block, lineage, source, sourceFunctionId, sourceAbi, thisArgument, receiver, bound, representation, detached = false, unboxedMethod) => {
|
|
296
|
+
const bindCallable = (block, lineage, source, sourceFunctionId, sourceAbi, thisArgument, receiver, bound, representation, detached = false, unboxedMethod, shadowGuarded) => {
|
|
297
297
|
const result = mintResult(representation);
|
|
298
298
|
append(block, {
|
|
299
299
|
kind: 'bind-callable',
|
|
@@ -306,6 +306,7 @@ export const createIrBodyBuilder = (owner, sourceOwner, abi, constructAbi = null
|
|
|
306
306
|
bound,
|
|
307
307
|
detached,
|
|
308
308
|
...(unboxedMethod === undefined ? {} : { unboxedMethod }),
|
|
309
|
+
...(shadowGuarded === undefined ? {} : { builtinShadowGuard: 'bind' }),
|
|
309
310
|
result
|
|
310
311
|
});
|
|
311
312
|
return result.id;
|
package/dist/ir/dense-loops.d.ts
CHANGED
|
@@ -70,8 +70,9 @@ export interface DenseArray {
|
|
|
70
70
|
* rather than the loop's counter -- `ring[i % ring.length]`, the shape every
|
|
71
71
|
* ring buffer and hash bucket is written in.
|
|
72
72
|
*
|
|
73
|
-
* A different proof, and a simpler one: `x % n` lies in `
|
|
74
|
-
* dividend whenever `n > 0
|
|
73
|
+
* A different proof, and a simpler one: `x % n` lies in `(-n, n)` for every
|
|
74
|
+
* dividend whenever `n > 0` -- and in `[0, n)` once the access has tested
|
|
75
|
+
* its sign (`DenseAccess.signed`) -- so the window needs no bound, no base and no
|
|
75
76
|
* counter -- only that the array is non-empty and has no holes, which is what
|
|
76
77
|
* the preheader checks. `bases`, `bound`, `inclusive`, `step` and `widened`
|
|
77
78
|
* carry no meaning for one of these.
|
|
@@ -173,6 +174,14 @@ export interface DenseAccess {
|
|
|
173
174
|
readonly array: number;
|
|
174
175
|
/** The flag it renders behind: the innermost enclosing loop's, which implies the window's own. */
|
|
175
176
|
readonly flag: number;
|
|
177
|
+
/**
|
|
178
|
+
* Whether this access's index is a REMAINDER, which the window's flag does
|
|
179
|
+
* not bound below: `x % n` takes the dividend's sign, so `-3 % 16` is `-3`
|
|
180
|
+
* and no preheader check can see that coming. The emitter tests the index's
|
|
181
|
+
* sign at the access itself -- a register compare, not the size reload the
|
|
182
|
+
* window exists to remove. A mask (`x & M`) is never negative and needs none.
|
|
183
|
+
*/
|
|
184
|
+
readonly signed: boolean;
|
|
176
185
|
}
|
|
177
186
|
export interface DenseLoopPlan {
|
|
178
187
|
readonly arrays: readonly DenseArray[];
|
package/dist/ir/dense-loops.js
CHANGED
|
@@ -252,7 +252,7 @@ export const denseLoopsOf = (body, hoists = loopInvariantHoistsOf(body)) => {
|
|
|
252
252
|
const flag = flagAt(blockOfOperation.get(operation) ?? loop.preheader);
|
|
253
253
|
if (flag === null)
|
|
254
254
|
continue;
|
|
255
|
-
accesses.set(operation, { array: ordinal, flag });
|
|
255
|
+
accesses.set(operation, { array: ordinal, flag, signed: candidate.signed.includes(operation) });
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
}
|
|
@@ -504,9 +504,14 @@ const windowsOfLoop = (blocks, body, context) => {
|
|
|
504
504
|
// taken modulo needs no number carried to the preheader, and a program
|
|
505
505
|
// that spells both is better served by the shape that checks less.
|
|
506
506
|
const ownLength = wrapsOwnLength(operation.key, receiver, context);
|
|
507
|
-
const
|
|
507
|
+
const at = block.operations.indexOf(operation);
|
|
508
|
+
const modulus = ownLength ? null : constantModulusOf(operation.key, context, block.operations, at);
|
|
508
509
|
const wrapped = ownLength || modulus !== null;
|
|
509
|
-
|
|
510
|
+
const signed = ownLength || (modulus !== null && !isMaskKey(operation.key, context, block.operations, at));
|
|
511
|
+
// A typed array has no own-length remainder form here (its length is not
|
|
512
|
+
// `cells`), but a constant reach is checked against its `size()` like any
|
|
513
|
+
// other window.
|
|
514
|
+
if (typed !== null && ((wrapped && modulus === null) || held.reference.kind === 'element'))
|
|
510
515
|
continue;
|
|
511
516
|
const base = wrapped ? null : indexBaseOf(operation.key, context, blocks);
|
|
512
517
|
const found = byReference.get(key);
|
|
@@ -514,11 +519,21 @@ const windowsOfLoop = (blocks, body, context) => {
|
|
|
514
519
|
if (found)
|
|
515
520
|
found.sound = false;
|
|
516
521
|
else
|
|
517
|
-
byReference.set(key, { ...held, element, typed, wrapped, modulus, bases: [], operations: [], sound: false });
|
|
522
|
+
byReference.set(key, { ...held, element, typed, wrapped, modulus, bases: [], operations: [], signed: [], sound: false });
|
|
518
523
|
continue;
|
|
519
524
|
}
|
|
520
525
|
if (!found) {
|
|
521
|
-
byReference.set(key, {
|
|
526
|
+
byReference.set(key, {
|
|
527
|
+
...held,
|
|
528
|
+
element,
|
|
529
|
+
typed,
|
|
530
|
+
wrapped,
|
|
531
|
+
modulus,
|
|
532
|
+
bases: [base],
|
|
533
|
+
operations: [operation],
|
|
534
|
+
signed: signed ? [operation] : [],
|
|
535
|
+
sound: true
|
|
536
|
+
});
|
|
522
537
|
continue;
|
|
523
538
|
}
|
|
524
539
|
// Different addends each contribute a range check to the one cumulative
|
|
@@ -539,6 +554,8 @@ const windowsOfLoop = (blocks, body, context) => {
|
|
|
539
554
|
if (!found.bases.some(same))
|
|
540
555
|
found.bases.push(base);
|
|
541
556
|
found.operations.push(operation);
|
|
557
|
+
if (signed)
|
|
558
|
+
found.signed.push(operation);
|
|
542
559
|
}
|
|
543
560
|
}
|
|
544
561
|
}
|
|
@@ -569,7 +586,8 @@ const windowsOfLoop = (blocks, body, context) => {
|
|
|
569
586
|
/**
|
|
570
587
|
* Whether an index is a REMAINDER by this very array's `length`.
|
|
571
588
|
*
|
|
572
|
-
* `x % a.length` is in `
|
|
589
|
+
* `x % a.length` is in `(-a.length, a.length)` for every dividend, and the
|
|
590
|
+
* access tests the sign (`DenseAccess.signed`), so an access keyed
|
|
573
591
|
* by one needs no bound of its own -- which is the whole point, because the
|
|
574
592
|
* bound is what a per-access size read would cost. The receiver of the length
|
|
575
593
|
* read has to be the SAME value the access itself indexes: `a[x % b.length]`
|
|
@@ -604,8 +622,8 @@ const wrapsOwnLength = (key, receiver, context) => {
|
|
|
604
622
|
* The positive integer an index is taken modulo, when the divisor is a
|
|
605
623
|
* CONSTANT -- `table[i % 16]`.
|
|
606
624
|
*
|
|
607
|
-
* The same arithmetic `wrapsOwnLength` relies on: `x % n` lies in `
|
|
608
|
-
* every dividend whenever `n > 0
|
|
625
|
+
* The same arithmetic `wrapsOwnLength` relies on: `x % n` lies in `(-n, n)`
|
|
626
|
+
* for every dividend whenever `n > 0`, and the access tests its sign. What this does NOT prove is that `n` is
|
|
609
627
|
* inside the array, because a constant says nothing about a length; the
|
|
610
628
|
* preheader's `size() >= n` is what closes that, and `DenseArray.modulus`
|
|
611
629
|
* carries the number there.
|
|
@@ -616,7 +634,11 @@ const wrapsOwnLength = (key, receiver, context) => {
|
|
|
616
634
|
*/
|
|
617
635
|
const constantModulusOf = (key, context, operations, at) => {
|
|
618
636
|
const compute = remainderBehind(key, context, operations, at);
|
|
619
|
-
if (compute?.kind !== 'compute' || compute.form !== 'binary'
|
|
637
|
+
if (compute?.kind !== 'compute' || compute.form !== 'binary')
|
|
638
|
+
return null;
|
|
639
|
+
if (compute.operator === '&')
|
|
640
|
+
return constantMaskReachOf(compute.operands, context);
|
|
641
|
+
if (compute.operator !== '%')
|
|
620
642
|
return null;
|
|
621
643
|
const divisor = compute.operands[1];
|
|
622
644
|
if (!divisor)
|
|
@@ -629,6 +651,33 @@ const constantModulusOf = (key, context, operations, at) => {
|
|
|
629
651
|
return null;
|
|
630
652
|
return value;
|
|
631
653
|
};
|
|
654
|
+
/** Whether an index whose reach `constantModulusOf` read is a MASK, which is never negative. */
|
|
655
|
+
const isMaskKey = (key, context, operations, at) => {
|
|
656
|
+
const compute = remainderBehind(key, context, operations, at);
|
|
657
|
+
return compute?.kind === 'compute' && compute.form === 'binary' && compute.operator === '&';
|
|
658
|
+
};
|
|
659
|
+
/**
|
|
660
|
+
* `table[v & 255]` -- the other way every lookup table is indexed, and the
|
|
661
|
+
* one that needs no sign argument at all: `&` works on ToInt32 of both
|
|
662
|
+
* operands, so with a mask `M` in `[0, 2^31)` the result lies in `[0, M]` for
|
|
663
|
+
* EVERY left operand, NaN and negatives included. That is a window over
|
|
664
|
+
* `M + 1` elements, which is exactly what a constant modulus of `M + 1` asks
|
|
665
|
+
* the preheader to check, so it travels as one.
|
|
666
|
+
*
|
|
667
|
+
* Either operand may be the constant; a negative or fractional one bounds
|
|
668
|
+
* nothing and is not one of these.
|
|
669
|
+
*/
|
|
670
|
+
const constantMaskReachOf = (operands, context) => {
|
|
671
|
+
for (const operand of operands) {
|
|
672
|
+
const text = context.constantTexts.get(operand.value);
|
|
673
|
+
if (text === undefined)
|
|
674
|
+
continue;
|
|
675
|
+
const value = Number(text);
|
|
676
|
+
if (Number.isSafeInteger(value) && value >= 0 && value <= 0x7fffffff)
|
|
677
|
+
return value + 1;
|
|
678
|
+
}
|
|
679
|
+
return null;
|
|
680
|
+
};
|
|
632
681
|
/**
|
|
633
682
|
* Where an index's value was computed, seeing through a binding.
|
|
634
683
|
*
|
package/dist/ir/integers.js
CHANGED
|
@@ -271,10 +271,26 @@ export const narrowableIntegersOf = (body, storage = noStorageFacts) => {
|
|
|
271
271
|
// was every index derived from it -- soft-float on every pixel of Bloom's
|
|
272
272
|
// upscaler.
|
|
273
273
|
const minMaxResults = new Map();
|
|
274
|
+
// `Math.clz32` counts the leading zeros of ToUint32 of anything, NaN
|
|
275
|
+
// included: always an integer in [0, 32]. `Math.abs` of an integer is an
|
|
276
|
+
// integer no larger than it. Without these a vorticity confinement's
|
|
277
|
+
// `Math.abs(gx)` and `Math.clz32(length)` were doubles, and with them every
|
|
278
|
+
// shift and product downstream -- soft-float per cell on the S31.
|
|
279
|
+
const clz32Results = new Set();
|
|
280
|
+
const absResults = new Map();
|
|
274
281
|
for (const [call, intrinsic] of numericIntrinsicsOf(body).calls) {
|
|
275
|
-
if (
|
|
282
|
+
if (!call.result)
|
|
283
|
+
continue;
|
|
284
|
+
if (intrinsic === 'imul')
|
|
276
285
|
imulResults.add(call.result.id);
|
|
277
|
-
else if (
|
|
286
|
+
else if (intrinsic === 'clz32')
|
|
287
|
+
clz32Results.add(call.result.id);
|
|
288
|
+
else if (intrinsic === 'abs') {
|
|
289
|
+
const argument = call.arguments[0];
|
|
290
|
+
if (argument)
|
|
291
|
+
absResults.set(call.result.id, argument);
|
|
292
|
+
}
|
|
293
|
+
else
|
|
278
294
|
minMaxResults.set(call.result.id, call.arguments);
|
|
279
295
|
}
|
|
280
296
|
const definitions = new Map();
|
|
@@ -402,8 +418,11 @@ export const narrowableIntegersOf = (body, storage = noStorageFacts) => {
|
|
|
402
418
|
if (scalar)
|
|
403
419
|
integralCells.add(cell);
|
|
404
420
|
const producesInteger = (value) => {
|
|
405
|
-
if (imulResults.has(value))
|
|
421
|
+
if (imulResults.has(value) || clz32Results.has(value))
|
|
406
422
|
return true;
|
|
423
|
+
const absolute = absResults.get(value);
|
|
424
|
+
if (absolute !== undefined)
|
|
425
|
+
return integral.has(absolute.value);
|
|
407
426
|
const chosen = minMaxResults.get(value);
|
|
408
427
|
if (chosen !== undefined)
|
|
409
428
|
return chosen.every((argument) => integral.has(argument.value));
|
|
@@ -624,6 +643,11 @@ export const narrowableIntegersOf = (body, storage = noStorageFacts) => {
|
|
|
624
643
|
const computeMagnitude = (operand) => {
|
|
625
644
|
if (imulResults.has(operand.value))
|
|
626
645
|
return boundedBy(2 ** 31);
|
|
646
|
+
if (clz32Results.has(operand.value))
|
|
647
|
+
return boundedBy(32);
|
|
648
|
+
const absolute = absResults.get(operand.value);
|
|
649
|
+
if (absolute !== undefined)
|
|
650
|
+
return magnitudeOfValue(absolute);
|
|
627
651
|
const chosen = minMaxResults.get(operand.value);
|
|
628
652
|
if (chosen !== undefined) {
|
|
629
653
|
let answer = { kind: 'bounded', limit: 0 };
|
|
@@ -69,7 +69,7 @@ const lowerDeferredFunctionBind = (ctx, block, lineage, operation, deferred) =>
|
|
|
69
69
|
if (!exactFrame) {
|
|
70
70
|
throw new IrLoweringBlockedError('Function.prototype.bind result does not state the source callable suffix convention exactly');
|
|
71
71
|
}
|
|
72
|
-
registerResult(ctx, operation, ctx.builder.bindCallable(block, lineage, source, deferred.functionId, deferred.abi, thisArgument, receiver, values, result, false, deferred.unboxedMethod));
|
|
72
|
+
registerResult(ctx, operation, ctx.builder.bindCallable(block, lineage, source, deferred.functionId, deferred.abi, thisArgument, receiver, values, result, false, deferred.unboxedMethod, deferred.bindShadowGuard));
|
|
73
73
|
};
|
|
74
74
|
/**
|
|
75
75
|
* Rewriting `add.call(x, 3, 4)` into `add`'s own call, with `x` as the
|
package/dist/ir/model.d.ts
CHANGED
|
@@ -945,6 +945,8 @@ export interface BindCallableOperation extends IrOperationBase {
|
|
|
945
945
|
*/
|
|
946
946
|
readonly unboxedMethod?: UnboxedMethodAssumption;
|
|
947
947
|
readonly unboxedMethodConfirmed?: boolean;
|
|
948
|
+
/** The same run-time check for a bind no census can confirm (`DeferredCallee.bindShadowGuard`). */
|
|
949
|
+
readonly builtinShadowGuard?: 'bind';
|
|
948
950
|
readonly result: IrResult;
|
|
949
951
|
}
|
|
950
952
|
export interface AllocateConstructorOperation extends IrOperationBase {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IrValueId } from '../identity/ids.js';
|
|
2
2
|
import type { CallOperation, IrBody } from './model.js';
|
|
3
|
-
export type NumericIntrinsic = 'imul' | 'min' | 'max';
|
|
3
|
+
export type NumericIntrinsic = 'imul' | 'min' | 'max' | 'abs' | 'clz32';
|
|
4
4
|
/**
|
|
5
5
|
* Language builtin calls authenticated by their native protocol, never by a
|
|
6
6
|
* source identifier spelling. A user object named Math has no such protocol.
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { allOperationsOf } from './model.js';
|
|
2
2
|
import { operandsOfIrOperation } from './queries.js';
|
|
3
|
-
|
|
3
|
+
/** How many arguments each intrinsic is recognized at; other arities keep the general callable path. */
|
|
4
|
+
const intrinsicArity = new Map([
|
|
5
|
+
['imul', 2],
|
|
6
|
+
['min', 2],
|
|
7
|
+
['max', 2],
|
|
8
|
+
['abs', 1],
|
|
9
|
+
['clz32', 1]
|
|
10
|
+
]);
|
|
4
11
|
/**
|
|
5
12
|
* Language builtin calls authenticated by their native protocol, never by a
|
|
6
13
|
* source identifier spelling. A user object named Math has no such protocol.
|
|
@@ -26,7 +33,7 @@ export const numericIntrinsicsOf = (body) => {
|
|
|
26
33
|
if (receiver.kind === 'native-handle' &&
|
|
27
34
|
receiver.native === null &&
|
|
28
35
|
receiver.protocol === 'Math' &&
|
|
29
|
-
|
|
36
|
+
intrinsicArity.has(keys.get(operation.key.value) ?? '')) {
|
|
30
37
|
callees.set(operation.result.id, keys.get(operation.key.value));
|
|
31
38
|
}
|
|
32
39
|
}
|
|
@@ -37,7 +44,7 @@ export const numericIntrinsicsOf = (body) => {
|
|
|
37
44
|
continue;
|
|
38
45
|
const intrinsic = callees.get(operation.callee.value);
|
|
39
46
|
// Other arities and coercing ABIs retain the general callable path.
|
|
40
|
-
if (intrinsic === undefined || operation.arguments.length !==
|
|
47
|
+
if (intrinsic === undefined || operation.arguments.length !== intrinsicArity.get(intrinsic))
|
|
41
48
|
continue;
|
|
42
49
|
if (!operation.arguments.every((argument) => argument.representation.kind === 'scalar' && argument.representation.domain === 'number'))
|
|
43
50
|
continue;
|
|
@@ -107,6 +107,13 @@ export interface DeferredCallee {
|
|
|
107
107
|
* Function object the call reaches at run time.
|
|
108
108
|
*/
|
|
109
109
|
readonly shadowGuard?: 'call' | 'apply';
|
|
110
|
+
/**
|
|
111
|
+
* Set on a `bind` lowered as the builtin under `'builtin-unless-boxed'`
|
|
112
|
+
* when no census can confirm the assumption -- the Function object has no
|
|
113
|
+
* known origin, or its method value escapes. The emitter checks that one
|
|
114
|
+
* object's own `bind` at run time, as `shadowGuard` does for `call`.
|
|
115
|
+
*/
|
|
116
|
+
readonly bindShadowGuard?: true;
|
|
110
117
|
/**
|
|
111
118
|
* The RECEIVER's own carrier -- the boxed frame's argument carrier, and the
|
|
112
119
|
* carrier the this-argument must keep its identity in. Carried here because
|
|
@@ -187,7 +187,8 @@ export const deferredCalleeOf = (input, operation) => {
|
|
|
187
187
|
const shadowGuard = member === 'call' && resolution === 'builtin-unless-boxed' && representation.kind !== 'dynamic' ? member : null;
|
|
188
188
|
if (process.env.GEA_CALLABLE_FACTS_DEBUG)
|
|
189
189
|
console.error(`[deferred-callee] member=${member} functionId=${functionId} carrier=${representation.kind} resolution=${resolution}`);
|
|
190
|
-
|
|
190
|
+
const bindShadowGuard = member === 'bind' && resolution === 'builtin-unless-boxed' && representation.kind !== 'dynamic' && unboxedMethod === null;
|
|
191
|
+
if (resolution !== 'builtin' && unboxedMethod === null && shadowGuard === null && !bindShadowGuard)
|
|
191
192
|
return null;
|
|
192
193
|
// Read off the receiver's own carrier, which is what decides how the call
|
|
193
194
|
// renders -- see `DeferredCallee.frame`.
|
|
@@ -214,7 +215,16 @@ export const deferredCalleeOf = (input, operation) => {
|
|
|
214
215
|
: null
|
|
215
216
|
: bindAbiOfCallableReceiver(representation);
|
|
216
217
|
return abi
|
|
217
|
-
? {
|
|
218
|
+
? {
|
|
219
|
+
member,
|
|
220
|
+
receiver,
|
|
221
|
+
abi,
|
|
222
|
+
functionId,
|
|
223
|
+
frame,
|
|
224
|
+
receiverCarrier: representation,
|
|
225
|
+
...(unboxedMethod === null ? {} : { unboxedMethod }),
|
|
226
|
+
...(bindShadowGuard ? { bindShadowGuard } : {})
|
|
227
|
+
}
|
|
218
228
|
: null;
|
|
219
229
|
}
|
|
220
230
|
if (functionId === null && representation.kind !== 'function-value-dispatch')
|
|
@@ -18,10 +18,18 @@ export declare const classPrototypeMemberIsPresent: (classes: ReadonlyMap<Declar
|
|
|
18
18
|
* this answers `false`, the sidecar is not merely one source of the answer: it
|
|
19
19
|
* is the WHOLE answer, and `in` over that receiver is exactly its verdict.
|
|
20
20
|
*
|
|
21
|
-
* When it answers `true`, the layout owns a symbol-keyed
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
21
|
+
* When it answers `true`, the layout owns a symbol-keyed member the sidecar
|
|
22
|
+
* knows nothing about, and which of the two holds the key is undecidable
|
|
23
|
+
* without knowing WHICH symbol -- so the site refuses by name instead, rather
|
|
24
|
+
* than consulting one half and calling it the answer.
|
|
25
|
+
*
|
|
26
|
+
* A CLASS's symbol-keyed FIELD is not such a member. `gea::nativeDynamicHas`
|
|
27
|
+
* asks the receiver's virtual `gea_ownFieldPresent` before the sidecar, and a
|
|
28
|
+
* generated class answers that from the field's own presence bit for every
|
|
29
|
+
* key it declares, symbols included (`symbol-keyed-this-slots.ts` lays out
|
|
30
|
+
* hono's `cacheKey` cache that way) -- so the one call still sees both halves.
|
|
31
|
+
* What it cannot see is a symbol-keyed method or accessor, which lives on the
|
|
32
|
+
* prototype; those, and a plain record's symbol field, still refuse.
|
|
25
33
|
*/
|
|
26
34
|
export declare const symbolKeyedMemberIsDeclared: (classes: ReadonlyMap<DeclarationId, ClassLayout>, fields: readonly {
|
|
27
35
|
readonly key: string;
|
|
@@ -31,14 +31,22 @@ export const classPrototypeMemberIsPresent = (classes, declaration, key) => {
|
|
|
31
31
|
* this answers `false`, the sidecar is not merely one source of the answer: it
|
|
32
32
|
* is the WHOLE answer, and `in` over that receiver is exactly its verdict.
|
|
33
33
|
*
|
|
34
|
-
* When it answers `true`, the layout owns a symbol-keyed
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
34
|
+
* When it answers `true`, the layout owns a symbol-keyed member the sidecar
|
|
35
|
+
* knows nothing about, and which of the two holds the key is undecidable
|
|
36
|
+
* without knowing WHICH symbol -- so the site refuses by name instead, rather
|
|
37
|
+
* than consulting one half and calling it the answer.
|
|
38
|
+
*
|
|
39
|
+
* A CLASS's symbol-keyed FIELD is not such a member. `gea::nativeDynamicHas`
|
|
40
|
+
* asks the receiver's virtual `gea_ownFieldPresent` before the sidecar, and a
|
|
41
|
+
* generated class answers that from the field's own presence bit for every
|
|
42
|
+
* key it declares, symbols included (`symbol-keyed-this-slots.ts` lays out
|
|
43
|
+
* hono's `cacheKey` cache that way) -- so the one call still sees both halves.
|
|
44
|
+
* What it cannot see is a symbol-keyed method or accessor, which lives on the
|
|
45
|
+
* prototype; those, and a plain record's symbol field, still refuse.
|
|
38
46
|
*/
|
|
39
47
|
export const symbolKeyedMemberIsDeclared = (classes, fields, declaration) => {
|
|
40
48
|
const isSymbolKey = (entry) => symbolPropertyKeyDeclarationOf(entry.key) !== null;
|
|
41
|
-
if (fields !== null && fields.some(isSymbolKey))
|
|
49
|
+
if (declaration === null && fields !== null && fields.some(isSymbolKey))
|
|
42
50
|
return true;
|
|
43
51
|
const seen = new Set();
|
|
44
52
|
let current = declaration;
|
|
@@ -47,10 +55,7 @@ export const symbolKeyedMemberIsDeclared = (classes, fields, declaration) => {
|
|
|
47
55
|
const layout = classes.get(current);
|
|
48
56
|
if (!layout)
|
|
49
57
|
return true;
|
|
50
|
-
if (layout.
|
|
51
|
-
layout.methods.some(isSymbolKey) ||
|
|
52
|
-
layout.accessors.some(isSymbolKey) ||
|
|
53
|
-
(layout.methodOverrides ?? []).some(isSymbolKey))
|
|
58
|
+
if (layout.methods.some(isSymbolKey) || layout.accessors.some(isSymbolKey) || (layout.methodOverrides ?? []).some(isSymbolKey))
|
|
54
59
|
return true;
|
|
55
60
|
current = layout.base;
|
|
56
61
|
}
|
|
@@ -389,10 +389,13 @@ export const callableBuiltinResolution = (facts, functionId, member) => {
|
|
|
389
389
|
*/
|
|
390
390
|
export const callableBindResolution = (facts, functionId) => {
|
|
391
391
|
const resolution = callableBuiltinResolution(facts, functionId, 'bind');
|
|
392
|
-
if (resolution !== 'ordinary-property'
|
|
392
|
+
if (resolution !== 'ordinary-property')
|
|
393
393
|
return resolution;
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
// An unknown origin (a read through an interface union: hono's
|
|
395
|
+
// `router.match.bind(router)`) could be any function, so a statically named
|
|
396
|
+
// own `bind` anywhere stays decisive for it.
|
|
397
|
+
const owns = functionId === null ? [...facts.ownProperties.values()] : [facts.ownProperties.get(functionId)];
|
|
398
|
+
if (owns.some((own) => own?.has('bind') || own?.has(unknownCallableOwnProperty)))
|
|
396
399
|
return resolution;
|
|
397
400
|
const boxedOnly = (name) => !facts.anonymousProperties.has(name) || facts.boxedOnlyProperties.has(name);
|
|
398
401
|
return boxedOnly('bind') && boxedOnly(unknownCallableOwnProperty) ? 'builtin-unless-boxed' : resolution;
|
|
@@ -16,6 +16,7 @@ import { createStructuralMapper } from './normalize/structural.js';
|
|
|
16
16
|
import { createSloppyAbsenceCensus, noSloppyAbsence } from './normalize/sloppy-absence.js';
|
|
17
17
|
import { censusRecordStandInArms } from './normalize/record-stand-in-arms.js';
|
|
18
18
|
import { censusAssertedArgumentArms } from './normalize/asserted-argument-arms.js';
|
|
19
|
+
import { censusSymbolKeyedThisSlots } from './normalize/symbol-keyed-this-slots.js';
|
|
19
20
|
import { censusSuppressedWriteArms } from './normalize/suppressed-write-arms.js';
|
|
20
21
|
import { withOverrideFieldArms } from './normalize/override-field-arms.js';
|
|
21
22
|
import { censusDeclaredMembers } from './normalize/structural-declarations.js';
|
|
@@ -729,7 +730,10 @@ export const runFrontend = (input) => {
|
|
|
729
730
|
withOverrideFieldArms(compiled.checker, compiled.sourceFiles, censusSuppressedWriteArms(compiled.checker, compiled.sourceFiles, reachable, valueFlow)),
|
|
730
731
|
// A record an argument asserts through `unknown` into a union keeps its
|
|
731
732
|
// own arm of that union -- see `asserted-argument-arms.ts`.
|
|
732
|
-
censusAssertedArgumentArms(compiled.checker, compiled.sourceFiles, reachable)
|
|
733
|
+
censusAssertedArgumentArms(compiled.checker, compiled.sourceFiles, reachable),
|
|
734
|
+
// A module-private symbol a class writes on `this` without declaring it is
|
|
735
|
+
// a native optional field -- see `symbol-keyed-this-slots.ts`.
|
|
736
|
+
censusSymbolKeyedThisSlots(compiled.checker, compiled.sourceFiles, reachable));
|
|
733
737
|
// The frontend's evidence-policy tables: built from the same
|
|
734
738
|
// `identities`/`valueFlow`/`reachable` the fixpoint above already settled,
|
|
735
739
|
// right after `types` exists so the agreement instrument can ask the
|
|
@@ -5,6 +5,7 @@ import { type SloppyAbsenceCensus } from './sloppy-absence.js';
|
|
|
5
5
|
import { type SuppressedWriteArmCensus } from './suppressed-write-arms.js';
|
|
6
6
|
import { type RecordStandInArmCensus } from './record-stand-in-arms.js';
|
|
7
7
|
import { type AssertedArgumentArmCensus } from './asserted-argument-arms.js';
|
|
8
|
+
import { type SymbolKeyedThisSlotCensus } from './symbol-keyed-this-slots.js';
|
|
8
9
|
import { type RecordLinkFamilyCensus } from './record-link-families.js';
|
|
9
10
|
import { type DeclaredMemberCensus } from './structural-declarations.js';
|
|
10
11
|
import type { DeclarationId, StructuralTypeId } from '../../identity/ids.js';
|
|
@@ -204,7 +205,7 @@ export interface StructuralMapper {
|
|
|
204
205
|
*/
|
|
205
206
|
readonly classCopies: () => ReadonlyMap<DeclarationId, readonly ClassCopyKey[]>;
|
|
206
207
|
}
|
|
207
|
-
export declare const createStructuralMapper: (checker: ts.TypeChecker, identities: IdentityTable, table: StructuralTypeTable, instantiations?: InstantiationCensus, specializations?: SpecializationCensus, parameters?: ParameterBindingCensus, absent?: AbsentGlobalCensus, collections?: CollectionBindingCensus, bags?: ObjectBagCensus, flow?: ValueFlowIndex, families?: InterfaceFamilyCensus, moduleRecords?: CommonJsModuleRecordCensus, declaredMembers?: DeclaredMemberCensus, isIntrinsicDescriptorCall?: (call: ts.CallExpression) => boolean, standIns?: RecordStandInArmCensus, linkFamilies?: RecordLinkFamilyCensus, sloppyAbsence?: SloppyAbsenceCensus, suppressedWrites?: SuppressedWriteArmCensus, assertedArguments?: AssertedArgumentArmCensus) => StructuralMapper;
|
|
208
|
+
export declare const createStructuralMapper: (checker: ts.TypeChecker, identities: IdentityTable, table: StructuralTypeTable, instantiations?: InstantiationCensus, specializations?: SpecializationCensus, parameters?: ParameterBindingCensus, absent?: AbsentGlobalCensus, collections?: CollectionBindingCensus, bags?: ObjectBagCensus, flow?: ValueFlowIndex, families?: InterfaceFamilyCensus, moduleRecords?: CommonJsModuleRecordCensus, declaredMembers?: DeclaredMemberCensus, isIntrinsicDescriptorCall?: (call: ts.CallExpression) => boolean, standIns?: RecordStandInArmCensus, linkFamilies?: RecordLinkFamilyCensus, sloppyAbsence?: SloppyAbsenceCensus, suppressedWrites?: SuppressedWriteArmCensus, assertedArguments?: AssertedArgumentArmCensus, symbolSlots?: SymbolKeyedThisSlotCensus) => StructuralMapper;
|
|
208
209
|
/**
|
|
209
210
|
* `JSON.stringify(value)` from the default lib over a value that may have no
|
|
210
211
|
* JSON form, so the call may return `undefined` although the lib declares
|
|
@@ -7,6 +7,7 @@ import { emptySuppressedWriteArmCensus } from './suppressed-write-arms.js';
|
|
|
7
7
|
import { recordStorageFamilies } from './record-storage-families.js';
|
|
8
8
|
import { emptyRecordStandInArmCensus } from './record-stand-in-arms.js';
|
|
9
9
|
import { emptyAssertedArgumentArmCensus } from './asserted-argument-arms.js';
|
|
10
|
+
import { emptySymbolKeyedThisSlotCensus } from './symbol-keyed-this-slots.js';
|
|
10
11
|
import { emptyRecordLinkFamilyCensus } from './record-link-families.js';
|
|
11
12
|
import { bivariantSlotArrayAliasTypeOf, bivariantSlotBindingTypeOf, bivariantSlotElementTypeOf, bivariantSlotParameterTypeOf, bivariantSlotReadTypeOf } from './bivariant-slot-parameter.js';
|
|
12
13
|
import { emptyDeclaredMemberCensus } from './structural-declarations.js';
|
|
@@ -101,7 +102,7 @@ const nativeErrorNames = new Set([
|
|
|
101
102
|
'TypeError',
|
|
102
103
|
'URIError'
|
|
103
104
|
]);
|
|
104
|
-
export const createStructuralMapper = (checker, identities, table, instantiations = emptyInstantiationCensus, specializations = emptySpecializationCensus, parameters = emptyParameterBindingCensus, absent = emptyAbsentGlobalCensus, collections = emptyCollectionBindingCensus, bags = emptyObjectBagCensus, flow, families = emptyInterfaceFamilyCensus, moduleRecords = emptyCommonJsModuleRecordCensus, declaredMembers = emptyDeclaredMemberCensus, isIntrinsicDescriptorCall = () => false, standIns = emptyRecordStandInArmCensus, linkFamilies = emptyRecordLinkFamilyCensus, sloppyAbsence = noSloppyAbsence, suppressedWrites = emptySuppressedWriteArmCensus, assertedArguments = emptyAssertedArgumentArmCensus) => {
|
|
105
|
+
export const createStructuralMapper = (checker, identities, table, instantiations = emptyInstantiationCensus, specializations = emptySpecializationCensus, parameters = emptyParameterBindingCensus, absent = emptyAbsentGlobalCensus, collections = emptyCollectionBindingCensus, bags = emptyObjectBagCensus, flow, families = emptyInterfaceFamilyCensus, moduleRecords = emptyCommonJsModuleRecordCensus, declaredMembers = emptyDeclaredMemberCensus, isIntrinsicDescriptorCall = () => false, standIns = emptyRecordStandInArmCensus, linkFamilies = emptyRecordLinkFamilyCensus, sloppyAbsence = noSloppyAbsence, suppressedWrites = emptySuppressedWriteArmCensus, assertedArguments = emptyAssertedArgumentArmCensus, symbolSlots = emptySymbolKeyedThisSlotCensus) => {
|
|
105
106
|
const storageTypeOf = recordStorageFamilies(checker, flow, parameters);
|
|
106
107
|
// One disagreement list for the WHOLE mapper, for the same reason the caches
|
|
107
108
|
// below are shared: two rules answering for one node is a fact about the rule
|
|
@@ -134,13 +135,13 @@ export const createStructuralMapper = (checker, identities, table, instantiation
|
|
|
134
135
|
const cached = views.get(key);
|
|
135
136
|
if (cached)
|
|
136
137
|
return cached;
|
|
137
|
-
const built = buildMapper(checker, identities.forSpecialization(path), table, instantiations, specializations, path, bindingPath, mapperFor, parameters, absent, collections, bags, flow, storageTypeOf, families, moduleRecords, declaredMembers, isIntrinsicDescriptorCall, standIns, linkFamilies, aliasRecurrence, instantiatedMembersFor(bindingPath), viewIndependentKeyOf, sharedCompleted, classCopyKeys, disagreements, sloppyAbsence, suppressedWrites, assertedArguments);
|
|
138
|
+
const built = buildMapper(checker, identities.forSpecialization(path), table, instantiations, specializations, path, bindingPath, mapperFor, parameters, absent, collections, bags, flow, storageTypeOf, families, moduleRecords, declaredMembers, isIntrinsicDescriptorCall, standIns, linkFamilies, aliasRecurrence, instantiatedMembersFor(bindingPath), viewIndependentKeyOf, sharedCompleted, classCopyKeys, disagreements, sloppyAbsence, suppressedWrites, assertedArguments, symbolSlots);
|
|
138
139
|
views.set(key, built);
|
|
139
140
|
return built;
|
|
140
141
|
};
|
|
141
142
|
return mapperFor(rootSpecialization);
|
|
142
143
|
};
|
|
143
|
-
const buildMapper = (checker, identities, table, instantiations, specializations, path, bindingPath, mapperFor, programParameters, absent, collections, bags, flow, storageTypeOf, families, moduleRecords, declaredMembers, isIntrinsicDescriptorCall, standIns, linkFamilies, aliasRecurrence, instantiatedMembers, viewIndependentKeyOf, sharedCompleted, classCopyKeys, disagreements, sloppyAbsence, suppressedWrites, assertedArguments) => {
|
|
144
|
+
const buildMapper = (checker, identities, table, instantiations, specializations, path, bindingPath, mapperFor, programParameters, absent, collections, bags, flow, storageTypeOf, families, moduleRecords, declaredMembers, isIntrinsicDescriptorCall, standIns, linkFamilies, aliasRecurrence, instantiatedMembers, viewIndependentKeyOf, sharedCompleted, classCopyKeys, disagreements, sloppyAbsence, suppressedWrites, assertedArguments, symbolSlots) => {
|
|
144
145
|
const { boundByPath, bindingOf: censusBindingOf, substituteTypeParameter } = createTypeParameterSubstitution(identities, instantiations, specializations, bindingPath);
|
|
145
146
|
// What a parameter holds is a fact about the COPY this view describes: a
|
|
146
147
|
// generic body's copies are called with different carriers. Scoped once,
|
|
@@ -754,11 +755,11 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
754
755
|
// constructor-function/class-alias question to ask in the first place
|
|
755
756
|
// (see `buildMapper`'s `flow?: ValueFlowIndex`); `ts.isClassLike` matches
|
|
756
757
|
// this function's one call site, gated the same way at `declaredAnchorOf`.
|
|
758
|
+
const extra = [];
|
|
757
759
|
if (flow && ts.isClassLike(location) && shape.kind === 'object') {
|
|
758
760
|
const installed = constructorInstalledMemberDeclarationsOf(flow, location);
|
|
759
761
|
if (installed.size > 0) {
|
|
760
762
|
const existing = new Set(shape.members.flatMap((member) => (member.key.kind === 'string' ? [member.key.value] : [])));
|
|
761
|
-
const extra = [];
|
|
762
763
|
for (const [key, declarations] of installed) {
|
|
763
764
|
if (existing.has(key))
|
|
764
765
|
continue;
|
|
@@ -771,10 +772,33 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
771
772
|
accessor: null
|
|
772
773
|
});
|
|
773
774
|
}
|
|
774
|
-
if (extra.length > 0)
|
|
775
|
-
return table.intern({ ...shape, members: [...shape.members, ...extra] });
|
|
776
775
|
}
|
|
777
776
|
}
|
|
777
|
+
// A module-private symbol key the class writes on `this` without declaring
|
|
778
|
+
// it -- see `symbol-keyed-this-slots.ts`. Optional with no initializer, so
|
|
779
|
+
// the slot is absent until the first write, as the expando it replaces was.
|
|
780
|
+
// A subclass's shape lists inherited members too, so it carries every
|
|
781
|
+
// base class's slots.
|
|
782
|
+
const slotOwners = [];
|
|
783
|
+
for (let owner = ts.isClassLike(location) ? location : null; owner && !slotOwners.includes(owner);) {
|
|
784
|
+
slotOwners.push(owner);
|
|
785
|
+
const heritage = owner.heritageClauses?.find((clause) => clause.token === ts.SyntaxKind.ExtendsKeyword)?.types[0];
|
|
786
|
+
const base = heritage ? checker.getTypeAtLocation(heritage).getSymbol()?.valueDeclaration : undefined;
|
|
787
|
+
owner = base && ts.isClassLike(base) ? base : null;
|
|
788
|
+
}
|
|
789
|
+
if (shape.kind === 'object') {
|
|
790
|
+
for (const property of slotOwners.flatMap((owner) => symbolSlots.slotsOf(owner))) {
|
|
791
|
+
const member = memberOf(property, location);
|
|
792
|
+
if (!member || member.key.kind !== 'symbol')
|
|
793
|
+
continue;
|
|
794
|
+
const declaration = member.key.declaration;
|
|
795
|
+
if (shape.members.some((existing) => existing.key.kind === 'symbol' && existing.key.declaration === declaration))
|
|
796
|
+
continue;
|
|
797
|
+
extra.push({ ...member, optional: true, readonly: false, accessor: null });
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
if (extra.length > 0 && shape.kind === 'object')
|
|
801
|
+
return table.intern({ ...shape, members: [...shape.members, ...extra] });
|
|
778
802
|
return table.intern(shape);
|
|
779
803
|
};
|
|
780
804
|
const { declaredBodyOf } = createDeclaredBodyResolver({ table, typeOf, signatureOf, objectShapeOf, arrayHeritageShapeOf });
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { type ProgramReachability } from './reachability.js';
|
|
3
|
+
/**
|
|
4
|
+
* A module-private `Symbol()` key a class writes onto its own instances
|
|
5
|
+
* without declaring it, laid out as an optional native field of that class.
|
|
6
|
+
*
|
|
7
|
+
* `@hono/node-server`'s `LightweightResponse` (response.ts) is the case. Its
|
|
8
|
+
* per-response cache lives under `cacheKey`, which the class never declares:
|
|
9
|
+
*
|
|
10
|
+
* ;(this as any)[cacheKey] = [init?.status || 200, body ?? null, headers || init?.headers]
|
|
11
|
+
* const cache = (this as LightResponse)[cacheKey]
|
|
12
|
+
* delete (this as LightResponse)[cacheKey]
|
|
13
|
+
* return ((this as LightResponse)[responseCache] ||= new GlobalResponse(...))
|
|
14
|
+
*
|
|
15
|
+
* and the listener asks `cacheKey in res` / `(res as any)[cacheKey]` once per
|
|
16
|
+
* request. Without a field, every one of those went to the object's expando
|
|
17
|
+
* sidecar: a heap `DynamicObject`, a weak owner and a registry slot minted per
|
|
18
|
+
* response, then a hash probe per access.
|
|
19
|
+
*
|
|
20
|
+
* The field is OPTIONAL and has no initializer, so its presence bit starts
|
|
21
|
+
* false: `in` answers false until the first write and again after `delete`,
|
|
22
|
+
* exactly as the expando did. The native field protocol is virtual, so a
|
|
23
|
+
* receiver typed as a base class (`cacheKey in res`) reaches it too.
|
|
24
|
+
*
|
|
25
|
+
* Its type is the one the program itself states for the key -- the property
|
|
26
|
+
* an `as T` cast on `this` declares (`LightResponse[cacheKey]`). A key no such
|
|
27
|
+
* interface types stays an expando: inventing a type from the writes would be
|
|
28
|
+
* a guess.
|
|
29
|
+
*
|
|
30
|
+
* Sound only where every way the key can reach an object is visible, so the
|
|
31
|
+
* census withdraws a key when:
|
|
32
|
+
* - the symbol escapes: any reference to its declaration that is not an
|
|
33
|
+
* element-access key, an `in` operand, a type-position computed name, or an
|
|
34
|
+
* import/export specifier (`const k = cacheKey; o[k] = v` writes through a
|
|
35
|
+
* name this walk cannot follow);
|
|
36
|
+
* - a write anywhere in the program stores a value whose type is disjoint
|
|
37
|
+
* from the declared one (`fits` says why comparable is the bar);
|
|
38
|
+
* - an access is a destructuring or compound target other than `||=`, `&&=`
|
|
39
|
+
* and `??=`.
|
|
40
|
+
*/
|
|
41
|
+
export interface SymbolKeyedThisSlotCensus {
|
|
42
|
+
/** The interface properties typing the symbol keys `owner` writes on `this`, in first-write order. */
|
|
43
|
+
readonly slotsOf: (owner: ts.ClassLikeDeclaration) => readonly ts.Symbol[];
|
|
44
|
+
}
|
|
45
|
+
export declare const emptySymbolKeyedThisSlotCensus: SymbolKeyedThisSlotCensus;
|
|
46
|
+
export declare const censusSymbolKeyedThisSlots: (checker: ts.TypeChecker, files: readonly ts.SourceFile[], reachable: ProgramReachability) => SymbolKeyedThisSlotCensus;
|