@geastack/compiler 1.0.48 → 1.0.62
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 +57 -19
- package/dist/cli.js +2 -1
- package/dist/compiler.d.ts +1 -1
- package/dist/compiler.js +13 -6
- package/dist/conversion/derive.js +5 -0
- package/dist/conversion/native-field-view.d.ts +7 -0
- package/dist/conversion/native-field-view.js +50 -0
- package/dist/conversion/native-record-products.js +1 -0
- package/dist/conversion/native-view-origins.d.ts +1 -1
- package/dist/conversion/native-view-origins.js +5 -4
- package/dist/conversion/nodes.d.ts +9 -0
- package/dist/conversion/nodes.js +18 -0
- package/dist/conversion/record-view.d.ts +25 -1
- package/dist/conversion/record-view.js +61 -2
- package/dist/conversion/structural-plan.js +7 -6
- package/dist/ir/borrowed-field-reads.d.ts +30 -0
- package/dist/ir/borrowed-field-reads.js +218 -0
- package/dist/ir/borrowed-window-cells.d.ts +35 -0
- package/dist/ir/borrowed-window-cells.js +117 -0
- package/dist/ir/call-dispatch.js +21 -4
- package/dist/ir/callable-class-flow.js +269 -43
- package/dist/ir/captures.js +18 -1
- package/dist/ir/certify.js +14 -1
- package/dist/ir/construction-only-fields.d.ts +15 -1
- package/dist/ir/construction-only-fields.js +71 -3
- package/dist/ir/dead-logical-merge.d.ts +4 -0
- package/dist/ir/dead-logical-merge.js +89 -18
- package/dist/ir/dense-loops.d.ts +38 -4
- package/dist/ir/dense-loops.js +112 -17
- package/dist/ir/dense-read-windows.d.ts +42 -0
- package/dist/ir/dense-read-windows.js +137 -0
- package/dist/ir/facts.d.ts +12 -0
- package/dist/ir/facts.js +18 -2
- package/dist/ir/field-read-reuse.d.ts +71 -0
- package/dist/ir/field-read-reuse.js +430 -0
- package/dist/ir/hoist.d.ts +19 -2
- package/dist/ir/hoist.js +143 -24
- package/dist/ir/lower-narrow.js +19 -1
- package/dist/ir/model.d.ts +19 -0
- package/dist/ir/native-field-view-domains.d.ts +12 -2
- package/dist/ir/native-field-view-domains.js +51 -15
- package/dist/ir/native-field-view-facts.js +5 -2
- package/dist/ir/native-method-frames.js +15 -2
- package/dist/ir/plain-field-read.d.ts +31 -0
- package/dist/ir/plain-field-read.js +51 -0
- package/dist/ir/program-facts.d.ts +14 -0
- package/dist/ir/program-facts.js +85 -2
- package/dist/ir/proven-branches.js +8 -1
- package/dist/ir/publish-conversion-recipes.js +5 -1
- package/dist/ir/short-circuit-threading.d.ts +12 -4
- package/dist/ir/short-circuit-threading.js +124 -12
- package/dist/ir/stable-cell-reads.d.ts +24 -1
- package/dist/ir/stable-cell-reads.js +65 -42
- package/dist/ir/write-effects.d.ts +42 -0
- package/dist/ir/write-effects.js +208 -0
- package/dist/plugins/gea/contract.d.ts +3 -2
- package/dist/plugins/gea/contract.js +3 -1
- package/dist/plugins/gea/host.d.ts +7 -2
- package/dist/plugins/gea/host.js +25 -5
- package/dist/project-preparation.d.ts +11 -0
- package/dist/project-preparation.js +44 -0
- package/dist/projection/classes.d.ts +8 -0
- package/dist/projection/classes.js +112 -12
- package/dist/projection/dispatch.d.ts +24 -4
- package/dist/projection/dispatch.js +71 -2
- package/dist/projection/fields.js +2 -2
- package/dist/representation/model.d.ts +3 -0
- package/dist/representation/model.js +3 -0
- package/dist/representation/value-records.js +22 -0
- package/dist/semantics/frontend-timing.d.ts +9 -0
- package/dist/semantics/frontend-timing.js +43 -2
- package/dist/semantics/frontend.js +103 -7
- package/dist/semantics/model/operations.d.ts +7 -0
- package/dist/semantics/normalize/binding-fixpoint.js +7 -2
- package/dist/semantics/normalize/callable-data-write.js +6 -2
- package/dist/semantics/normalize/field-bindings.js +151 -111
- package/dist/semantics/normalize/flow/callable-reach.js +27 -0
- package/dist/semantics/normalize/flow/component-solver.js +23 -5
- package/dist/semantics/normalize/flow/source-record-data.js +6 -2
- package/dist/semantics/normalize/flow/source-value-session.d.ts +13 -0
- package/dist/semantics/normalize/flow/source-value-session.js +207 -65
- package/dist/semantics/normalize/global-host-mutations.js +162 -1
- package/dist/semantics/normalize/parameter-bindings.js +16 -1
- package/dist/semantics/normalize/producers/class-lifecycle.js +2 -1
- package/dist/semantics/normalize/producers/erasure.js +13 -8
- package/dist/semantics/subclass-member-overlay-transform.d.ts +3 -2
- package/dist/semantics/subclass-member-overlay-transform.js +416 -316
- package/dist/semantics/typescript-tsgo.d.ts +20 -0
- package/dist/semantics/typescript-tsgo.js +832 -0
- package/dist/semantics/typescript.d.ts +0 -9
- package/dist/semantics/typescript.js +4 -1
- package/dist/targets/cpp/borrowed-call-entry.d.ts +9 -0
- package/dist/targets/cpp/borrowed-call-entry.js +12 -2
- package/dist/targets/cpp/captures.js +4 -0
- package/dist/targets/cpp/class-properties/computed-method-value.d.ts +1 -1
- package/dist/targets/cpp/class-properties/computed-method-value.js +17 -7
- package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +8 -0
- package/dist/targets/cpp/class-properties/emit-class-properties.js +62 -2
- package/dist/targets/cpp/class-properties/native-method-read.js +12 -1
- package/dist/targets/cpp/conversions.js +1 -0
- package/dist/targets/cpp/emit-arrays.d.ts +5 -0
- package/dist/targets/cpp/emit-arrays.js +60 -10
- package/dist/targets/cpp/emit-binding-reference.d.ts +19 -6
- package/dist/targets/cpp/emit-binding-reference.js +26 -8
- package/dist/targets/cpp/emit-bindings.js +22 -0
- package/dist/targets/cpp/emit-callable.js +133 -16
- package/dist/targets/cpp/emit-carrier-members.d.ts +6 -0
- package/dist/targets/cpp/emit-carrier-members.js +24 -2
- package/dist/targets/cpp/emit-context.d.ts +97 -1
- package/dist/targets/cpp/emit-context.js +52 -0
- package/dist/targets/cpp/emit-equality.js +3 -0
- package/dist/targets/cpp/emit-narrowing.js +9 -0
- package/dist/targets/cpp/emit-native-field-view.d.ts +24 -0
- package/dist/targets/cpp/emit-native-field-view.js +87 -8
- package/dist/targets/cpp/emit-properties.js +139 -16
- package/dist/targets/cpp/emit-record-view.js +49 -22
- package/dist/targets/cpp/emit-return.js +5 -1
- package/dist/targets/cpp/emit-tonumber.js +4 -1
- package/dist/targets/cpp/emit-union-properties.js +1 -1
- package/dist/targets/cpp/emit.d.ts +4 -1
- package/dist/targets/cpp/emit.js +148 -6
- package/dist/targets/cpp/reactive-dependencies.js +100 -28
- package/dist/targets/cpp/translation-unit.js +71 -17
- package/dist/targets/cpp/virtual-methods.d.ts +2 -2
- package/dist/targets/cpp/virtual-methods.js +11 -3
- package/package.json +1 -1
- package/src/targets/cpp/runtime/gea_runtime.h +400 -21
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { progress } from '../frontend-timing.js'; // WIP-SOLVER-TIMING: not for commit
|
|
1
2
|
import { callableCompletionSummaryOf } from './flow/callable-completions.js';
|
|
2
3
|
import { relative } from 'node:path';
|
|
3
4
|
import ts from '#typescript';
|
|
@@ -1229,10 +1230,152 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
1229
1230
|
* instance). Without it the answer is identity only -- the global object, a
|
|
1230
1231
|
* standard-library binding, or a local cell some write fills with one.
|
|
1231
1232
|
*/
|
|
1233
|
+
// Defined ahead of every census consumer: `isIntrinsicSurface` asks it while
|
|
1234
|
+
// the alias facts below are still being built.
|
|
1235
|
+
const completionValuesOf = (declaration) => {
|
|
1236
|
+
const summary = callableCompletionSummaryOf(flow, declaration);
|
|
1237
|
+
return summary === null ? [] : [...summary.values, ...summary.yields];
|
|
1238
|
+
};
|
|
1239
|
+
/**
|
|
1240
|
+
* What a call resolved to a source method can complete with: the values of
|
|
1241
|
+
* that body and of every override a class below its declaring class
|
|
1242
|
+
* supplies, since a receiver typed as the declaring class may hold any of
|
|
1243
|
+
* them. An abstract declaration contributes no body: an instance of its own
|
|
1244
|
+
* class misses the lookup and throws before completing. A class whose
|
|
1245
|
+
* `extends` this scan cannot resolve might be a subclass, so it counts. A
|
|
1246
|
+
* write to the slot, a non-method member under the name, or a body whose
|
|
1247
|
+
* completion this census cannot state leaves the answer unknown (`null`).
|
|
1248
|
+
*/
|
|
1249
|
+
const methodCompletionValues = new Map();
|
|
1250
|
+
let programClasses = null;
|
|
1251
|
+
const methodFamilyCompletionValuesOf = (declaration) => {
|
|
1252
|
+
const known = methodCompletionValues.get(declaration);
|
|
1253
|
+
if (known !== undefined)
|
|
1254
|
+
return known;
|
|
1255
|
+
const answer = methodFamilyCompletionValuesUncached(declaration);
|
|
1256
|
+
methodCompletionValues.set(declaration, answer);
|
|
1257
|
+
return answer;
|
|
1258
|
+
};
|
|
1259
|
+
const methodFamilyCompletionValuesUncached = (declaration) => {
|
|
1260
|
+
if ((ts.getCombinedModifierFlags(declaration) & ts.ModifierFlags.Static) !== 0)
|
|
1261
|
+
return null;
|
|
1262
|
+
const owner = declaration.parent;
|
|
1263
|
+
const name = declaration.name;
|
|
1264
|
+
if (!ts.isClassLike(owner) || !(ts.isIdentifier(name) || ts.isPrivateIdentifier(name)))
|
|
1265
|
+
return null;
|
|
1266
|
+
const slot = checker.getSymbolAtLocation(name);
|
|
1267
|
+
if (slot === undefined || flow.writesToSymbol(slot).length > 0)
|
|
1268
|
+
return null;
|
|
1269
|
+
const family = new Set([owner]);
|
|
1270
|
+
const classes = (programClasses ??= nodes.filter((node) => ts.isClassDeclaration(node) || ts.isClassExpression(node)));
|
|
1271
|
+
for (let grew = true; grew;) {
|
|
1272
|
+
grew = false;
|
|
1273
|
+
for (const candidate of classes) {
|
|
1274
|
+
if (family.has(candidate))
|
|
1275
|
+
continue;
|
|
1276
|
+
const heritage = candidate.heritageClauses?.find((clause) => clause.token === ts.SyntaxKind.ExtendsKeyword)?.types[0];
|
|
1277
|
+
if (!heritage)
|
|
1278
|
+
continue;
|
|
1279
|
+
const extended = actualSymbol(checker.getSymbolAtLocation(unwrapErasedExpression(heritage.expression)))?.valueDeclaration;
|
|
1280
|
+
if (extended === undefined || !ts.isClassLike(extended) || family.has(extended)) {
|
|
1281
|
+
family.add(candidate);
|
|
1282
|
+
grew = true;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
const values = [];
|
|
1287
|
+
let implemented = false;
|
|
1288
|
+
for (const member of family) {
|
|
1289
|
+
for (const element of member.members) {
|
|
1290
|
+
if (element.name === undefined || !(ts.isIdentifier(element.name) || ts.isPrivateIdentifier(element.name)))
|
|
1291
|
+
continue;
|
|
1292
|
+
if (element.name.text !== name.text)
|
|
1293
|
+
continue;
|
|
1294
|
+
if (!ts.isMethodDeclaration(element))
|
|
1295
|
+
return null;
|
|
1296
|
+
if ((ts.getCombinedModifierFlags(element) & ts.ModifierFlags.Static) !== 0)
|
|
1297
|
+
continue;
|
|
1298
|
+
if (element.body === undefined)
|
|
1299
|
+
continue;
|
|
1300
|
+
const completed = completionValuesOf(element);
|
|
1301
|
+
if (completed.length === 0)
|
|
1302
|
+
return null;
|
|
1303
|
+
implemented = true;
|
|
1304
|
+
values.push(...completed);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
return implemented ? values : null;
|
|
1308
|
+
};
|
|
1309
|
+
/**
|
|
1310
|
+
* Whether a call always completes with an object this program allocated
|
|
1311
|
+
* itself -- an object or array literal -- read through const-like locals
|
|
1312
|
+
* and further such calls. It asks nothing of the callee's parameters or
|
|
1313
|
+
* receiver: a refused invocation (one whose argument forwarding this census
|
|
1314
|
+
* could not model) can still be known to return a fresh object, which is
|
|
1315
|
+
* neither the global object nor an intrinsic.
|
|
1316
|
+
*/
|
|
1317
|
+
const callReturnsFreshObject = (call, seen) => {
|
|
1318
|
+
if (seen.has(call) || seen.size > 32)
|
|
1319
|
+
return false;
|
|
1320
|
+
seen.add(call);
|
|
1321
|
+
try {
|
|
1322
|
+
return callCompletionsAreFresh(call, seen);
|
|
1323
|
+
}
|
|
1324
|
+
finally {
|
|
1325
|
+
seen.delete(call);
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1328
|
+
const callCompletionsAreFresh = (call, seen) => {
|
|
1329
|
+
const declaration = checker.getResolvedSignature(call)?.declaration;
|
|
1330
|
+
if (declaration === undefined || ts.isJSDocSignature(declaration) || declaration.getSourceFile().isDeclarationFile)
|
|
1331
|
+
return false;
|
|
1332
|
+
let completions = null;
|
|
1333
|
+
if (ts.isMethodDeclaration(declaration))
|
|
1334
|
+
completions = methodFamilyCompletionValuesOf(declaration);
|
|
1335
|
+
else if (ts.isFunctionDeclaration(declaration) && declaration.body !== undefined && declaration.name !== undefined) {
|
|
1336
|
+
// A function's own `return` values are filed under it too; only an
|
|
1337
|
+
// assignment to the binding replaces the function.
|
|
1338
|
+
const written = flow
|
|
1339
|
+
.writesToDeclaration(declaration)
|
|
1340
|
+
.some((write) => write.slot === 'whole' &&
|
|
1341
|
+
(write.edge === 'identifier-assignment' || write.edge === 'compound-assignment' || write.edge === 'logical-assignment'));
|
|
1342
|
+
const symbol = checker.getSymbolAtLocation(declaration.name);
|
|
1343
|
+
if (!written && symbol !== undefined && (symbol.declarations?.length ?? 0) === 1)
|
|
1344
|
+
completions = completionValuesOf(declaration);
|
|
1345
|
+
}
|
|
1346
|
+
return completions !== null && completions.length > 0 && completions.every((value) => valueIsFreshObject(value, seen));
|
|
1347
|
+
};
|
|
1348
|
+
const valueIsFreshObject = (expression, seen) => {
|
|
1349
|
+
const current = unwrapErasedExpression(expression);
|
|
1350
|
+
if (ts.isObjectLiteralExpression(current) || ts.isArrayLiteralExpression(current))
|
|
1351
|
+
return true;
|
|
1352
|
+
if (ts.isConditionalExpression(current))
|
|
1353
|
+
return valueIsFreshObject(current.whenTrue, seen) && valueIsFreshObject(current.whenFalse, seen);
|
|
1354
|
+
if (ts.isCallExpression(current))
|
|
1355
|
+
return callReturnsFreshObject(current, seen);
|
|
1356
|
+
if (!ts.isIdentifier(current))
|
|
1357
|
+
return false;
|
|
1358
|
+
const binding = bindingOf(current);
|
|
1359
|
+
if (binding === null || !ts.isVariableDeclaration(binding) || seen.has(binding))
|
|
1360
|
+
return false;
|
|
1361
|
+
seen.add(binding);
|
|
1362
|
+
try {
|
|
1363
|
+
const writes = flow.writesToDeclaration(binding).filter((write) => write.slot === 'whole');
|
|
1364
|
+
return writes.length > 0 && writes.every((write) => write.value !== null && valueIsFreshObject(write.value, seen));
|
|
1365
|
+
}
|
|
1366
|
+
finally {
|
|
1367
|
+
seen.delete(binding);
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1232
1370
|
const isIntrinsicSurface = (expression, seen = new Set(), byType = true) => {
|
|
1233
1371
|
const current = unwrapErasedExpression(expression);
|
|
1234
1372
|
if (hasFreshLiteralIdentity(current))
|
|
1235
1373
|
return false;
|
|
1374
|
+
// A value that is always the program's own fresh allocation (a literal,
|
|
1375
|
+
// read through locals and calls whose every runnable body returns one) is
|
|
1376
|
+
// that allocation, whatever intrinsic its declared type admits.
|
|
1377
|
+
if (valueIsFreshObject(current, new Set()))
|
|
1378
|
+
return false;
|
|
1236
1379
|
if (isProvenGlobalObject(current) ||
|
|
1237
1380
|
(byType &&
|
|
1238
1381
|
(nativeResult(checker.getTypeAtLocation(current), current) || mayBeAuthenticatedNativeSurface(checker.getTypeAtLocation(current))))) {
|
|
@@ -2085,7 +2228,11 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2085
2228
|
// backs it, so it carries no publication dependency -- and must still
|
|
2086
2229
|
// go through the same memo the rest of this function writes, or the
|
|
2087
2230
|
// dependency solver below never sees it as grounded and discards it.
|
|
2088
|
-
|
|
2231
|
+
//
|
|
2232
|
+
// A result type an intrinsic could inhabit (`Document`) still publishes
|
|
2233
|
+
// `object` when every body the call can run returns a fresh allocation
|
|
2234
|
+
// of its own (`callReturnsFreshObject`), which reads no parameter.
|
|
2235
|
+
const result = publishedTypeRepresentation(publishedTypeAt(current), current) ?? (callReturnsFreshObject(current, new Set()) ? 'object' : null);
|
|
2089
2236
|
publishedRepresentations.set(current, result);
|
|
2090
2237
|
return result;
|
|
2091
2238
|
}
|
|
@@ -2814,7 +2961,12 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2814
2961
|
// so they do leave the call incomplete. Delete this exception together with
|
|
2815
2962
|
// that walk, once the shared layout grows per-binding-element slots.
|
|
2816
2963
|
const frameForwardingIsModelled = (frame) => frame.forwarding.kind === 'values' || frame.forwarding.reason === 'destructured-parameter';
|
|
2964
|
+
let wipSites = 0; // WIP-SOLVER-TIMING
|
|
2965
|
+
let wipClosedMs = 0;
|
|
2966
|
+
let wipSlowest = 0;
|
|
2817
2967
|
for (const site of reachableFlowCalls) {
|
|
2968
|
+
if (++wipSites % 500 === 0)
|
|
2969
|
+
progress(`host-mutations call sites ${wipSites}/${reachableFlowCalls.length}, closedCalleeBodiesOf ${(wipClosedMs / 1000).toFixed(1)}s, slowest ${(wipSlowest / 1000).toFixed(1)}s`);
|
|
2818
2970
|
const explicitDeclaration = site.explicitThis ? flow.targetOf(site.explicitThis.callee)?.declaration : null;
|
|
2819
2971
|
const staticDeclaration = explicitDeclaration && ts.isFunctionLike(explicitDeclaration)
|
|
2820
2972
|
? explicitDeclaration
|
|
@@ -2932,7 +3084,16 @@ staticCommonJsRequireOutcomeOf = () => null, trustSeed = initialCensusSeed) => {
|
|
|
2932
3084
|
// authority, which knows about the escape, so `sink( receiver );
|
|
2933
3085
|
// receiver.run( globalThis )` was admitted as running only program bodies
|
|
2934
3086
|
// and never asked whether it hands the global object to an open callee.
|
|
3087
|
+
if (wipSites >= Number(process.env['GEA_WIP_TRACE_FROM'] ?? Infinity)) {
|
|
3088
|
+
const wipFile = site.call.getSourceFile();
|
|
3089
|
+
progress(`host-mutations site ${wipSites} ${wipFile.fileName.split('/').pop()}:${wipFile.getLineAndCharacterOfPosition(site.call.getStart(wipFile)).line + 1} ${site.call.getText(wipFile).replace(/\s+/g, ' ').slice(0, 100)}`);
|
|
3090
|
+
}
|
|
3091
|
+
const wipAt = performance.now();
|
|
2935
3092
|
const closedBodies = callableFrames.closedCalleeBodiesOf?.(site.call) ?? null;
|
|
3093
|
+
const wipTook = performance.now() - wipAt;
|
|
3094
|
+
wipClosedMs += wipTook;
|
|
3095
|
+
if (wipTook > wipSlowest)
|
|
3096
|
+
wipSlowest = wipTook;
|
|
2936
3097
|
const allocationProven = process.env['GEA_NO_ALLOCATION_PROVEN'] !== '1' &&
|
|
2937
3098
|
closedBodies !== null &&
|
|
2938
3099
|
closedBodies.length > 0 &&
|
|
@@ -3756,6 +3756,14 @@ hostProvided = noHostProvidedNames) => {
|
|
|
3756
3756
|
publishing.reset();
|
|
3757
3757
|
/** Answers for `statedTypeAt`, settled once the fixpoint above has stopped. */
|
|
3758
3758
|
const statedTypes = new NullableMemo();
|
|
3759
|
+
const refusedParameterCell = (node) => {
|
|
3760
|
+
if (ts.isParameter(node))
|
|
3761
|
+
return lastRefusal.has(node);
|
|
3762
|
+
if (!ts.isIdentifier(node))
|
|
3763
|
+
return false;
|
|
3764
|
+
const parameter = checker.getSymbolAtLocation(node)?.declarations?.find(ts.isParameter);
|
|
3765
|
+
return parameter !== undefined && lastRefusal.has(parameter);
|
|
3766
|
+
};
|
|
3759
3767
|
const computeStatedTypeAt = (node) => {
|
|
3760
3768
|
// A PRIOR ROUND's stated narrowings are forwarded, the same way `known`
|
|
3761
3769
|
// above forwards `upstream.typeAt`: round two exists precisely so a
|
|
@@ -3778,7 +3786,14 @@ hostProvided = noHostProvidedNames) => {
|
|
|
3778
3786
|
finally {
|
|
3779
3787
|
inheritedStatedLookups.depth--;
|
|
3780
3788
|
}
|
|
3781
|
-
|
|
3789
|
+
// ...except a parameter this round re-decided and refused. A prior round
|
|
3790
|
+
// bound it from a smaller view (a field it reads was not yet widened to
|
|
3791
|
+
// `any`, say), and this round's refusal is the settled fact: `typeAt`,
|
|
3792
|
+
// which the ABI slot reads (`structural-parts.ts`'s `parameterOf`),
|
|
3793
|
+
// answers only this round's bindings, so forwarding the stale narrowing
|
|
3794
|
+
// to the body alone splits the cell into "parameter N is bound as
|
|
3795
|
+
// `array-object(string)` but the ABI declares `array-object(dynamic)`".
|
|
3796
|
+
if (inherited && !(lastRefusal.size !== 0 && refusedParameterCell(node)))
|
|
3782
3797
|
return inherited;
|
|
3783
3798
|
if (ts.isParameter(node))
|
|
3784
3799
|
return statedBindings.size === 0 ? null : (statedBindings.get(node) ?? null);
|
|
@@ -710,7 +710,8 @@ export const createClassLifecycleProducer = (context) => {
|
|
|
710
710
|
allocates: true,
|
|
711
711
|
callsUserCode: false
|
|
712
712
|
});
|
|
713
|
-
|
|
713
|
+
const abstractMember = node.body === undefined && (ts.getModifiers(node)?.some((modifier) => modifier.kind === ts.SyntaxKind.AbstractKeyword) ?? false);
|
|
714
|
+
operations.push(abstractMember ? { ...defineOperation, abstractMember: true } : defineOperation);
|
|
714
715
|
if (methodValue)
|
|
715
716
|
edges.push({ kind: 'value', result: methodValue.id, to: defineId, role: 'method', ordinal: 0 });
|
|
716
717
|
if (keySource) {
|
|
@@ -16,17 +16,22 @@ import ts from '#typescript';
|
|
|
16
16
|
* silent -- so there is one, and it is the only one.
|
|
17
17
|
*/
|
|
18
18
|
export const unwrapErased = (node) => {
|
|
19
|
+
// One switch on the kind rather than five `ts.is*` calls: the value-flow
|
|
20
|
+
// solver unwraps every expression it interns, hundreds of millions of times
|
|
21
|
+
// on a large program, and almost none of them are wrapped.
|
|
19
22
|
let current = node;
|
|
20
23
|
for (;;) {
|
|
21
|
-
|
|
22
|
-
ts.
|
|
23
|
-
ts.
|
|
24
|
-
ts.
|
|
25
|
-
ts.
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
switch (current.kind) {
|
|
25
|
+
case ts.SyntaxKind.ParenthesizedExpression:
|
|
26
|
+
case ts.SyntaxKind.NonNullExpression:
|
|
27
|
+
case ts.SyntaxKind.AsExpression:
|
|
28
|
+
case ts.SyntaxKind.SatisfiesExpression:
|
|
29
|
+
case ts.SyntaxKind.TypeAssertionExpression:
|
|
30
|
+
current = current.expression;
|
|
31
|
+
continue;
|
|
32
|
+
default:
|
|
33
|
+
return current;
|
|
28
34
|
}
|
|
29
|
-
return current;
|
|
30
35
|
}
|
|
31
36
|
};
|
|
32
37
|
/** The same rule where the caller already knows it holds an expression. */
|
|
@@ -27,9 +27,10 @@ export type DeclarerReader = (filePath: string) => string;
|
|
|
27
27
|
/**
|
|
28
28
|
* The overlay, reading declarers through `read` -- see `DeclarerReader`.
|
|
29
29
|
* `compiler.ts` builds one per compilation with that compilation's plugin
|
|
30
|
-
* transforms; a caller with no plugins may pass `readFileSync`
|
|
30
|
+
* transforms and root files; a caller with no plugins may pass `readFileSync`
|
|
31
|
+
* itself. Without `roots`, the file being transformed stands for the program.
|
|
31
32
|
*/
|
|
32
|
-
export declare const createSubclassMemberOverlayTransform: (read: DeclarerReader) => (input: {
|
|
33
|
+
export declare const createSubclassMemberOverlayTransform: (read: DeclarerReader, roots?: readonly string[]) => (input: {
|
|
33
34
|
readonly fileName: string;
|
|
34
35
|
readonly text: string;
|
|
35
36
|
}) => string | null;
|