@suss/adapter-typescript 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +307 -189
- package/dist/index.js +308 -185
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -63,7 +63,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
63
63
|
|
|
64
64
|
// src/adapter.ts
|
|
65
65
|
var import_node_path9 = __toESM(require("path"), 1);
|
|
66
|
-
var
|
|
66
|
+
var import_ts_morph56 = require("ts-morph");
|
|
67
67
|
var import_behavioral_ir6 = require("@suss/behavioral-ir");
|
|
68
68
|
var import_datalog6 = require("@suss/datalog");
|
|
69
69
|
var import_extractor5 = require("@suss/extractor");
|
|
@@ -10066,11 +10066,12 @@ var import_ts_morph50 = require("ts-morph");
|
|
|
10066
10066
|
var import_datalog2 = require("@suss/datalog");
|
|
10067
10067
|
var import_resolution = require("@suss/resolution");
|
|
10068
10068
|
var JS_RULES = [
|
|
10069
|
-
// f.bind(...)
|
|
10069
|
+
// f.bind(...) leads wherever f leads. Stated as a step, so the
|
|
10070
|
+
// questions other than `comesTo` follow it too.
|
|
10070
10071
|
(0, import_datalog2.rule)(
|
|
10071
|
-
"
|
|
10072
|
-
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("
|
|
10073
|
-
[(0, import_datalog2.lit)("bindCall", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("t"))
|
|
10072
|
+
"stepsTo",
|
|
10073
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("t"), import_resolution.VALUE_STEP],
|
|
10074
|
+
[(0, import_datalog2.lit)("bindCall", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("t"))]
|
|
10074
10075
|
)
|
|
10075
10076
|
];
|
|
10076
10077
|
var RESOLUTION_PROGRAM = process.env.SUSS_RESOLUTION_ON_DEMAND === "0" ? {
|
|
@@ -10539,7 +10540,10 @@ function bindingLabel(binding) {
|
|
|
10539
10540
|
if (semantics.name === "graphql-operation") {
|
|
10540
10541
|
return `${semantics.operationType} ${semantics.operationName ?? ""}`.trim();
|
|
10541
10542
|
}
|
|
10542
|
-
|
|
10543
|
+
if ("exportName" in semantics || "module" in semantics) {
|
|
10544
|
+
return semantics.exportName ?? semantics.module ?? binding.recognition;
|
|
10545
|
+
}
|
|
10546
|
+
return binding.recognition;
|
|
10543
10547
|
}
|
|
10544
10548
|
function effectFact(effect) {
|
|
10545
10549
|
if (effect.type === "invocation") {
|
|
@@ -10611,10 +10615,100 @@ function deriveBoundaryEffects(summaries, facts) {
|
|
|
10611
10615
|
}
|
|
10612
10616
|
|
|
10613
10617
|
// src/resolve/reachableClosure.ts
|
|
10614
|
-
var
|
|
10618
|
+
var import_ts_morph52 = require("ts-morph");
|
|
10615
10619
|
var import_behavioral_ir4 = require("@suss/behavioral-ir");
|
|
10616
10620
|
var import_datalog4 = require("@suss/datalog");
|
|
10617
10621
|
var import_extractor4 = require("@suss/extractor");
|
|
10622
|
+
|
|
10623
|
+
// src/resolve/unfollowedCall.ts
|
|
10624
|
+
var import_ts_morph51 = require("ts-morph");
|
|
10625
|
+
function isInExternalCode(sourceFile) {
|
|
10626
|
+
if (sourceFile.isDeclarationFile()) {
|
|
10627
|
+
return true;
|
|
10628
|
+
}
|
|
10629
|
+
return sourceFile.getFilePath().includes("/node_modules/");
|
|
10630
|
+
}
|
|
10631
|
+
function hasBody(fn) {
|
|
10632
|
+
if (import_ts_morph51.Node.isFunctionDeclaration(fn) || import_ts_morph51.Node.isMethodDeclaration(fn) || import_ts_morph51.Node.isFunctionExpression(fn)) {
|
|
10633
|
+
return fn.getBody?.() !== void 0;
|
|
10634
|
+
}
|
|
10635
|
+
return true;
|
|
10636
|
+
}
|
|
10637
|
+
function isDeclaredShape(declaration) {
|
|
10638
|
+
return (import_ts_morph51.Node.isMethodSignature(declaration) || import_ts_morph51.Node.isPropertySignature(declaration)) && !isInExternalCode(declaration.getSourceFile());
|
|
10639
|
+
}
|
|
10640
|
+
function isExternalDeclaration(declaration) {
|
|
10641
|
+
if (isInExternalCode(declaration.getSourceFile())) {
|
|
10642
|
+
return true;
|
|
10643
|
+
}
|
|
10644
|
+
if (import_ts_morph51.Node.isImportSpecifier(declaration) || import_ts_morph51.Node.isImportClause(declaration) || import_ts_morph51.Node.isNamespaceImport(declaration)) {
|
|
10645
|
+
const target = declaration.getFirstAncestorByKind(import_ts_morph51.SyntaxKind.ImportDeclaration)?.getModuleSpecifierSourceFile();
|
|
10646
|
+
return target === void 0 || isInExternalCode(target);
|
|
10647
|
+
}
|
|
10648
|
+
return declaresAnotherModule(declaration);
|
|
10649
|
+
}
|
|
10650
|
+
function declaresAnotherModule(declaration) {
|
|
10651
|
+
const module2 = declaration.getFirstAncestorByKind(
|
|
10652
|
+
import_ts_morph51.SyntaxKind.ModuleDeclaration
|
|
10653
|
+
);
|
|
10654
|
+
return module2 !== void 0 && import_ts_morph51.Node.isStringLiteral(module2.getNameNode());
|
|
10655
|
+
}
|
|
10656
|
+
function statesShapeOnly(declaration) {
|
|
10657
|
+
if (isExternalDeclaration(declaration)) {
|
|
10658
|
+
return false;
|
|
10659
|
+
}
|
|
10660
|
+
if (import_ts_morph51.Node.isMethodSignature(declaration) || import_ts_morph51.Node.isPropertySignature(declaration)) {
|
|
10661
|
+
return true;
|
|
10662
|
+
}
|
|
10663
|
+
if (import_ts_morph51.Node.isFunctionDeclaration(declaration) || import_ts_morph51.Node.isMethodDeclaration(declaration)) {
|
|
10664
|
+
return declaration.getBody() === void 0;
|
|
10665
|
+
}
|
|
10666
|
+
return false;
|
|
10667
|
+
}
|
|
10668
|
+
function declarationsBehind(symbol) {
|
|
10669
|
+
if (symbol === void 0) {
|
|
10670
|
+
return [];
|
|
10671
|
+
}
|
|
10672
|
+
const behind = symbol.getAliasedSymbol()?.getDeclarations() ?? [];
|
|
10673
|
+
return behind.length > 0 ? behind : symbol.getDeclarations();
|
|
10674
|
+
}
|
|
10675
|
+
function classifyStop(declarations) {
|
|
10676
|
+
if (declarations.length === 0) {
|
|
10677
|
+
return "noDeclaration";
|
|
10678
|
+
}
|
|
10679
|
+
if (declarations.every(isExternalDeclaration)) {
|
|
10680
|
+
return "outsideRun";
|
|
10681
|
+
}
|
|
10682
|
+
if (declarations.some(statesShapeOnly)) {
|
|
10683
|
+
return "noBody";
|
|
10684
|
+
}
|
|
10685
|
+
return "unsettledValue";
|
|
10686
|
+
}
|
|
10687
|
+
var RECORDED = {
|
|
10688
|
+
noBody: true,
|
|
10689
|
+
unsettledValue: true,
|
|
10690
|
+
outsideRun: false,
|
|
10691
|
+
noDeclaration: false
|
|
10692
|
+
};
|
|
10693
|
+
function worthRecording(reason) {
|
|
10694
|
+
return RECORDED[reason];
|
|
10695
|
+
}
|
|
10696
|
+
var STOP_SENTENCE = {
|
|
10697
|
+
noBody: (callee) => `The call to ${callee} lands on a declaration with no body, so whatever runs there is missing from this summary`,
|
|
10698
|
+
unsettledValue: (callee) => `The call to ${callee} goes through a value this run could not settle, so whatever runs there is missing from this summary`,
|
|
10699
|
+
outsideRun: (callee) => `The call to ${callee} lands in a package whose source is not in this run, so whatever runs there is missing from this summary`,
|
|
10700
|
+
noDeclaration: (callee) => `The call to ${callee} has no declaration this run could find, so whatever runs there is missing from this summary`
|
|
10701
|
+
};
|
|
10702
|
+
function unfollowedCallGap(stop) {
|
|
10703
|
+
return {
|
|
10704
|
+
type: "unfollowedCall",
|
|
10705
|
+
conditions: [],
|
|
10706
|
+
consequence: "unknown",
|
|
10707
|
+
description: STOP_SENTENCE[stop.reason](stop.callee)
|
|
10708
|
+
};
|
|
10709
|
+
}
|
|
10710
|
+
|
|
10711
|
+
// src/resolve/reachableClosure.ts
|
|
10618
10712
|
var reachablePack = {
|
|
10619
10713
|
name: "reachable",
|
|
10620
10714
|
languages: ["typescript"],
|
|
@@ -10637,23 +10731,6 @@ function nodeKey2(func) {
|
|
|
10637
10731
|
const sf = func.getSourceFile();
|
|
10638
10732
|
return `${sf.getFilePath()}:${func.getStart()}-${func.getEnd()}`;
|
|
10639
10733
|
}
|
|
10640
|
-
function isInExternalCode(sourceFile) {
|
|
10641
|
-
if (sourceFile.isDeclarationFile()) {
|
|
10642
|
-
return true;
|
|
10643
|
-
}
|
|
10644
|
-
const filePath = sourceFile.getFilePath();
|
|
10645
|
-
if (filePath.includes("/node_modules/")) {
|
|
10646
|
-
return true;
|
|
10647
|
-
}
|
|
10648
|
-
return false;
|
|
10649
|
-
}
|
|
10650
|
-
function hasBody(fn) {
|
|
10651
|
-
if (import_ts_morph51.Node.isFunctionDeclaration(fn) || import_ts_morph51.Node.isMethodDeclaration(fn) || import_ts_morph51.Node.isFunctionExpression(fn)) {
|
|
10652
|
-
const body = fn.getBody?.();
|
|
10653
|
-
return body !== void 0;
|
|
10654
|
-
}
|
|
10655
|
-
return true;
|
|
10656
|
-
}
|
|
10657
10734
|
function resolveDecl(decl, calleeName) {
|
|
10658
10735
|
if (isInExternalCode(decl.getSourceFile())) {
|
|
10659
10736
|
return null;
|
|
@@ -10665,14 +10742,14 @@ function resolveDecl(decl, calleeName) {
|
|
|
10665
10742
|
}
|
|
10666
10743
|
return { func: fn, name: declName(decl) ?? calleeName };
|
|
10667
10744
|
}
|
|
10668
|
-
if (
|
|
10745
|
+
if (import_ts_morph52.Node.isVariableDeclaration(decl)) {
|
|
10669
10746
|
const init = decl.getInitializer();
|
|
10670
|
-
if (init !== void 0 && (
|
|
10747
|
+
if (init !== void 0 && (import_ts_morph52.Node.isArrowFunction(init) || import_ts_morph52.Node.isFunctionExpression(init))) {
|
|
10671
10748
|
return { func: init, name: decl.getName() };
|
|
10672
10749
|
}
|
|
10673
10750
|
return null;
|
|
10674
10751
|
}
|
|
10675
|
-
if (
|
|
10752
|
+
if (import_ts_morph52.Node.isImportSpecifier(decl)) {
|
|
10676
10753
|
const importDecl = decl.getImportDeclaration();
|
|
10677
10754
|
const sf = importDecl.getModuleSpecifierSourceFile();
|
|
10678
10755
|
if (sf === void 0 || isInExternalCode(sf)) {
|
|
@@ -10693,78 +10770,85 @@ function resolveDecl(decl, calleeName) {
|
|
|
10693
10770
|
return null;
|
|
10694
10771
|
}
|
|
10695
10772
|
function declName(decl) {
|
|
10696
|
-
if (
|
|
10773
|
+
if (import_ts_morph52.Node.isFunctionDeclaration(decl) || import_ts_morph52.Node.isMethodDeclaration(decl)) {
|
|
10697
10774
|
const n = decl.getName?.();
|
|
10698
10775
|
if (typeof n === "string" && n.length > 0) {
|
|
10699
10776
|
return n;
|
|
10700
10777
|
}
|
|
10701
10778
|
}
|
|
10702
|
-
if (
|
|
10779
|
+
if (import_ts_morph52.Node.isFunctionExpression(decl)) {
|
|
10703
10780
|
const n = decl.getName();
|
|
10704
10781
|
if (typeof n === "string" && n.length > 0) {
|
|
10705
10782
|
return n;
|
|
10706
10783
|
}
|
|
10707
10784
|
}
|
|
10708
10785
|
const parent = decl.getParent();
|
|
10709
|
-
if (parent !== void 0 &&
|
|
10786
|
+
if (parent !== void 0 && import_ts_morph52.Node.isVariableDeclaration(parent)) {
|
|
10710
10787
|
return parent.getName();
|
|
10711
10788
|
}
|
|
10712
10789
|
return null;
|
|
10713
10790
|
}
|
|
10714
10791
|
function resolveCallee(call, calleeName, scan) {
|
|
10715
|
-
if (!
|
|
10792
|
+
if (!import_ts_morph52.Node.isCallExpression(call)) {
|
|
10716
10793
|
return null;
|
|
10717
10794
|
}
|
|
10718
10795
|
const callee = call.getExpression();
|
|
10719
|
-
const
|
|
10796
|
+
const symbol = callee.getSymbol();
|
|
10797
|
+
const declarations = symbol?.getDeclarations() ?? [];
|
|
10720
10798
|
for (const decl of declarations) {
|
|
10721
10799
|
const resolved = resolveDecl(decl, calleeName);
|
|
10722
10800
|
if (resolved !== null) {
|
|
10723
|
-
return resolved;
|
|
10801
|
+
return { kind: "followed", candidate: resolved };
|
|
10724
10802
|
}
|
|
10725
10803
|
}
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
return value === null ? null : resolveDecl(value, calleeName);
|
|
10734
|
-
}
|
|
10735
|
-
function readsAField(callee) {
|
|
10736
|
-
if (!import_ts_morph51.Node.isPropertyAccessExpression(callee)) {
|
|
10737
|
-
return false;
|
|
10738
|
-
}
|
|
10739
|
-
let receiver = callee.getExpression();
|
|
10740
|
-
while (import_ts_morph51.Node.isPropertyAccessExpression(receiver)) {
|
|
10741
|
-
receiver = receiver.getExpression();
|
|
10804
|
+
const resolveCallable = scan.resolveCallable;
|
|
10805
|
+
if (resolveCallable !== void 0 && import_ts_morph52.Node.isPropertyAccessExpression(callee) && declarations.some(isDeclaredShape)) {
|
|
10806
|
+
const value = resolveCallable(callee, scan.reachedFrom);
|
|
10807
|
+
const resolved = value === null ? null : resolveDecl(value, calleeName);
|
|
10808
|
+
if (resolved !== null) {
|
|
10809
|
+
return { kind: "followed", candidate: resolved };
|
|
10810
|
+
}
|
|
10742
10811
|
}
|
|
10743
|
-
return
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10812
|
+
return {
|
|
10813
|
+
kind: "stopped",
|
|
10814
|
+
stop: {
|
|
10815
|
+
callee: calleeName,
|
|
10816
|
+
reason: classifyStop(declarationsBehind(symbol))
|
|
10817
|
+
}
|
|
10818
|
+
};
|
|
10747
10819
|
}
|
|
10748
10820
|
function collectReachable(func, scan) {
|
|
10749
|
-
const
|
|
10821
|
+
const candidates = [];
|
|
10822
|
+
const stops = [];
|
|
10750
10823
|
const seen = /* @__PURE__ */ new Set();
|
|
10751
10824
|
func.forEachDescendant((node) => {
|
|
10752
|
-
if (!
|
|
10825
|
+
if (!import_ts_morph52.Node.isCallExpression(node)) {
|
|
10753
10826
|
return;
|
|
10754
10827
|
}
|
|
10755
|
-
const calleeText = node.getExpression().getText();
|
|
10756
|
-
const
|
|
10757
|
-
if (
|
|
10828
|
+
const calleeText = normalizeCallee(node.getExpression().getText());
|
|
10829
|
+
const outcome = resolveCallee(node, calleeText, scan);
|
|
10830
|
+
if (outcome === null) {
|
|
10758
10831
|
return;
|
|
10759
10832
|
}
|
|
10760
|
-
|
|
10833
|
+
if (outcome.kind === "stopped") {
|
|
10834
|
+
const stopKey = `${outcome.stop.reason}:${outcome.stop.callee}`;
|
|
10835
|
+
if (!seen.has(stopKey) && worthRecording(outcome.stop.reason)) {
|
|
10836
|
+
seen.add(stopKey);
|
|
10837
|
+
stops.push(outcome.stop);
|
|
10838
|
+
}
|
|
10839
|
+
return;
|
|
10840
|
+
}
|
|
10841
|
+
const key = nodeKey2(outcome.candidate.func);
|
|
10761
10842
|
if (seen.has(key)) {
|
|
10762
10843
|
return;
|
|
10763
10844
|
}
|
|
10764
10845
|
seen.add(key);
|
|
10765
|
-
|
|
10846
|
+
candidates.push(outcome.candidate);
|
|
10766
10847
|
});
|
|
10767
|
-
return
|
|
10848
|
+
return { candidates, stops };
|
|
10849
|
+
}
|
|
10850
|
+
function normalizeCallee(text) {
|
|
10851
|
+
return text.replace(/\s+/g, " ").trim();
|
|
10768
10852
|
}
|
|
10769
10853
|
function extractReachableSummary(candidate, options, recognizers) {
|
|
10770
10854
|
const unit = {
|
|
@@ -10804,6 +10888,8 @@ function expandReachableClosure(seeds, project, options, projectFileSet, facts,
|
|
|
10804
10888
|
const functionByKey = /* @__PURE__ */ new Map();
|
|
10805
10889
|
const seedKeys = /* @__PURE__ */ new Set();
|
|
10806
10890
|
const scanned = /* @__PURE__ */ new Set();
|
|
10891
|
+
const stopsByKey = /* @__PURE__ */ new Map();
|
|
10892
|
+
const summariesByKey = /* @__PURE__ */ new Map();
|
|
10807
10893
|
const reachedFrom = /* @__PURE__ */ new Map();
|
|
10808
10894
|
for (const seed of seeds) {
|
|
10809
10895
|
const func = lookup.functionAt(seed.location);
|
|
@@ -10812,6 +10898,7 @@ function expandReachableClosure(seeds, project, options, projectFileSet, facts,
|
|
|
10812
10898
|
seedKeys.add(key);
|
|
10813
10899
|
functionByKey.set(key, { func, name: seed.identity.name });
|
|
10814
10900
|
facts?.unitKeyBySummary.set(seed, key);
|
|
10901
|
+
rememberSummary(summariesByKey, key, seed);
|
|
10815
10902
|
db.add("entry", [key]);
|
|
10816
10903
|
}
|
|
10817
10904
|
}
|
|
@@ -10832,7 +10919,11 @@ function expandReachableClosure(seeds, project, options, projectFileSet, facts,
|
|
|
10832
10919
|
...recognizers.resolveCallable === void 0 ? {} : { resolveCallable: recognizers.resolveCallable },
|
|
10833
10920
|
...cameFrom === void 0 ? {} : { reachedFrom: cameFrom }
|
|
10834
10921
|
};
|
|
10835
|
-
|
|
10922
|
+
const { candidates, stops } = collectReachable(source.func, scan);
|
|
10923
|
+
if (stops.length > 0) {
|
|
10924
|
+
stopsByKey.set(key, stops);
|
|
10925
|
+
}
|
|
10926
|
+
for (const candidate of candidates) {
|
|
10836
10927
|
const calleeKey = nodeKey2(candidate.func);
|
|
10837
10928
|
if (!functionByKey.has(calleeKey)) {
|
|
10838
10929
|
functionByKey.set(calleeKey, candidate);
|
|
@@ -10863,13 +10954,30 @@ function expandReachableClosure(seeds, project, options, projectFileSet, facts,
|
|
|
10863
10954
|
}
|
|
10864
10955
|
const summary = extractReachableSummary(candidate, options, recognizers);
|
|
10865
10956
|
facts?.unitKeyBySummary.set(summary, key);
|
|
10957
|
+
rememberSummary(summariesByKey, key, summary);
|
|
10866
10958
|
reached.push(summary);
|
|
10867
10959
|
}
|
|
10960
|
+
recordStops(stopsByKey, summariesByKey, options);
|
|
10868
10961
|
return [...seeds, ...reached];
|
|
10869
10962
|
}
|
|
10963
|
+
function rememberSummary(summariesByKey, key, summary) {
|
|
10964
|
+
const bucket = summariesByKey.get(key) ?? [];
|
|
10965
|
+
bucket.push(summary);
|
|
10966
|
+
summariesByKey.set(key, bucket);
|
|
10967
|
+
}
|
|
10968
|
+
function recordStops(stopsByKey, summariesByKey, options) {
|
|
10969
|
+
if (options?.gapHandling === "silent") {
|
|
10970
|
+
return;
|
|
10971
|
+
}
|
|
10972
|
+
for (const [key, stops] of stopsByKey) {
|
|
10973
|
+
for (const summary of summariesByKey.get(key) ?? []) {
|
|
10974
|
+
summary.gaps.push(...stops.map(unfollowedCallGap));
|
|
10975
|
+
}
|
|
10976
|
+
}
|
|
10977
|
+
}
|
|
10870
10978
|
|
|
10871
10979
|
// src/resolve/rethrowEnrichment.ts
|
|
10872
|
-
var
|
|
10980
|
+
var import_ts_morph53 = require("ts-morph");
|
|
10873
10981
|
var import_datalog5 = require("@suss/datalog");
|
|
10874
10982
|
var RETHROW_RULES = [
|
|
10875
10983
|
(0, import_datalog5.rule)(
|
|
@@ -11009,7 +11117,7 @@ function findBareRethrow(func, location) {
|
|
|
11009
11117
|
traversal.stop();
|
|
11010
11118
|
return;
|
|
11011
11119
|
}
|
|
11012
|
-
if (!
|
|
11120
|
+
if (!import_ts_morph53.Node.isThrowStatement(node)) {
|
|
11013
11121
|
return;
|
|
11014
11122
|
}
|
|
11015
11123
|
if (startLineOf(node) !== location.start) {
|
|
@@ -11019,7 +11127,7 @@ function findBareRethrow(func, location) {
|
|
|
11019
11127
|
return;
|
|
11020
11128
|
}
|
|
11021
11129
|
const thrown = node.getExpression();
|
|
11022
|
-
if (thrown !== void 0 &&
|
|
11130
|
+
if (thrown !== void 0 && import_ts_morph53.Node.isIdentifier(thrown)) {
|
|
11023
11131
|
found = node;
|
|
11024
11132
|
}
|
|
11025
11133
|
});
|
|
@@ -11029,13 +11137,13 @@ function enclosingTry(throwStmt) {
|
|
|
11029
11137
|
let current2 = throwStmt.getParent();
|
|
11030
11138
|
let sawCatchClause = false;
|
|
11031
11139
|
while (current2 !== void 0) {
|
|
11032
|
-
if (
|
|
11140
|
+
if (import_ts_morph53.Node.isCatchClause(current2)) {
|
|
11033
11141
|
sawCatchClause = true;
|
|
11034
11142
|
}
|
|
11035
|
-
if (
|
|
11143
|
+
if (import_ts_morph53.Node.isTryStatement(current2)) {
|
|
11036
11144
|
return sawCatchClause ? current2 : null;
|
|
11037
11145
|
}
|
|
11038
|
-
if (
|
|
11146
|
+
if (import_ts_morph53.Node.isFunctionDeclaration(current2) || import_ts_morph53.Node.isFunctionExpression(current2) || import_ts_morph53.Node.isArrowFunction(current2) || import_ts_morph53.Node.isMethodDeclaration(current2)) {
|
|
11039
11147
|
return null;
|
|
11040
11148
|
}
|
|
11041
11149
|
current2 = current2.getParent();
|
|
@@ -11043,14 +11151,14 @@ function enclosingTry(throwStmt) {
|
|
|
11043
11151
|
return null;
|
|
11044
11152
|
}
|
|
11045
11153
|
function collectTryBodyCallees(tryStmt, index, keyFor) {
|
|
11046
|
-
if (!
|
|
11154
|
+
if (!import_ts_morph53.Node.isTryStatement(tryStmt)) {
|
|
11047
11155
|
return [];
|
|
11048
11156
|
}
|
|
11049
11157
|
const tryBlock = tryStmt.getTryBlock();
|
|
11050
11158
|
const callees = [];
|
|
11051
11159
|
const seen = /* @__PURE__ */ new Set();
|
|
11052
11160
|
tryBlock.forEachDescendant((node) => {
|
|
11053
|
-
if (!
|
|
11161
|
+
if (!import_ts_morph53.Node.isCallExpression(node)) {
|
|
11054
11162
|
return;
|
|
11055
11163
|
}
|
|
11056
11164
|
const calleeSummary = resolveCalleeSummary(node, index);
|
|
@@ -11067,7 +11175,7 @@ function collectTryBodyCallees(tryStmt, index, keyFor) {
|
|
|
11067
11175
|
return callees;
|
|
11068
11176
|
}
|
|
11069
11177
|
function resolveCalleeSummary(call, index) {
|
|
11070
|
-
if (!
|
|
11178
|
+
if (!import_ts_morph53.Node.isCallExpression(call)) {
|
|
11071
11179
|
return null;
|
|
11072
11180
|
}
|
|
11073
11181
|
const callee = call.getExpression();
|
|
@@ -11093,12 +11201,12 @@ function resolveCalleeSummary(call, index) {
|
|
|
11093
11201
|
return null;
|
|
11094
11202
|
}
|
|
11095
11203
|
function functionFromDecl(decl) {
|
|
11096
|
-
if (
|
|
11204
|
+
if (import_ts_morph53.Node.isFunctionDeclaration(decl) || import_ts_morph53.Node.isFunctionExpression(decl) || import_ts_morph53.Node.isArrowFunction(decl) || import_ts_morph53.Node.isMethodDeclaration(decl)) {
|
|
11097
11205
|
return decl;
|
|
11098
11206
|
}
|
|
11099
|
-
if (
|
|
11207
|
+
if (import_ts_morph53.Node.isVariableDeclaration(decl)) {
|
|
11100
11208
|
const init = decl.getInitializer();
|
|
11101
|
-
if (init !== void 0 && (
|
|
11209
|
+
if (init !== void 0 && (import_ts_morph53.Node.isArrowFunction(init) || import_ts_morph53.Node.isFunctionExpression(init))) {
|
|
11102
11210
|
return init;
|
|
11103
11211
|
}
|
|
11104
11212
|
}
|
|
@@ -11106,22 +11214,22 @@ function functionFromDecl(decl) {
|
|
|
11106
11214
|
}
|
|
11107
11215
|
|
|
11108
11216
|
// src/shapes/fieldAccesses.ts
|
|
11109
|
-
var
|
|
11217
|
+
var import_ts_morph54 = require("ts-morph");
|
|
11110
11218
|
function findResponseAccessor(callExpr) {
|
|
11111
11219
|
let current2 = callExpr;
|
|
11112
11220
|
const parent1 = current2.getParent();
|
|
11113
|
-
if (parent1 !== void 0 &&
|
|
11221
|
+
if (parent1 !== void 0 && import_ts_morph54.Node.isAwaitExpression(parent1)) {
|
|
11114
11222
|
current2 = parent1;
|
|
11115
11223
|
}
|
|
11116
11224
|
const parent2 = current2.getParent();
|
|
11117
|
-
if (parent2 === void 0 || !
|
|
11225
|
+
if (parent2 === void 0 || !import_ts_morph54.Node.isVariableDeclaration(parent2)) {
|
|
11118
11226
|
return null;
|
|
11119
11227
|
}
|
|
11120
11228
|
const nameNode = parent2.getNameNode();
|
|
11121
|
-
if (
|
|
11229
|
+
if (import_ts_morph54.Node.isIdentifier(nameNode)) {
|
|
11122
11230
|
return { kind: "identifier", name: nameNode.getText() };
|
|
11123
11231
|
}
|
|
11124
|
-
if (
|
|
11232
|
+
if (import_ts_morph54.Node.isObjectBindingPattern(nameNode)) {
|
|
11125
11233
|
const bindings = /* @__PURE__ */ new Map();
|
|
11126
11234
|
for (const element of nameNode.getElements()) {
|
|
11127
11235
|
if (element.getDotDotDotToken() !== void 0) {
|
|
@@ -11142,11 +11250,11 @@ function findResponseAccessor(callExpr) {
|
|
|
11142
11250
|
function buildThenChainAccessor(callExpr, func) {
|
|
11143
11251
|
const bindings = /* @__PURE__ */ new Map();
|
|
11144
11252
|
func.forEachDescendant((node) => {
|
|
11145
|
-
if (!
|
|
11253
|
+
if (!import_ts_morph54.Node.isParameterDeclaration(node)) {
|
|
11146
11254
|
return;
|
|
11147
11255
|
}
|
|
11148
11256
|
const nameNode = node.getNameNode();
|
|
11149
|
-
if (!
|
|
11257
|
+
if (!import_ts_morph54.Node.isIdentifier(nameNode)) {
|
|
11150
11258
|
return;
|
|
11151
11259
|
}
|
|
11152
11260
|
const prefix = prefixOfThenParam(node, callExpr, 0);
|
|
@@ -11178,7 +11286,7 @@ function prefixOfExpr(expr, responseCall, depth) {
|
|
|
11178
11286
|
if (node === responseCall) {
|
|
11179
11287
|
return [];
|
|
11180
11288
|
}
|
|
11181
|
-
if (
|
|
11289
|
+
if (import_ts_morph54.Node.isCallExpression(node)) {
|
|
11182
11290
|
const hop = thenLikeCall(node);
|
|
11183
11291
|
if (hop !== null) {
|
|
11184
11292
|
if (hop.method === "catch") {
|
|
@@ -11210,14 +11318,14 @@ function prefixOfMemberExpr(expr, responseCall, depth) {
|
|
|
11210
11318
|
return null;
|
|
11211
11319
|
}
|
|
11212
11320
|
const decl = chain.root.getSymbol()?.getDeclarations()?.[0];
|
|
11213
|
-
if (decl === void 0 || !
|
|
11321
|
+
if (decl === void 0 || !import_ts_morph54.Node.isParameterDeclaration(decl)) {
|
|
11214
11322
|
return null;
|
|
11215
11323
|
}
|
|
11216
11324
|
const base = prefixOfThenParam(decl, responseCall, depth + 1);
|
|
11217
11325
|
return base === null ? null : [...base, ...chain.segments];
|
|
11218
11326
|
}
|
|
11219
11327
|
function firstCallbackParamName(callback) {
|
|
11220
|
-
if (callback === void 0 || !(
|
|
11328
|
+
if (callback === void 0 || !(import_ts_morph54.Node.isArrowFunction(callback) || import_ts_morph54.Node.isFunctionExpression(callback))) {
|
|
11221
11329
|
return null;
|
|
11222
11330
|
}
|
|
11223
11331
|
const param = callback.getParameters()[0];
|
|
@@ -11225,11 +11333,11 @@ function firstCallbackParamName(callback) {
|
|
|
11225
11333
|
return null;
|
|
11226
11334
|
}
|
|
11227
11335
|
const nameNode = param.getNameNode();
|
|
11228
|
-
return
|
|
11336
|
+
return import_ts_morph54.Node.isIdentifier(nameNode) ? nameNode.getText() : null;
|
|
11229
11337
|
}
|
|
11230
11338
|
function unwrap2(expr) {
|
|
11231
11339
|
let node = expr;
|
|
11232
|
-
while (
|
|
11340
|
+
while (import_ts_morph54.Node.isAwaitExpression(node) || import_ts_morph54.Node.isParenthesizedExpression(node) || import_ts_morph54.Node.isAsExpression(node)) {
|
|
11233
11341
|
node = node.getExpression();
|
|
11234
11342
|
}
|
|
11235
11343
|
return node;
|
|
@@ -11239,15 +11347,15 @@ function chainRootedAt(expr, rootName) {
|
|
|
11239
11347
|
if (chain === null) {
|
|
11240
11348
|
return null;
|
|
11241
11349
|
}
|
|
11242
|
-
return
|
|
11350
|
+
return import_ts_morph54.Node.isIdentifier(chain.root) && chain.root.getText() === rootName ? chain.segments : null;
|
|
11243
11351
|
}
|
|
11244
11352
|
function memberChain(expr) {
|
|
11245
|
-
let node =
|
|
11246
|
-
if (
|
|
11353
|
+
let node = import_ts_morph54.Node.isExpression(expr) ? unwrap2(expr) : expr;
|
|
11354
|
+
if (import_ts_morph54.Node.isCallExpression(node)) {
|
|
11247
11355
|
node = node.getExpression();
|
|
11248
11356
|
}
|
|
11249
11357
|
const segments = [];
|
|
11250
|
-
while (
|
|
11358
|
+
while (import_ts_morph54.Node.isPropertyAccessExpression(node)) {
|
|
11251
11359
|
segments.unshift(node.getName());
|
|
11252
11360
|
node = node.getExpression();
|
|
11253
11361
|
}
|
|
@@ -11266,16 +11374,16 @@ function collectPropertyAccesses(subtree, accessor) {
|
|
|
11266
11374
|
if (accessor.kind === "identifier") {
|
|
11267
11375
|
const varName = accessor.name;
|
|
11268
11376
|
subtree.forEachDescendant((node) => {
|
|
11269
|
-
if (!
|
|
11377
|
+
if (!import_ts_morph54.Node.isPropertyAccessExpression(node)) {
|
|
11270
11378
|
return;
|
|
11271
11379
|
}
|
|
11272
11380
|
const chain = [];
|
|
11273
11381
|
let current2 = node;
|
|
11274
|
-
while (
|
|
11382
|
+
while (import_ts_morph54.Node.isPropertyAccessExpression(current2)) {
|
|
11275
11383
|
chain.unshift(current2.getName());
|
|
11276
11384
|
current2 = current2.getExpression();
|
|
11277
11385
|
}
|
|
11278
|
-
if (
|
|
11386
|
+
if (import_ts_morph54.Node.isIdentifier(current2) && current2.getText() === varName) {
|
|
11279
11387
|
pushChain(chain);
|
|
11280
11388
|
}
|
|
11281
11389
|
});
|
|
@@ -11286,7 +11394,7 @@ function collectPropertyAccesses(subtree, accessor) {
|
|
|
11286
11394
|
return source === void 0 ? void 0 : [source];
|
|
11287
11395
|
} : (name) => accessor.bindings.get(name);
|
|
11288
11396
|
subtree.forEachDescendant((node) => {
|
|
11289
|
-
if (!
|
|
11397
|
+
if (!import_ts_morph54.Node.isIdentifier(node)) {
|
|
11290
11398
|
return;
|
|
11291
11399
|
}
|
|
11292
11400
|
const prefix = prefixOf(node.getText());
|
|
@@ -11298,13 +11406,13 @@ function collectPropertyAccesses(subtree, accessor) {
|
|
|
11298
11406
|
}
|
|
11299
11407
|
let chainTop = node;
|
|
11300
11408
|
let parent = chainTop.getParent();
|
|
11301
|
-
while (parent !== void 0 &&
|
|
11409
|
+
while (parent !== void 0 && import_ts_morph54.Node.isPropertyAccessExpression(parent) && parent.getExpression() === chainTop) {
|
|
11302
11410
|
chainTop = parent;
|
|
11303
11411
|
parent = chainTop.getParent();
|
|
11304
11412
|
}
|
|
11305
11413
|
const segments = [];
|
|
11306
11414
|
let current2 = chainTop;
|
|
11307
|
-
while (
|
|
11415
|
+
while (import_ts_morph54.Node.isPropertyAccessExpression(current2)) {
|
|
11308
11416
|
segments.push(current2.getName());
|
|
11309
11417
|
current2 = current2.getExpression();
|
|
11310
11418
|
}
|
|
@@ -11318,15 +11426,15 @@ function isBindingDeclarationSite(node) {
|
|
|
11318
11426
|
return true;
|
|
11319
11427
|
}
|
|
11320
11428
|
const parent = node.getParent();
|
|
11321
|
-
return parent !== void 0 &&
|
|
11429
|
+
return parent !== void 0 && import_ts_morph54.Node.isParameterDeclaration(parent) && parent.getNameNode() === node;
|
|
11322
11430
|
}
|
|
11323
11431
|
function isInsideObjectBindingPattern(node) {
|
|
11324
11432
|
let current2 = node.getParent();
|
|
11325
11433
|
while (current2 !== void 0) {
|
|
11326
|
-
if (
|
|
11434
|
+
if (import_ts_morph54.Node.isObjectBindingPattern(current2)) {
|
|
11327
11435
|
return true;
|
|
11328
11436
|
}
|
|
11329
|
-
if (
|
|
11437
|
+
if (import_ts_morph54.Node.isFunctionLikeDeclaration(current2) || import_ts_morph54.Node.isVariableStatement(current2)) {
|
|
11330
11438
|
break;
|
|
11331
11439
|
}
|
|
11332
11440
|
current2 = current2.getParent();
|
|
@@ -11389,7 +11497,7 @@ function findBranchSubtree(func, byLineRange, terminalStartLine, terminalEndLine
|
|
|
11389
11497
|
if (parent === void 0) {
|
|
11390
11498
|
break;
|
|
11391
11499
|
}
|
|
11392
|
-
if (
|
|
11500
|
+
if (import_ts_morph54.Node.isIfStatement(parent)) {
|
|
11393
11501
|
const ifStmt = parent;
|
|
11394
11502
|
const thenBlock = ifStmt.getThenStatement();
|
|
11395
11503
|
const elseBlock = ifStmt.getElseStatement();
|
|
@@ -11451,7 +11559,7 @@ function buildNonBodyPropertySet(semantics) {
|
|
|
11451
11559
|
}
|
|
11452
11560
|
|
|
11453
11561
|
// src/subUnitContext.ts
|
|
11454
|
-
var
|
|
11562
|
+
var import_ts_morph55 = require("ts-morph");
|
|
11455
11563
|
function createTsSubUnitContext() {
|
|
11456
11564
|
return {
|
|
11457
11565
|
findJsxAttributes,
|
|
@@ -11464,7 +11572,7 @@ function createTsSubUnitContext() {
|
|
|
11464
11572
|
}
|
|
11465
11573
|
function skipNestedFunctions(parent) {
|
|
11466
11574
|
return (node, traversal) => {
|
|
11467
|
-
if (node !== parent && (
|
|
11575
|
+
if (node !== parent && (import_ts_morph55.Node.isFunctionDeclaration(node) || import_ts_morph55.Node.isFunctionExpression(node) || import_ts_morph55.Node.isArrowFunction(node) || import_ts_morph55.Node.isMethodDeclaration(node))) {
|
|
11468
11576
|
traversal.skip();
|
|
11469
11577
|
return true;
|
|
11470
11578
|
}
|
|
@@ -11478,18 +11586,18 @@ function findJsxAttributes(parent) {
|
|
|
11478
11586
|
if (skip(node, traversal)) {
|
|
11479
11587
|
return;
|
|
11480
11588
|
}
|
|
11481
|
-
if (!
|
|
11589
|
+
if (!import_ts_morph55.Node.isJsxOpeningElement(node) && !import_ts_morph55.Node.isJsxSelfClosingElement(node)) {
|
|
11482
11590
|
return;
|
|
11483
11591
|
}
|
|
11484
11592
|
const tag = node.getTagNameNode().getText();
|
|
11485
11593
|
for (const attr of node.getAttributes()) {
|
|
11486
|
-
if (!
|
|
11594
|
+
if (!import_ts_morph55.Node.isJsxAttribute(attr)) {
|
|
11487
11595
|
continue;
|
|
11488
11596
|
}
|
|
11489
11597
|
const initializer = attr.getInitializer();
|
|
11490
11598
|
let valueExpression = null;
|
|
11491
11599
|
if (initializer !== void 0) {
|
|
11492
|
-
if (
|
|
11600
|
+
if (import_ts_morph55.Node.isJsxExpression(initializer)) {
|
|
11493
11601
|
const inner = initializer.getExpression();
|
|
11494
11602
|
valueExpression = inner ?? null;
|
|
11495
11603
|
} else {
|
|
@@ -11512,11 +11620,11 @@ function findCallExpressionsByName(parent, name) {
|
|
|
11512
11620
|
if (skip(node, traversal)) {
|
|
11513
11621
|
return;
|
|
11514
11622
|
}
|
|
11515
|
-
if (!
|
|
11623
|
+
if (!import_ts_morph55.Node.isCallExpression(node)) {
|
|
11516
11624
|
return;
|
|
11517
11625
|
}
|
|
11518
11626
|
const callee = node.getExpression();
|
|
11519
|
-
if (
|
|
11627
|
+
if (import_ts_morph55.Node.isIdentifier(callee) && callee.getText() === name) {
|
|
11520
11628
|
out.push(node);
|
|
11521
11629
|
}
|
|
11522
11630
|
});
|
|
@@ -11527,10 +11635,10 @@ function resolveAttributeValueFunction(attr, parent) {
|
|
|
11527
11635
|
if (expr === null) {
|
|
11528
11636
|
return null;
|
|
11529
11637
|
}
|
|
11530
|
-
if (
|
|
11638
|
+
if (import_ts_morph55.Node.isArrowFunction(expr) || import_ts_morph55.Node.isFunctionExpression(expr)) {
|
|
11531
11639
|
return { func: expr, localName: null };
|
|
11532
11640
|
}
|
|
11533
|
-
if (
|
|
11641
|
+
if (import_ts_morph55.Node.isIdentifier(expr)) {
|
|
11534
11642
|
const symbol = expr.getSymbol();
|
|
11535
11643
|
if (symbol === void 0) {
|
|
11536
11644
|
return null;
|
|
@@ -11549,15 +11657,15 @@ function resolveAttributeValueFunction(attr, parent) {
|
|
|
11549
11657
|
return null;
|
|
11550
11658
|
}
|
|
11551
11659
|
function tryExtractFunction(decl) {
|
|
11552
|
-
if (
|
|
11660
|
+
if (import_ts_morph55.Node.isFunctionDeclaration(decl)) {
|
|
11553
11661
|
return decl;
|
|
11554
11662
|
}
|
|
11555
|
-
if (
|
|
11663
|
+
if (import_ts_morph55.Node.isVariableDeclaration(decl)) {
|
|
11556
11664
|
const init = decl.getInitializer();
|
|
11557
11665
|
if (init === void 0) {
|
|
11558
11666
|
return null;
|
|
11559
11667
|
}
|
|
11560
|
-
if (
|
|
11668
|
+
if (import_ts_morph55.Node.isArrowFunction(init) || import_ts_morph55.Node.isFunctionExpression(init)) {
|
|
11561
11669
|
return init;
|
|
11562
11670
|
}
|
|
11563
11671
|
}
|
|
@@ -11578,7 +11686,7 @@ function getCallArgumentFunction(call, position) {
|
|
|
11578
11686
|
if (arg === void 0) {
|
|
11579
11687
|
return null;
|
|
11580
11688
|
}
|
|
11581
|
-
if (
|
|
11689
|
+
if (import_ts_morph55.Node.isArrowFunction(arg) || import_ts_morph55.Node.isFunctionExpression(arg)) {
|
|
11582
11690
|
return arg;
|
|
11583
11691
|
}
|
|
11584
11692
|
return null;
|
|
@@ -11590,7 +11698,7 @@ function readArrayLiteralText(node) {
|
|
|
11590
11698
|
if (node === null) {
|
|
11591
11699
|
return null;
|
|
11592
11700
|
}
|
|
11593
|
-
if (
|
|
11701
|
+
if (import_ts_morph55.Node.isArrayLiteralExpression(node)) {
|
|
11594
11702
|
return node.getElements().map((e) => e.getText());
|
|
11595
11703
|
}
|
|
11596
11704
|
return [node.getText()];
|
|
@@ -11813,13 +11921,13 @@ var raise = (msg) => {
|
|
|
11813
11921
|
throw new Error(msg);
|
|
11814
11922
|
};
|
|
11815
11923
|
function bindingPatternNames(nameNode) {
|
|
11816
|
-
if (
|
|
11924
|
+
if (import_ts_morph56.Node.isObjectBindingPattern(nameNode)) {
|
|
11817
11925
|
return nameNode.getElements().map((e) => e.getName());
|
|
11818
11926
|
}
|
|
11819
|
-
if (
|
|
11927
|
+
if (import_ts_morph56.Node.isArrayBindingPattern(nameNode)) {
|
|
11820
11928
|
const names = [];
|
|
11821
11929
|
for (const element of nameNode.getElements()) {
|
|
11822
|
-
if (
|
|
11930
|
+
if (import_ts_morph56.Node.isOmittedExpression(element)) {
|
|
11823
11931
|
continue;
|
|
11824
11932
|
}
|
|
11825
11933
|
names.push(element.getName());
|
|
@@ -11830,7 +11938,7 @@ function bindingPatternNames(nameNode) {
|
|
|
11830
11938
|
}
|
|
11831
11939
|
function componentPropsParameters(param, mapping) {
|
|
11832
11940
|
const nameNode = param.getNameNode();
|
|
11833
|
-
if (!
|
|
11941
|
+
if (!import_ts_morph56.Node.isObjectBindingPattern(nameNode)) {
|
|
11834
11942
|
const type = param.getType();
|
|
11835
11943
|
return [
|
|
11836
11944
|
{
|
|
@@ -11956,11 +12064,11 @@ function extractParameters(func, inputMapping) {
|
|
|
11956
12064
|
function extractDependencyCalls(func) {
|
|
11957
12065
|
const results = [];
|
|
11958
12066
|
func.forEachDescendant((node, traversal) => {
|
|
11959
|
-
if (node !== func && (
|
|
12067
|
+
if (node !== func && (import_ts_morph56.Node.isFunctionDeclaration(node) || import_ts_morph56.Node.isFunctionExpression(node) || import_ts_morph56.Node.isArrowFunction(node) || import_ts_morph56.Node.isMethodDeclaration(node))) {
|
|
11960
12068
|
traversal.skip();
|
|
11961
12069
|
return;
|
|
11962
12070
|
}
|
|
11963
|
-
if (!
|
|
12071
|
+
if (!import_ts_morph56.Node.isVariableDeclaration(node)) {
|
|
11964
12072
|
return;
|
|
11965
12073
|
}
|
|
11966
12074
|
const init = node.getInitializer();
|
|
@@ -11969,19 +12077,19 @@ function extractDependencyCalls(func) {
|
|
|
11969
12077
|
}
|
|
11970
12078
|
let isAsync = false;
|
|
11971
12079
|
let callExpr = init;
|
|
11972
|
-
if (
|
|
12080
|
+
if (import_ts_morph56.Node.isAwaitExpression(init)) {
|
|
11973
12081
|
isAsync = true;
|
|
11974
12082
|
callExpr = init.getExpression();
|
|
11975
12083
|
}
|
|
11976
|
-
if (!
|
|
12084
|
+
if (!import_ts_morph56.Node.isCallExpression(callExpr)) {
|
|
11977
12085
|
return;
|
|
11978
12086
|
}
|
|
11979
12087
|
const calleeName = callExpr.getExpression().getText();
|
|
11980
12088
|
const nameNode = node.getNameNode();
|
|
11981
|
-
const assignedTo =
|
|
12089
|
+
const assignedTo = import_ts_morph56.Node.isIdentifier(nameNode) ? nameNode.getText() : null;
|
|
11982
12090
|
const declList = node.getParent();
|
|
11983
12091
|
const varStmt = declList?.getParent();
|
|
11984
|
-
const locationNode = varStmt !== void 0 &&
|
|
12092
|
+
const locationNode = varStmt !== void 0 && import_ts_morph56.Node.isVariableStatement(varStmt) ? varStmt : node;
|
|
11985
12093
|
results.push({
|
|
11986
12094
|
name: calleeName,
|
|
11987
12095
|
assignedTo,
|
|
@@ -12237,9 +12345,9 @@ function extractBindingMethod(binding, callSite, pack, resolution) {
|
|
|
12237
12345
|
if (m.type === "fromArgumentProperty") {
|
|
12238
12346
|
const args = callSite.callExpression.getArguments();
|
|
12239
12347
|
const arg = args[m.position];
|
|
12240
|
-
if (arg !== void 0 &&
|
|
12348
|
+
if (arg !== void 0 && import_ts_morph56.Node.isObjectLiteralExpression(arg)) {
|
|
12241
12349
|
const prop = arg.getProperty(m.property);
|
|
12242
|
-
if (prop !== void 0 &&
|
|
12350
|
+
if (prop !== void 0 && import_ts_morph56.Node.isPropertyAssignment(prop)) {
|
|
12243
12351
|
const init = prop.getInitializer();
|
|
12244
12352
|
if (init !== void 0) {
|
|
12245
12353
|
const value = stringValueOf(init, resolution);
|
|
@@ -12368,22 +12476,22 @@ function extractBindingPath(binding, callSite, pack, resolution) {
|
|
|
12368
12476
|
return void 0;
|
|
12369
12477
|
}
|
|
12370
12478
|
function pathFromUrlNode(node) {
|
|
12371
|
-
if (
|
|
12479
|
+
if (import_ts_morph56.Node.isStringLiteral(node)) {
|
|
12372
12480
|
return pathFromLiteralUrl(node.getLiteralValue());
|
|
12373
12481
|
}
|
|
12374
|
-
if (
|
|
12482
|
+
if (import_ts_morph56.Node.isNoSubstitutionTemplateLiteral(node)) {
|
|
12375
12483
|
return pathFromLiteralUrl(node.getLiteralValue());
|
|
12376
12484
|
}
|
|
12377
|
-
if (
|
|
12485
|
+
if (import_ts_morph56.Node.isTemplateExpression(node)) {
|
|
12378
12486
|
return pathFromTemplateUrl(node);
|
|
12379
12487
|
}
|
|
12380
12488
|
return void 0;
|
|
12381
12489
|
}
|
|
12382
12490
|
function placeholderName(expr) {
|
|
12383
|
-
if (
|
|
12491
|
+
if (import_ts_morph56.Node.isIdentifier(expr)) {
|
|
12384
12492
|
return expr.getText();
|
|
12385
12493
|
}
|
|
12386
|
-
if (
|
|
12494
|
+
if (import_ts_morph56.Node.isPropertyAccessExpression(expr)) {
|
|
12387
12495
|
return expr.getName();
|
|
12388
12496
|
}
|
|
12389
12497
|
return "param";
|
|
@@ -12818,7 +12926,7 @@ function expandWrapperCallers(summaries, project, options) {
|
|
|
12818
12926
|
continue;
|
|
12819
12927
|
}
|
|
12820
12928
|
const binding = s.identity.boundaryBinding;
|
|
12821
|
-
if (binding === null || binding.semantics.name !== "rest" || binding.semantics.method === null
|
|
12929
|
+
if (binding === null || binding.semantics.name !== "rest" || binding.semantics.method === null) {
|
|
12822
12930
|
continue;
|
|
12823
12931
|
}
|
|
12824
12932
|
lookup ??= createSourceFileLookup(project);
|
|
@@ -12846,11 +12954,21 @@ function findWrapperPathParam(summary, lookup) {
|
|
|
12846
12954
|
if (func === null) {
|
|
12847
12955
|
return null;
|
|
12848
12956
|
}
|
|
12849
|
-
const
|
|
12850
|
-
if (
|
|
12957
|
+
const names = func.getParameters().map((p) => p.getName());
|
|
12958
|
+
if (names.length === 0) {
|
|
12851
12959
|
return null;
|
|
12852
12960
|
}
|
|
12853
|
-
|
|
12961
|
+
for (const call of func.getDescendantsOfKind(import_ts_morph56.SyntaxKind.CallExpression)) {
|
|
12962
|
+
const first = call.getArguments()[0];
|
|
12963
|
+
if (first === void 0 || !import_ts_morph56.Node.isIdentifier(first)) {
|
|
12964
|
+
continue;
|
|
12965
|
+
}
|
|
12966
|
+
const at = names.indexOf(first.getText());
|
|
12967
|
+
if (at !== -1) {
|
|
12968
|
+
return { func, pathParamPosition: at };
|
|
12969
|
+
}
|
|
12970
|
+
}
|
|
12971
|
+
return null;
|
|
12854
12972
|
}
|
|
12855
12973
|
function synthesizeCallerSummaries(wrapper, _project, options) {
|
|
12856
12974
|
const nameNode = wrapperNameNode(wrapper.func);
|
|
@@ -12891,16 +13009,16 @@ function synthesizeCallerSummaries(wrapper, _project, options) {
|
|
|
12891
13009
|
return out;
|
|
12892
13010
|
}
|
|
12893
13011
|
function wrapperNameNode(func) {
|
|
12894
|
-
if (
|
|
13012
|
+
if (import_ts_morph56.Node.isFunctionDeclaration(func) || import_ts_morph56.Node.isMethodDeclaration(func)) {
|
|
12895
13013
|
const name = func.getNameNode();
|
|
12896
|
-
if (name !== void 0 &&
|
|
13014
|
+
if (name !== void 0 && import_ts_morph56.Node.isIdentifier(name)) {
|
|
12897
13015
|
return name;
|
|
12898
13016
|
}
|
|
12899
13017
|
}
|
|
12900
13018
|
const parent = func.getParent();
|
|
12901
|
-
if (parent !== void 0 &&
|
|
13019
|
+
if (parent !== void 0 && import_ts_morph56.Node.isVariableDeclaration(parent)) {
|
|
12902
13020
|
const nameNode = parent.getNameNode();
|
|
12903
|
-
if (
|
|
13021
|
+
if (import_ts_morph56.Node.isIdentifier(nameNode)) {
|
|
12904
13022
|
return nameNode;
|
|
12905
13023
|
}
|
|
12906
13024
|
}
|
|
@@ -12909,10 +13027,10 @@ function wrapperNameNode(func) {
|
|
|
12909
13027
|
function enclosingCall(node) {
|
|
12910
13028
|
let current2 = node.getParent();
|
|
12911
13029
|
while (current2 !== void 0) {
|
|
12912
|
-
if (
|
|
13030
|
+
if (import_ts_morph56.Node.isCallExpression(current2)) {
|
|
12913
13031
|
return current2;
|
|
12914
13032
|
}
|
|
12915
|
-
if (
|
|
13033
|
+
if (import_ts_morph56.Node.isPropertyAccessExpression(current2)) {
|
|
12916
13034
|
current2 = current2.getParent();
|
|
12917
13035
|
continue;
|
|
12918
13036
|
}
|
|
@@ -12923,7 +13041,7 @@ function enclosingCall(node) {
|
|
|
12923
13041
|
function enclosingFunction(node) {
|
|
12924
13042
|
let current2 = node.getParent();
|
|
12925
13043
|
while (current2 !== void 0) {
|
|
12926
|
-
if (
|
|
13044
|
+
if (import_ts_morph56.Node.isFunctionDeclaration(current2) || import_ts_morph56.Node.isFunctionExpression(current2) || import_ts_morph56.Node.isArrowFunction(current2) || import_ts_morph56.Node.isMethodDeclaration(current2)) {
|
|
12927
13045
|
return current2;
|
|
12928
13046
|
}
|
|
12929
13047
|
current2 = current2.getParent();
|
|
@@ -12931,13 +13049,13 @@ function enclosingFunction(node) {
|
|
|
12931
13049
|
return null;
|
|
12932
13050
|
}
|
|
12933
13051
|
function literalOrTemplate(arg) {
|
|
12934
|
-
if (
|
|
13052
|
+
if (import_ts_morph56.Node.isStringLiteral(arg)) {
|
|
12935
13053
|
return arg.getLiteralValue();
|
|
12936
13054
|
}
|
|
12937
|
-
if (
|
|
13055
|
+
if (import_ts_morph56.Node.isNoSubstitutionTemplateLiteral(arg)) {
|
|
12938
13056
|
return arg.getLiteralValue();
|
|
12939
13057
|
}
|
|
12940
|
-
if (
|
|
13058
|
+
if (import_ts_morph56.Node.isTemplateExpression(arg)) {
|
|
12941
13059
|
let path11 = arg.getHead().getLiteralText();
|
|
12942
13060
|
for (const span of arg.getTemplateSpans()) {
|
|
12943
13061
|
path11 += `{${placeholderName(span.getExpression())}}`;
|
|
@@ -12948,13 +13066,13 @@ function literalOrTemplate(arg) {
|
|
|
12948
13066
|
return void 0;
|
|
12949
13067
|
}
|
|
12950
13068
|
function callerName(func) {
|
|
12951
|
-
if (
|
|
13069
|
+
if (import_ts_morph56.Node.isFunctionDeclaration(func) || import_ts_morph56.Node.isMethodDeclaration(func)) {
|
|
12952
13070
|
return func.getName() ?? "anonymous";
|
|
12953
13071
|
}
|
|
12954
13072
|
const parent = func.getParent();
|
|
12955
|
-
if (parent !== void 0 &&
|
|
13073
|
+
if (parent !== void 0 && import_ts_morph56.Node.isVariableDeclaration(parent)) {
|
|
12956
13074
|
const nameNode = parent.getNameNode();
|
|
12957
|
-
if (
|
|
13075
|
+
if (import_ts_morph56.Node.isIdentifier(nameNode)) {
|
|
12958
13076
|
return nameNode.getText();
|
|
12959
13077
|
}
|
|
12960
13078
|
}
|
|
@@ -13059,7 +13177,7 @@ function loadRunFiles(project, candidatePaths, timer) {
|
|
|
13059
13177
|
return { sourceFiles, deep };
|
|
13060
13178
|
}
|
|
13061
13179
|
function createTypeScriptAdapter(config) {
|
|
13062
|
-
const project = config.project ?? new
|
|
13180
|
+
const project = config.project ?? new import_ts_morph56.Project(
|
|
13063
13181
|
config.tsConfigFilePath !== void 0 ? {
|
|
13064
13182
|
tsConfigFilePath: config.tsConfigFilePath,
|
|
13065
13183
|
skipAddingFilesFromTsConfig: true
|
|
@@ -13402,7 +13520,7 @@ function buildSubUnitSummary(subUnit, parent, invocationRecognizers, accessRecog
|
|
|
13402
13520
|
// src/bootstrap/noTsconfigProject.ts
|
|
13403
13521
|
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
13404
13522
|
var import_node_path10 = __toESM(require("path"), 1);
|
|
13405
|
-
var
|
|
13523
|
+
var import_ts_morph57 = require("ts-morph");
|
|
13406
13524
|
var SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
13407
13525
|
".ts",
|
|
13408
13526
|
".tsx",
|
|
@@ -13450,12 +13568,12 @@ function findSourceFiles(rootDir, depth = 0) {
|
|
|
13450
13568
|
return found;
|
|
13451
13569
|
}
|
|
13452
13570
|
function createProjectWithoutTsconfig(rootDir) {
|
|
13453
|
-
const project = new
|
|
13571
|
+
const project = new import_ts_morph57.Project({
|
|
13454
13572
|
skipAddingFilesFromTsConfig: true,
|
|
13455
13573
|
compilerOptions: {
|
|
13456
|
-
target:
|
|
13457
|
-
module:
|
|
13458
|
-
moduleResolution:
|
|
13574
|
+
target: import_ts_morph57.ScriptTarget.ES2022,
|
|
13575
|
+
module: import_ts_morph57.ModuleKind.ESNext,
|
|
13576
|
+
moduleResolution: import_ts_morph57.ModuleResolutionKind.Bundler,
|
|
13459
13577
|
allowJs: true,
|
|
13460
13578
|
checkJs: false,
|
|
13461
13579
|
noEmit: true,
|
|
@@ -13495,10 +13613,10 @@ function findNearestTsconfig(startDir) {
|
|
|
13495
13613
|
}
|
|
13496
13614
|
|
|
13497
13615
|
// src/configuredCall.ts
|
|
13498
|
-
var
|
|
13616
|
+
var import_ts_morph58 = require("ts-morph");
|
|
13499
13617
|
function readConfiguredCall(call, ctx, spec) {
|
|
13500
13618
|
const callee = call.getExpression();
|
|
13501
|
-
if (!
|
|
13619
|
+
if (!import_ts_morph58.Node.isPropertyAccessExpression(callee)) {
|
|
13502
13620
|
return null;
|
|
13503
13621
|
}
|
|
13504
13622
|
if (callee.getName() !== spec.method) {
|
|
@@ -13543,10 +13661,10 @@ function readStringArg(arg) {
|
|
|
13543
13661
|
}
|
|
13544
13662
|
function rootIdentifier(node) {
|
|
13545
13663
|
let current2 = node;
|
|
13546
|
-
while (
|
|
13664
|
+
while (import_ts_morph58.Node.isPropertyAccessExpression(current2)) {
|
|
13547
13665
|
current2 = current2.getExpression();
|
|
13548
13666
|
}
|
|
13549
|
-
return
|
|
13667
|
+
return import_ts_morph58.Node.isIdentifier(current2) ? current2 : null;
|
|
13550
13668
|
}
|
|
13551
13669
|
|
|
13552
13670
|
// src/packHealth.ts
|
|
@@ -13662,7 +13780,7 @@ function formatPackHealth(checks, audiences) {
|
|
|
13662
13780
|
}
|
|
13663
13781
|
|
|
13664
13782
|
// src/resolve/readName.ts
|
|
13665
|
-
var
|
|
13783
|
+
var import_ts_morph59 = require("ts-morph");
|
|
13666
13784
|
var MAX_HELPER_HOPS = 2;
|
|
13667
13785
|
var UNNAMED_HOLE = "param";
|
|
13668
13786
|
function readName(expr, options = {}) {
|
|
@@ -13691,25 +13809,25 @@ function read(expr, ctx) {
|
|
|
13691
13809
|
}
|
|
13692
13810
|
const seen = new Set(ctx.seen).add(expr);
|
|
13693
13811
|
const inner = { ...ctx, seen };
|
|
13694
|
-
if (
|
|
13812
|
+
if (import_ts_morph59.Node.isStringLiteral(expr) || import_ts_morph59.Node.isNoSubstitutionTemplateLiteral(expr)) {
|
|
13695
13813
|
return expr.getLiteralValue();
|
|
13696
13814
|
}
|
|
13697
|
-
if (
|
|
13815
|
+
if (import_ts_morph59.Node.isNumericLiteral(expr)) {
|
|
13698
13816
|
return expr.getLiteralText();
|
|
13699
13817
|
}
|
|
13700
|
-
if (
|
|
13818
|
+
if (import_ts_morph59.Node.isTemplateExpression(expr)) {
|
|
13701
13819
|
return fromTemplate(expr, inner);
|
|
13702
13820
|
}
|
|
13703
|
-
if (
|
|
13821
|
+
if (import_ts_morph59.Node.isParenthesizedExpression(expr)) {
|
|
13704
13822
|
return read(expr.getExpression(), inner);
|
|
13705
13823
|
}
|
|
13706
|
-
if (
|
|
13824
|
+
if (import_ts_morph59.Node.isBinaryExpression(expr)) {
|
|
13707
13825
|
return fromBinary(expr, inner);
|
|
13708
13826
|
}
|
|
13709
|
-
if (
|
|
13827
|
+
if (import_ts_morph59.Node.isCallExpression(expr)) {
|
|
13710
13828
|
return fromCall(expr, inner);
|
|
13711
13829
|
}
|
|
13712
|
-
if (
|
|
13830
|
+
if (import_ts_morph59.Node.isIdentifier(expr)) {
|
|
13713
13831
|
const only = boundOnce(expr, ctx);
|
|
13714
13832
|
if (only !== null) {
|
|
13715
13833
|
return read(only.node, { ...inner, bindings: only.scope });
|
|
@@ -13719,7 +13837,7 @@ function read(expr, ctx) {
|
|
|
13719
13837
|
return written === null || written === expr ? null : read(written, inner);
|
|
13720
13838
|
}
|
|
13721
13839
|
function fromTemplate(expr, ctx) {
|
|
13722
|
-
if (!
|
|
13840
|
+
if (!import_ts_morph59.Node.isTemplateExpression(expr)) {
|
|
13723
13841
|
return null;
|
|
13724
13842
|
}
|
|
13725
13843
|
let name = expr.getHead().getLiteralText();
|
|
@@ -13730,28 +13848,28 @@ function fromTemplate(expr, ctx) {
|
|
|
13730
13848
|
return name;
|
|
13731
13849
|
}
|
|
13732
13850
|
function fromBinary(expr, ctx) {
|
|
13733
|
-
if (!
|
|
13851
|
+
if (!import_ts_morph59.Node.isBinaryExpression(expr)) {
|
|
13734
13852
|
return null;
|
|
13735
13853
|
}
|
|
13736
13854
|
const operator = expr.getOperatorToken().getKind();
|
|
13737
|
-
if (operator ===
|
|
13855
|
+
if (operator === import_ts_morph59.SyntaxKind.BarBarToken || operator === import_ts_morph59.SyntaxKind.QuestionQuestionToken) {
|
|
13738
13856
|
return ctx.insideHole ? null : read(expr.getRight(), ctx);
|
|
13739
13857
|
}
|
|
13740
|
-
if (operator !==
|
|
13858
|
+
if (operator !== import_ts_morph59.SyntaxKind.PlusToken) {
|
|
13741
13859
|
return null;
|
|
13742
13860
|
}
|
|
13743
13861
|
const parts = { ...ctx, insideHole: true };
|
|
13744
13862
|
return readOrHole(expr.getLeft(), parts) + readOrHole(expr.getRight(), parts);
|
|
13745
13863
|
}
|
|
13746
13864
|
function fromCall(expr, ctx) {
|
|
13747
|
-
if (!
|
|
13865
|
+
if (!import_ts_morph59.Node.isCallExpression(expr)) {
|
|
13748
13866
|
return null;
|
|
13749
13867
|
}
|
|
13750
13868
|
const callee = expr.getExpression();
|
|
13751
|
-
if (
|
|
13869
|
+
if (import_ts_morph59.Node.isPropertyAccessExpression(callee) && callee.getName() === "join") {
|
|
13752
13870
|
return fromJoin(callee.getExpression(), expr.getArguments(), ctx);
|
|
13753
13871
|
}
|
|
13754
|
-
if (
|
|
13872
|
+
if (import_ts_morph59.Node.isIdentifier(callee) && callee.getText() === "String") {
|
|
13755
13873
|
const only = expr.getArguments()[0];
|
|
13756
13874
|
return only === void 0 ? null : readOrHole(only, ctx);
|
|
13757
13875
|
}
|
|
@@ -13770,7 +13888,7 @@ function fromCall(expr, ctx) {
|
|
|
13770
13888
|
}
|
|
13771
13889
|
function fromJoin(subject, args, ctx) {
|
|
13772
13890
|
const separator = args[0];
|
|
13773
|
-
if (separator === void 0 || !
|
|
13891
|
+
if (separator === void 0 || !import_ts_morph59.Node.isStringLiteral(separator)) {
|
|
13774
13892
|
return null;
|
|
13775
13893
|
}
|
|
13776
13894
|
const parts = elementsOf(subject, ctx);
|
|
@@ -13786,17 +13904,17 @@ function fromJoin(subject, args, ctx) {
|
|
|
13786
13904
|
).join(separator.getLiteralValue());
|
|
13787
13905
|
}
|
|
13788
13906
|
function elementsOf(subject, ctx) {
|
|
13789
|
-
if (
|
|
13907
|
+
if (import_ts_morph59.Node.isArrayLiteralExpression(subject)) {
|
|
13790
13908
|
return subject.getElements().map((element) => here(element, ctx));
|
|
13791
13909
|
}
|
|
13792
|
-
if (
|
|
13910
|
+
if (import_ts_morph59.Node.isCallExpression(subject)) {
|
|
13793
13911
|
const callee = subject.getExpression();
|
|
13794
|
-
if (
|
|
13912
|
+
if (import_ts_morph59.Node.isPropertyAccessExpression(callee) && callee.getName() === "map") {
|
|
13795
13913
|
return elementsOf(callee.getExpression(), ctx);
|
|
13796
13914
|
}
|
|
13797
13915
|
return null;
|
|
13798
13916
|
}
|
|
13799
|
-
if (!
|
|
13917
|
+
if (!import_ts_morph59.Node.isIdentifier(subject)) {
|
|
13800
13918
|
return null;
|
|
13801
13919
|
}
|
|
13802
13920
|
const bound = ctx.bindings.get(subject.getText());
|
|
@@ -13804,7 +13922,7 @@ function elementsOf(subject, ctx) {
|
|
|
13804
13922
|
return null;
|
|
13805
13923
|
}
|
|
13806
13924
|
const only = bound.length === 1 ? bound[0] : void 0;
|
|
13807
|
-
return only !== void 0 &&
|
|
13925
|
+
return only !== void 0 && import_ts_morph59.Node.isArrayLiteralExpression(only.node) ? only.node.getElements().map((element) => here(element, ctx)) : bound;
|
|
13808
13926
|
}
|
|
13809
13927
|
function singleReturnBody(callee, ctx) {
|
|
13810
13928
|
const declaration = declarationOf2(callee, ctx);
|
|
@@ -13819,22 +13937,22 @@ function singleReturnBody(callee, ctx) {
|
|
|
13819
13937
|
if (body === void 0) {
|
|
13820
13938
|
return null;
|
|
13821
13939
|
}
|
|
13822
|
-
if (
|
|
13940
|
+
if (import_ts_morph59.Node.isExpression(body)) {
|
|
13823
13941
|
return { parameters, returned: body };
|
|
13824
13942
|
}
|
|
13825
|
-
if (!
|
|
13943
|
+
if (!import_ts_morph59.Node.isBlock(body)) {
|
|
13826
13944
|
return null;
|
|
13827
13945
|
}
|
|
13828
13946
|
const statements = body.getStatements();
|
|
13829
13947
|
const only = statements[0];
|
|
13830
|
-
if (statements.length !== 1 || only === void 0 || !
|
|
13948
|
+
if (statements.length !== 1 || only === void 0 || !import_ts_morph59.Node.isReturnStatement(only)) {
|
|
13831
13949
|
return null;
|
|
13832
13950
|
}
|
|
13833
13951
|
const returned = only.getExpression();
|
|
13834
13952
|
return returned === void 0 ? null : { parameters, returned };
|
|
13835
13953
|
}
|
|
13836
13954
|
function declarationOf2(callee, ctx) {
|
|
13837
|
-
const symbol =
|
|
13955
|
+
const symbol = import_ts_morph59.Node.isPropertyAccessExpression(callee) ? callee.getNameNode().getSymbol() : callee.getSymbol();
|
|
13838
13956
|
const declarations = symbol?.getAliasedSymbol()?.getDeclarations() ?? symbol?.getDeclarations() ?? [];
|
|
13839
13957
|
for (const declaration of declarations) {
|
|
13840
13958
|
const callable = asCallable(declaration);
|
|
@@ -13846,14 +13964,14 @@ function declarationOf2(callee, ctx) {
|
|
|
13846
13964
|
return written === null || written === callee ? null : declarationOf2(written, { ...ctx, resolve: () => null });
|
|
13847
13965
|
}
|
|
13848
13966
|
function asCallable(declaration) {
|
|
13849
|
-
if (
|
|
13967
|
+
if (import_ts_morph59.Node.isFunctionDeclaration(declaration) || import_ts_morph59.Node.isMethodDeclaration(declaration) || import_ts_morph59.Node.isArrowFunction(declaration) || import_ts_morph59.Node.isFunctionExpression(declaration)) {
|
|
13850
13968
|
return declaration;
|
|
13851
13969
|
}
|
|
13852
|
-
if (!
|
|
13970
|
+
if (!import_ts_morph59.Node.isVariableDeclaration(declaration)) {
|
|
13853
13971
|
return null;
|
|
13854
13972
|
}
|
|
13855
13973
|
const initializer = declaration.getInitializer();
|
|
13856
|
-
if (initializer !== void 0 && (
|
|
13974
|
+
if (initializer !== void 0 && (import_ts_morph59.Node.isArrowFunction(initializer) || import_ts_morph59.Node.isFunctionExpression(initializer))) {
|
|
13857
13975
|
return initializer;
|
|
13858
13976
|
}
|
|
13859
13977
|
return null;
|
|
@@ -13875,7 +13993,7 @@ function here(node, ctx) {
|
|
|
13875
13993
|
return { node, scope: ctx.bindings };
|
|
13876
13994
|
}
|
|
13877
13995
|
function boundOnce(expr, ctx) {
|
|
13878
|
-
const bound =
|
|
13996
|
+
const bound = import_ts_morph59.Node.isIdentifier(expr) ? ctx.bindings.get(expr.getText()) : void 0;
|
|
13879
13997
|
return bound !== void 0 && bound.length === 1 ? bound[0] : null;
|
|
13880
13998
|
}
|
|
13881
13999
|
function readOrHole(expr, ctx) {
|
|
@@ -13887,10 +14005,10 @@ function holeName(expr, ctx) {
|
|
|
13887
14005
|
if (bound !== null) {
|
|
13888
14006
|
return holeName(bound.node, { ...ctx, bindings: bound.scope });
|
|
13889
14007
|
}
|
|
13890
|
-
if (
|
|
14008
|
+
if (import_ts_morph59.Node.isIdentifier(expr)) {
|
|
13891
14009
|
return expr.getText();
|
|
13892
14010
|
}
|
|
13893
|
-
if (
|
|
14011
|
+
if (import_ts_morph59.Node.isPropertyAccessExpression(expr)) {
|
|
13894
14012
|
return expr.getName();
|
|
13895
14013
|
}
|
|
13896
14014
|
return UNNAMED_HOLE;
|