@suss/adapter-ruby 0.19.0 → 0.21.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 +983 -95
- package/dist/index.d.cts +12 -9
- package/dist/index.d.ts +12 -9
- package/dist/index.js +982 -94
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -63,18 +63,46 @@ function rangeOf(node) {
|
|
|
63
63
|
end: node.endPosition.row + 1
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
+
function spanOf(node) {
|
|
67
|
+
return { start: node.startIndex, end: node.endIndex };
|
|
68
|
+
}
|
|
66
69
|
function field(node, name) {
|
|
67
70
|
return node.childForFieldName(name);
|
|
68
71
|
}
|
|
69
72
|
function bodyStatements(body) {
|
|
70
73
|
return body.namedChildren.filter((child) => child !== null);
|
|
71
74
|
}
|
|
75
|
+
var OWN_BODY_TYPES = /* @__PURE__ */ new Set([
|
|
76
|
+
"method",
|
|
77
|
+
"singleton_method",
|
|
78
|
+
"lambda",
|
|
79
|
+
"class",
|
|
80
|
+
"module",
|
|
81
|
+
"singleton_class"
|
|
82
|
+
]);
|
|
83
|
+
var ARGUMENT_LIST_TYPE = "argument_list";
|
|
84
|
+
function runStatements(body, blockConfigures = () => false) {
|
|
85
|
+
const found = [];
|
|
86
|
+
const readsItsChildren = (node) => {
|
|
87
|
+
if (OWN_BODY_TYPES.has(node.type) || node.type === ARGUMENT_LIST_TYPE) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
return !(node.type === "call" && blockConfigures(node));
|
|
91
|
+
};
|
|
92
|
+
(0, import_extractor.walkDescendants)(body, null, {
|
|
93
|
+
at: (node) => {
|
|
94
|
+
found.push(node);
|
|
95
|
+
},
|
|
96
|
+
into: (node) => readsItsChildren(node) ? null : import_extractor.SKIP_CHILDREN
|
|
97
|
+
});
|
|
98
|
+
return found;
|
|
99
|
+
}
|
|
72
100
|
function symbolValue(node) {
|
|
73
101
|
return node.type === "simple_symbol" ? node.text.slice(1) : null;
|
|
74
102
|
}
|
|
75
103
|
function instanceMethodsByName(body) {
|
|
76
104
|
const methods = /* @__PURE__ */ new Map();
|
|
77
|
-
for (const stmt of
|
|
105
|
+
for (const stmt of runStatements(body)) {
|
|
78
106
|
if (stmt.type !== "method") {
|
|
79
107
|
continue;
|
|
80
108
|
}
|
|
@@ -87,7 +115,7 @@ function instanceMethodsByName(body) {
|
|
|
87
115
|
}
|
|
88
116
|
function bareCallArgumentGroups(body, name) {
|
|
89
117
|
const groups = [];
|
|
90
|
-
for (const stmt of
|
|
118
|
+
for (const stmt of runStatements(body)) {
|
|
91
119
|
if (stmt.type !== "call" || field(stmt, "receiver") !== null) {
|
|
92
120
|
continue;
|
|
93
121
|
}
|
|
@@ -190,7 +218,7 @@ function walkClasses(root, visit) {
|
|
|
190
218
|
});
|
|
191
219
|
}
|
|
192
220
|
function walkDefinitions(root, visit) {
|
|
193
|
-
walkBody(
|
|
221
|
+
walkBody(runStatements(root), [], visit);
|
|
194
222
|
}
|
|
195
223
|
function walkBody(statements, nesting, visit) {
|
|
196
224
|
for (const stmt of statements) {
|
|
@@ -229,7 +257,7 @@ function visitClass(node, nesting, visit) {
|
|
|
229
257
|
bodyNesting: identity.bodyNesting
|
|
230
258
|
});
|
|
231
259
|
if (bodyNode !== null) {
|
|
232
|
-
walkBody(
|
|
260
|
+
walkBody(runStatements(bodyNode), identity.bodyNesting, visit);
|
|
233
261
|
}
|
|
234
262
|
}
|
|
235
263
|
function visitModule(node, nesting, visit) {
|
|
@@ -248,7 +276,7 @@ function visitModule(node, nesting, visit) {
|
|
|
248
276
|
bodyNesting: identity.bodyNesting
|
|
249
277
|
});
|
|
250
278
|
if (bodyNode !== null) {
|
|
251
|
-
walkBody(
|
|
279
|
+
walkBody(runStatements(bodyNode), identity.bodyNesting, visit);
|
|
252
280
|
}
|
|
253
281
|
}
|
|
254
282
|
function stripTypeSuffixName(qualifiedName) {
|
|
@@ -404,7 +432,7 @@ function definitionIn(blocks, name) {
|
|
|
404
432
|
}
|
|
405
433
|
return { method, dynamic };
|
|
406
434
|
}
|
|
407
|
-
function inheritedStatements(ancestry) {
|
|
435
|
+
function inheritedStatements(ancestry, blockConfigures) {
|
|
408
436
|
const statements = [];
|
|
409
437
|
for (const entry of [...ancestry].reverse()) {
|
|
410
438
|
if (entry.type !== "bodies") {
|
|
@@ -415,7 +443,7 @@ function inheritedStatements(ancestry) {
|
|
|
415
443
|
if (body === null) {
|
|
416
444
|
continue;
|
|
417
445
|
}
|
|
418
|
-
for (const statement of
|
|
446
|
+
for (const statement of runStatements(body, blockConfigures)) {
|
|
419
447
|
statements.push({ block, statement });
|
|
420
448
|
}
|
|
421
449
|
}
|
|
@@ -641,14 +669,6 @@ function lowerRubyBody(body, terminals) {
|
|
|
641
669
|
}
|
|
642
670
|
|
|
643
671
|
// src/paths/effects.ts
|
|
644
|
-
var DECLARATION_TYPES = /* @__PURE__ */ new Set([
|
|
645
|
-
"method",
|
|
646
|
-
"singleton_method",
|
|
647
|
-
"lambda",
|
|
648
|
-
"class",
|
|
649
|
-
"module",
|
|
650
|
-
"singleton_class"
|
|
651
|
-
]);
|
|
652
672
|
var RAISE_NAMES2 = /* @__PURE__ */ new Set(["raise", "fail"]);
|
|
653
673
|
var BLOCK_TYPES = /* @__PURE__ */ new Set([
|
|
654
674
|
"body_statement",
|
|
@@ -696,7 +716,7 @@ function isRaise2(node) {
|
|
|
696
716
|
}
|
|
697
717
|
function bodyCalls(node, found = []) {
|
|
698
718
|
for (const child of children(node)) {
|
|
699
|
-
if (
|
|
719
|
+
if (OWN_BODY_TYPES.has(child.type)) {
|
|
700
720
|
continue;
|
|
701
721
|
}
|
|
702
722
|
if (child.type === "call" && !isPropertyRead(child) && !isRaise2(child)) {
|
|
@@ -782,6 +802,9 @@ function invocationEffects(definitionNode) {
|
|
|
782
802
|
});
|
|
783
803
|
}
|
|
784
804
|
|
|
805
|
+
// src/storage.ts
|
|
806
|
+
var import_datalog3 = require("@suss/datalog");
|
|
807
|
+
|
|
785
808
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
786
809
|
var external_exports = {};
|
|
787
810
|
__export(external_exports, {
|
|
@@ -1462,8 +1485,8 @@ function assertNever(_x) {
|
|
|
1462
1485
|
function assert(_) {
|
|
1463
1486
|
}
|
|
1464
1487
|
function getEnumValues(entries) {
|
|
1465
|
-
const numericValues = Object.values(entries).filter((
|
|
1466
|
-
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_,
|
|
1488
|
+
const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
|
|
1489
|
+
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v2]) => v2);
|
|
1467
1490
|
return values;
|
|
1468
1491
|
}
|
|
1469
1492
|
function joinValues(array2, separator = "|") {
|
|
@@ -1517,9 +1540,9 @@ function defineLazy(object2, key, getter) {
|
|
|
1517
1540
|
}
|
|
1518
1541
|
return value;
|
|
1519
1542
|
},
|
|
1520
|
-
set(
|
|
1543
|
+
set(v2) {
|
|
1521
1544
|
Object.defineProperty(object2, key, {
|
|
1522
|
-
value:
|
|
1545
|
+
value: v2
|
|
1523
1546
|
// configurable: true,
|
|
1524
1547
|
});
|
|
1525
1548
|
},
|
|
@@ -3206,10 +3229,10 @@ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
|
3206
3229
|
v7: 7,
|
|
3207
3230
|
v8: 8
|
|
3208
3231
|
};
|
|
3209
|
-
const
|
|
3210
|
-
if (
|
|
3232
|
+
const v2 = versionMap[def.version];
|
|
3233
|
+
if (v2 === void 0)
|
|
3211
3234
|
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
3212
|
-
def.pattern ?? (def.pattern = uuid(
|
|
3235
|
+
def.pattern ?? (def.pattern = uuid(v2));
|
|
3213
3236
|
} else
|
|
3214
3237
|
def.pattern ?? (def.pattern = uuid());
|
|
3215
3238
|
$ZodStringFormat.init(inst, def);
|
|
@@ -3814,8 +3837,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3814
3837
|
const field2 = shape[key]._zod;
|
|
3815
3838
|
if (field2.values) {
|
|
3816
3839
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
3817
|
-
for (const
|
|
3818
|
-
propValues[key].add(
|
|
3840
|
+
for (const v2 of field2.values)
|
|
3841
|
+
propValues[key].add(v2);
|
|
3819
3842
|
}
|
|
3820
3843
|
}
|
|
3821
3844
|
return propValues;
|
|
@@ -4110,10 +4133,10 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
4110
4133
|
const pv = option._zod.propValues;
|
|
4111
4134
|
if (!pv || Object.keys(pv).length === 0)
|
|
4112
4135
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
4113
|
-
for (const [k,
|
|
4136
|
+
for (const [k, v2] of Object.entries(pv)) {
|
|
4114
4137
|
if (!propValues[k])
|
|
4115
4138
|
propValues[k] = /* @__PURE__ */ new Set();
|
|
4116
|
-
for (const val of
|
|
4139
|
+
for (const val of v2) {
|
|
4117
4140
|
propValues[k].add(val);
|
|
4118
4141
|
}
|
|
4119
4142
|
}
|
|
@@ -4127,11 +4150,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
4127
4150
|
const values = o._zod.propValues?.[def.discriminator];
|
|
4128
4151
|
if (!values || values.size === 0)
|
|
4129
4152
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
4130
|
-
for (const
|
|
4131
|
-
if (map2.has(
|
|
4132
|
-
throw new Error(`Duplicate discriminator value "${String(
|
|
4153
|
+
for (const v2 of values) {
|
|
4154
|
+
if (map2.has(v2)) {
|
|
4155
|
+
throw new Error(`Duplicate discriminator value "${String(v2)}"`);
|
|
4133
4156
|
}
|
|
4134
|
-
map2.set(
|
|
4157
|
+
map2.set(v2, o);
|
|
4135
4158
|
}
|
|
4136
4159
|
}
|
|
4137
4160
|
return map2;
|
|
@@ -4770,8 +4793,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
4770
4793
|
var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
4771
4794
|
$ZodType.init(inst, def);
|
|
4772
4795
|
defineLazy(inst._zod, "values", () => {
|
|
4773
|
-
const
|
|
4774
|
-
return
|
|
4796
|
+
const v2 = def.innerType._zod.values;
|
|
4797
|
+
return v2 ? new Set([...v2].filter((x) => x !== void 0)) : void 0;
|
|
4775
4798
|
});
|
|
4776
4799
|
inst._zod.parse = (payload, ctx) => {
|
|
4777
4800
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -7168,7 +7191,7 @@ var error17 = () => {
|
|
|
7168
7191
|
if (issue2.values.length === 1) {
|
|
7169
7192
|
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${stringifyPrimitive(issue2.values[0])}`;
|
|
7170
7193
|
}
|
|
7171
|
-
const stringified = issue2.values.map((
|
|
7194
|
+
const stringified = issue2.values.map((v2) => stringifyPrimitive(v2));
|
|
7172
7195
|
if (issue2.values.length === 2) {
|
|
7173
7196
|
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${stringified[0]} \u05D0\u05D5 ${stringified[1]}`;
|
|
7174
7197
|
}
|
|
@@ -11923,7 +11946,7 @@ function _set(Class2, valueType, params) {
|
|
|
11923
11946
|
}
|
|
11924
11947
|
// @__NO_SIDE_EFFECTS__
|
|
11925
11948
|
function _enum(Class2, values, params) {
|
|
11926
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((
|
|
11949
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
|
|
11927
11950
|
return new Class2({
|
|
11928
11951
|
type: "enum",
|
|
11929
11952
|
entries,
|
|
@@ -12128,8 +12151,8 @@ function _stringbool(Classes, _params) {
|
|
|
12128
12151
|
let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
|
|
12129
12152
|
let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
|
|
12130
12153
|
if (params.case !== "sensitive") {
|
|
12131
|
-
truthyArray = truthyArray.map((
|
|
12132
|
-
falsyArray = falsyArray.map((
|
|
12154
|
+
truthyArray = truthyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
|
|
12155
|
+
falsyArray = falsyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
|
|
12133
12156
|
}
|
|
12134
12157
|
const truthySet = new Set(truthyArray);
|
|
12135
12158
|
const falsySet = new Set(falsyArray);
|
|
@@ -12671,9 +12694,9 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
|
12671
12694
|
var enumProcessor = (schema, _ctx, json2, _params) => {
|
|
12672
12695
|
const def = schema._zod.def;
|
|
12673
12696
|
const values = getEnumValues(def.entries);
|
|
12674
|
-
if (values.every((
|
|
12697
|
+
if (values.every((v2) => typeof v2 === "number"))
|
|
12675
12698
|
json2.type = "number";
|
|
12676
|
-
if (values.every((
|
|
12699
|
+
if (values.every((v2) => typeof v2 === "string"))
|
|
12677
12700
|
json2.type = "string";
|
|
12678
12701
|
json2.enum = values;
|
|
12679
12702
|
};
|
|
@@ -12706,13 +12729,13 @@ var literalProcessor = (schema, ctx, json2, _params) => {
|
|
|
12706
12729
|
json2.const = val;
|
|
12707
12730
|
}
|
|
12708
12731
|
} else {
|
|
12709
|
-
if (vals.every((
|
|
12732
|
+
if (vals.every((v2) => typeof v2 === "number"))
|
|
12710
12733
|
json2.type = "number";
|
|
12711
|
-
if (vals.every((
|
|
12734
|
+
if (vals.every((v2) => typeof v2 === "string"))
|
|
12712
12735
|
json2.type = "string";
|
|
12713
|
-
if (vals.every((
|
|
12736
|
+
if (vals.every((v2) => typeof v2 === "boolean"))
|
|
12714
12737
|
json2.type = "boolean";
|
|
12715
|
-
if (vals.every((
|
|
12738
|
+
if (vals.every((v2) => v2 === null))
|
|
12716
12739
|
json2.type = "null";
|
|
12717
12740
|
json2.enum = vals;
|
|
12718
12741
|
}
|
|
@@ -12810,11 +12833,11 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
12810
12833
|
}
|
|
12811
12834
|
const allKeys = new Set(Object.keys(shape));
|
|
12812
12835
|
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
12813
|
-
const
|
|
12836
|
+
const v2 = def.shape[key]._zod;
|
|
12814
12837
|
if (ctx.io === "input") {
|
|
12815
|
-
return
|
|
12838
|
+
return v2.optin === void 0;
|
|
12816
12839
|
} else {
|
|
12817
|
-
return
|
|
12840
|
+
return v2.optout === void 0;
|
|
12818
12841
|
}
|
|
12819
12842
|
}));
|
|
12820
12843
|
if (requiredKeys.size > 0) {
|
|
@@ -12934,7 +12957,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
12934
12957
|
}
|
|
12935
12958
|
const keyValues = keyType._zod.values;
|
|
12936
12959
|
if (keyValues) {
|
|
12937
|
-
const validKeyValues = [...keyValues].filter((
|
|
12960
|
+
const validKeyValues = [...keyValues].filter((v2) => typeof v2 === "string" || typeof v2 === "number");
|
|
12938
12961
|
if (validKeyValues.length > 0) {
|
|
12939
12962
|
json2.required = validKeyValues;
|
|
12940
12963
|
}
|
|
@@ -13499,12 +13522,12 @@ function _installLazyMethods(inst, group, methods) {
|
|
|
13499
13522
|
});
|
|
13500
13523
|
return bound;
|
|
13501
13524
|
},
|
|
13502
|
-
set(
|
|
13525
|
+
set(v2) {
|
|
13503
13526
|
Object.defineProperty(this, key, {
|
|
13504
13527
|
configurable: true,
|
|
13505
13528
|
writable: true,
|
|
13506
13529
|
enumerable: true,
|
|
13507
|
-
value:
|
|
13530
|
+
value: v2
|
|
13508
13531
|
});
|
|
13509
13532
|
}
|
|
13510
13533
|
});
|
|
@@ -14392,7 +14415,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
14392
14415
|
};
|
|
14393
14416
|
});
|
|
14394
14417
|
function _enum2(values, params) {
|
|
14395
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((
|
|
14418
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
|
|
14396
14419
|
return new ZodEnum({
|
|
14397
14420
|
type: "enum",
|
|
14398
14421
|
entries,
|
|
@@ -14946,10 +14969,10 @@ function convertBaseSchema(schema, ctx) {
|
|
|
14946
14969
|
if (enumValues.length === 1) {
|
|
14947
14970
|
return z.literal(enumValues[0]);
|
|
14948
14971
|
}
|
|
14949
|
-
if (enumValues.every((
|
|
14972
|
+
if (enumValues.every((v2) => typeof v2 === "string")) {
|
|
14950
14973
|
return z.enum(enumValues);
|
|
14951
14974
|
}
|
|
14952
|
-
const literalSchemas = enumValues.map((
|
|
14975
|
+
const literalSchemas = enumValues.map((v2) => z.literal(v2));
|
|
14953
14976
|
if (literalSchemas.length < 2) {
|
|
14954
14977
|
return literalSchemas[0];
|
|
14955
14978
|
}
|
|
@@ -15296,7 +15319,7 @@ function date4(params) {
|
|
|
15296
15319
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
15297
15320
|
config(en_default());
|
|
15298
15321
|
|
|
15299
|
-
// ../../ir-core/dist/chunk-
|
|
15322
|
+
// ../../ir-core/dist/chunk-QHFMZPEG.js
|
|
15300
15323
|
function gqlIdentityKey(typeName, fieldName) {
|
|
15301
15324
|
return `gql:${typeName}.${fieldName}`;
|
|
15302
15325
|
}
|
|
@@ -15306,6 +15329,9 @@ function fnIdentityKey(packageName, exportPath) {
|
|
|
15306
15329
|
function busIdentityKey(messageBus, subject) {
|
|
15307
15330
|
return `bus:${messageBus} ${subject}`;
|
|
15308
15331
|
}
|
|
15332
|
+
function unitIdentityKey(deploymentTarget, instanceName) {
|
|
15333
|
+
return `unit:${deploymentTarget} ${instanceName}`;
|
|
15334
|
+
}
|
|
15309
15335
|
function metricIdentityKey(metricSystem, metricType) {
|
|
15310
15336
|
return `metric:${metricSystem} ${metricType}`;
|
|
15311
15337
|
}
|
|
@@ -15360,14 +15386,24 @@ var functionCallSemantics = defineBoundarySemantics({
|
|
|
15360
15386
|
*/
|
|
15361
15387
|
canPair: () => true,
|
|
15362
15388
|
/**
|
|
15363
|
-
* `"fn:<package>::<exportPath>"` when both are set
|
|
15364
|
-
*
|
|
15365
|
-
*
|
|
15389
|
+
* `"fn:<package>::<exportPath>"` when both are set, and
|
|
15390
|
+
* `"fn:<module>::<exportName>"` for an in-repo unit that states its
|
|
15391
|
+
* module, the way a server action does. Components and bare
|
|
15392
|
+
* handlers state neither and have no key at all.
|
|
15366
15393
|
*/
|
|
15394
|
+
rewritePaths(semantics, rewrite) {
|
|
15395
|
+
if (semantics.module === void 0) {
|
|
15396
|
+
return semantics;
|
|
15397
|
+
}
|
|
15398
|
+
return { ...semantics, module: rewrite(semantics.module) };
|
|
15399
|
+
},
|
|
15367
15400
|
identityKey(semantics) {
|
|
15368
15401
|
if (semantics.package !== void 0 && semantics.exportPath !== void 0 && semantics.exportPath.length > 0) {
|
|
15369
15402
|
return fnIdentityKey(semantics.package, semantics.exportPath);
|
|
15370
15403
|
}
|
|
15404
|
+
if (semantics.module !== void 0 && semantics.exportName !== void 0) {
|
|
15405
|
+
return fnIdentityKey(semantics.module, [semantics.exportName]);
|
|
15406
|
+
}
|
|
15371
15407
|
return null;
|
|
15372
15408
|
}
|
|
15373
15409
|
}
|
|
@@ -15708,6 +15744,14 @@ var restSemantics = defineBoundarySemantics({
|
|
|
15708
15744
|
}
|
|
15709
15745
|
return routePathAdmits(semantics.path, path4) ? "match" : "nomatch";
|
|
15710
15746
|
},
|
|
15747
|
+
/**
|
|
15748
|
+
* A route the registration pattern admits is inside it. A route
|
|
15749
|
+
* whose path this source never gave is left outside, because
|
|
15750
|
+
* nothing here can show it is one the pattern covers.
|
|
15751
|
+
*/
|
|
15752
|
+
withinScope(semantics, scope) {
|
|
15753
|
+
return semantics.path !== null && routePathAdmits(scope, semantics.path);
|
|
15754
|
+
},
|
|
15711
15755
|
/**
|
|
15712
15756
|
* A call whose base URL the deployment fills in, resolved to the
|
|
15713
15757
|
* path it reaches.
|
|
@@ -15829,7 +15873,62 @@ var storageSemantics = defineBoundarySemantics({
|
|
|
15829
15873
|
/** A query returns rows or items, not a status and a body. */
|
|
15830
15874
|
exchangesHttpResponses: false,
|
|
15831
15875
|
reportsUnpairedItself: false,
|
|
15832
|
-
identityKey: () => null
|
|
15876
|
+
identityKey: () => null,
|
|
15877
|
+
displayLabel: storageLabel
|
|
15878
|
+
}
|
|
15879
|
+
});
|
|
15880
|
+
function storageLabel(semantics) {
|
|
15881
|
+
return `${semantics.storageSystem}:${storageContainerLabel(semantics)}`;
|
|
15882
|
+
}
|
|
15883
|
+
function storageContainerLabel(semantics) {
|
|
15884
|
+
const container = semantics.container ?? "<unnamed container>";
|
|
15885
|
+
const addressed = semantics.accessPath === null ? container : `${container}#${semantics.accessPath}`;
|
|
15886
|
+
return semantics.scope === "default" ? addressed : `${semantics.scope}/${addressed}`;
|
|
15887
|
+
}
|
|
15888
|
+
var UnitInvocationSemanticsSchema = DeployableUnitSchema.extend({
|
|
15889
|
+
name: external_exports.literal("unit-invocation"),
|
|
15890
|
+
instanceName: DeployableUnitSchema.shape.instanceName.nullable()
|
|
15891
|
+
});
|
|
15892
|
+
var unitInvocationSemantics = defineBoundarySemantics({
|
|
15893
|
+
name: "unit-invocation",
|
|
15894
|
+
schema: UnitInvocationSemanticsSchema,
|
|
15895
|
+
// faas.name is the deployed function's own name and instanceName is
|
|
15896
|
+
// the deployment template's logical id, which is a different string.
|
|
15897
|
+
// Runtime config leaves the pair off for the same reason.
|
|
15898
|
+
semconv: {},
|
|
15899
|
+
behavior: {
|
|
15900
|
+
/**
|
|
15901
|
+
* A synchronous invoke gives back whatever the handler returned,
|
|
15902
|
+
* which is a value rather than a status and a body. A handler's
|
|
15903
|
+
* return only becomes an HTTP response under a proxy integration,
|
|
15904
|
+
* and that route gets a REST binding instead of this one.
|
|
15905
|
+
*/
|
|
15906
|
+
exchangesHttpResponses: false,
|
|
15907
|
+
/**
|
|
15908
|
+
* A unit nothing in the run invokes is the ordinary case, since
|
|
15909
|
+
* most services are reached from a stack suss never read. So an
|
|
15910
|
+
* uninvoked unit stays in the generic unmatched list rather than
|
|
15911
|
+
* being reported as a problem here.
|
|
15912
|
+
*/
|
|
15913
|
+
reportsUnpairedItself: false,
|
|
15914
|
+
identityKey(semantics) {
|
|
15915
|
+
if (semantics.instanceName === null) {
|
|
15916
|
+
return null;
|
|
15917
|
+
}
|
|
15918
|
+
return unitIdentityKey(
|
|
15919
|
+
semantics.deploymentTarget,
|
|
15920
|
+
semantics.instanceName
|
|
15921
|
+
);
|
|
15922
|
+
},
|
|
15923
|
+
displayLabel(semantics) {
|
|
15924
|
+
if (semantics.instanceName === null) {
|
|
15925
|
+
return `unit:${semantics.deploymentTarget} (named at runtime)`;
|
|
15926
|
+
}
|
|
15927
|
+
return unitIdentityKey(
|
|
15928
|
+
semantics.deploymentTarget,
|
|
15929
|
+
semantics.instanceName
|
|
15930
|
+
);
|
|
15931
|
+
}
|
|
15833
15932
|
}
|
|
15834
15933
|
});
|
|
15835
15934
|
var SemanticsSchema = external_exports.discriminatedUnion("name", [
|
|
@@ -15840,7 +15939,8 @@ var SemanticsSchema = external_exports.discriminatedUnion("name", [
|
|
|
15840
15939
|
runtimeConfigSemantics.schema,
|
|
15841
15940
|
storageSemantics.schema,
|
|
15842
15941
|
messageBusSemantics.schema,
|
|
15843
|
-
metricSemantics.schema
|
|
15942
|
+
metricSemantics.schema,
|
|
15943
|
+
unitInvocationSemantics.schema
|
|
15844
15944
|
]);
|
|
15845
15945
|
var DEFINITIONS = [
|
|
15846
15946
|
restSemantics,
|
|
@@ -15850,7 +15950,8 @@ var DEFINITIONS = [
|
|
|
15850
15950
|
runtimeConfigSemantics,
|
|
15851
15951
|
storageSemantics,
|
|
15852
15952
|
messageBusSemantics,
|
|
15853
|
-
metricSemantics
|
|
15953
|
+
metricSemantics,
|
|
15954
|
+
unitInvocationSemantics
|
|
15854
15955
|
];
|
|
15855
15956
|
var BY_NAME = new Map(
|
|
15856
15957
|
DEFINITIONS.map((d) => [d.name, d])
|
|
@@ -15878,7 +15979,16 @@ var ConfidenceInfoSchema = external_exports.object({
|
|
|
15878
15979
|
});
|
|
15879
15980
|
var SourceLocationSchema = external_exports.object({
|
|
15880
15981
|
file: external_exports.string(),
|
|
15982
|
+
/** Line numbers, for a person reading the summary or an editor link. */
|
|
15881
15983
|
range: external_exports.object({ start: external_exports.number(), end: external_exports.number() }),
|
|
15984
|
+
/**
|
|
15985
|
+
* Character offsets of the unit in its file. Identity and joins
|
|
15986
|
+
* measure with these, since two functions can share a line and never
|
|
15987
|
+
* an offset range; the line `range` above is the presentation of the
|
|
15988
|
+
* same place. Absent on summaries no source position backs, a
|
|
15989
|
+
* contract artifact's say.
|
|
15990
|
+
*/
|
|
15991
|
+
span: external_exports.object({ start: external_exports.number(), end: external_exports.number() }).optional(),
|
|
15882
15992
|
exportName: external_exports.string().nullable(),
|
|
15883
15993
|
/**
|
|
15884
15994
|
* The project the extract was pointed at, by the name that project
|
|
@@ -15931,6 +16041,13 @@ var TypeShapeSchema = external_exports.lazy(
|
|
|
15931
16041
|
);
|
|
15932
16042
|
|
|
15933
16043
|
// ../../ir-core/dist/index.js
|
|
16044
|
+
var RelationSchema = external_exports.enum([
|
|
16045
|
+
"provides",
|
|
16046
|
+
"reads",
|
|
16047
|
+
"writes",
|
|
16048
|
+
"invokes"
|
|
16049
|
+
]);
|
|
16050
|
+
var EffectRelationSchema = RelationSchema.exclude(["provides"]);
|
|
15934
16051
|
var SuppressionSideSchema = external_exports.object({
|
|
15935
16052
|
summary: external_exports.string().optional(),
|
|
15936
16053
|
transitionId: external_exports.string().optional()
|
|
@@ -16003,6 +16120,750 @@ function storageBinding(opts) {
|
|
|
16003
16120
|
};
|
|
16004
16121
|
}
|
|
16005
16122
|
|
|
16123
|
+
// ../../resolution/dist/index.js
|
|
16124
|
+
var import_datalog = require("@suss/datalog");
|
|
16125
|
+
var import_datalog2 = require("@suss/datalog");
|
|
16126
|
+
var VALUE_STEP = (0, import_datalog2.constant)("value");
|
|
16127
|
+
var NAMESPACE_IMPORT_NAME = "*";
|
|
16128
|
+
var NAMESPACE_IMPORT = (0, import_datalog2.constant)(NAMESPACE_IMPORT_NAME);
|
|
16129
|
+
var RESULT_STEP = (0, import_datalog2.constant)("result");
|
|
16130
|
+
var RESOLUTION_RULES = [
|
|
16131
|
+
// Aliasing: const x = y, or an identifier referencing a declaration.
|
|
16132
|
+
// A language with a hop of its own, like JavaScript's `.bind`, states
|
|
16133
|
+
// it as a step too, or every question but `comesTo` misses it.
|
|
16134
|
+
(0, import_datalog2.rule)(
|
|
16135
|
+
"stepsTo",
|
|
16136
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"), VALUE_STEP],
|
|
16137
|
+
[(0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"))],
|
|
16138
|
+
"alias"
|
|
16139
|
+
),
|
|
16140
|
+
// A name written more than once has the value the last write left
|
|
16141
|
+
// there. The adapter works out which write that is and stays quiet
|
|
16142
|
+
// when control flow decides, so such a name steps nowhere at all.
|
|
16143
|
+
(0, import_datalog2.rule)(
|
|
16144
|
+
"stepsTo",
|
|
16145
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"), VALUE_STEP],
|
|
16146
|
+
[(0, import_datalog2.lit)("endsHolding", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"))],
|
|
16147
|
+
"last write"
|
|
16148
|
+
),
|
|
16149
|
+
// A fallback says the value is one of its branches, so each branch is
|
|
16150
|
+
// a step. A branch that resolves to nothing makes no claim, and two
|
|
16151
|
+
// branches resolving to different things fail the single-answer policy.
|
|
16152
|
+
(0, import_datalog2.rule)(
|
|
16153
|
+
"stepsTo",
|
|
16154
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("b"), VALUE_STEP],
|
|
16155
|
+
[(0, import_datalog2.lit)("fallbackBranch", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("b"))],
|
|
16156
|
+
"fallback"
|
|
16157
|
+
),
|
|
16158
|
+
// An import steps to what the module exports under that name.
|
|
16159
|
+
(0, import_datalog2.rule)(
|
|
16160
|
+
"stepsTo",
|
|
16161
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("value"), VALUE_STEP],
|
|
16162
|
+
[
|
|
16163
|
+
(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")),
|
|
16164
|
+
(0, import_datalog2.lit)("moduleExport", (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("value"))
|
|
16165
|
+
],
|
|
16166
|
+
"import"
|
|
16167
|
+
),
|
|
16168
|
+
// A parameter steps to what a call passes it. A function called from
|
|
16169
|
+
// several places leaves its parameter with more than one value, and a
|
|
16170
|
+
// caller that needs those apart asks `paramAt`.
|
|
16171
|
+
(0, import_datalog2.rule)(
|
|
16172
|
+
"stepsTo",
|
|
16173
|
+
[(0, import_datalog2.variable)("p"), (0, import_datalog2.variable)("a"), VALUE_STEP],
|
|
16174
|
+
[(0, import_datalog2.lit)("passesArgument", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("p"), (0, import_datalog2.variable)("a"))],
|
|
16175
|
+
"argument"
|
|
16176
|
+
),
|
|
16177
|
+
// Reading a property steps to what the object contains under that
|
|
16178
|
+
// name, whichever way the object arrived: `routes.list` off a name,
|
|
16179
|
+
// or `make(body).handle` off a call.
|
|
16180
|
+
(0, import_datalog2.rule)(
|
|
16181
|
+
"stepsTo",
|
|
16182
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("held"), VALUE_STEP],
|
|
16183
|
+
[
|
|
16184
|
+
(0, import_datalog2.lit)("readsProperty", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("o"), (0, import_datalog2.variable)("n")),
|
|
16185
|
+
(0, import_datalog2.lit)("objectOf", (0, import_datalog2.variable)("o"), (0, import_datalog2.variable)("obj")),
|
|
16186
|
+
(0, import_datalog2.lit)("contains", (0, import_datalog2.variable)("obj"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("held"))
|
|
16187
|
+
],
|
|
16188
|
+
"property read"
|
|
16189
|
+
),
|
|
16190
|
+
// Calling a class makes one of it, so the call steps to the class and
|
|
16191
|
+
// a method read off the result is the one the class declares. The
|
|
16192
|
+
// caveat below is about a factory function, and a class is not one.
|
|
16193
|
+
(0, import_datalog2.rule)(
|
|
16194
|
+
"stepsTo",
|
|
16195
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("cls"), VALUE_STEP],
|
|
16196
|
+
[
|
|
16197
|
+
(0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c")),
|
|
16198
|
+
(0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("cls")),
|
|
16199
|
+
(0, import_datalog2.lit)("objectValue", (0, import_datalog2.variable)("cls"))
|
|
16200
|
+
],
|
|
16201
|
+
"class instance"
|
|
16202
|
+
),
|
|
16203
|
+
// Wrapper transparency, derived: calling a factory that returns a
|
|
16204
|
+
// function which calls its parameter k steps to argument k.
|
|
16205
|
+
(0, import_datalog2.rule)(
|
|
16206
|
+
"stepsTo",
|
|
16207
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("a"), VALUE_STEP],
|
|
16208
|
+
[
|
|
16209
|
+
(0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c")),
|
|
16210
|
+
(0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("f")),
|
|
16211
|
+
(0, import_datalog2.lit)("unwraps", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("k")),
|
|
16212
|
+
(0, import_datalog2.lit)("callArg", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("k"), (0, import_datalog2.variable)("a"))
|
|
16213
|
+
],
|
|
16214
|
+
"factory unwrap"
|
|
16215
|
+
),
|
|
16216
|
+
// Wrapper transparency, declared: a pack says this callee wraps
|
|
16217
|
+
// argument k. The callee has to come from the library the pack said,
|
|
16218
|
+
// so a local object spelled the same way is not mistaken for it.
|
|
16219
|
+
(0, import_datalog2.rule)(
|
|
16220
|
+
"stepsTo",
|
|
16221
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("a"), VALUE_STEP],
|
|
16222
|
+
[
|
|
16223
|
+
(0, import_datalog2.lit)("calleeName", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("n")),
|
|
16224
|
+
(0, import_datalog2.lit)("unwrapsByName", (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("k")),
|
|
16225
|
+
(0, import_datalog2.lit)("wrapperModule", (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("m")),
|
|
16226
|
+
(0, import_datalog2.lit)("calleeOrigin", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("m")),
|
|
16227
|
+
(0, import_datalog2.lit)("callArg", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("k"), (0, import_datalog2.variable)("a"))
|
|
16228
|
+
],
|
|
16229
|
+
"declared wrapper"
|
|
16230
|
+
),
|
|
16231
|
+
// The one step that runs a function forwards: a call steps to what
|
|
16232
|
+
// the function it invokes returns.
|
|
16233
|
+
(0, import_datalog2.rule)(
|
|
16234
|
+
"stepsTo",
|
|
16235
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("ret"), RESULT_STEP],
|
|
16236
|
+
[(0, import_datalog2.lit)("invokes", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("f")), (0, import_datalog2.lit)("returnsValue", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("ret"))],
|
|
16237
|
+
"call result"
|
|
16238
|
+
),
|
|
16239
|
+
// Where a walk gets to, and whether it ran a call on the way. A value
|
|
16240
|
+
// step keeps whatever the rest of the walk was, and a result step
|
|
16241
|
+
// makes the whole walk one that ran a call.
|
|
16242
|
+
(0, import_datalog2.rule)(
|
|
16243
|
+
"reaches",
|
|
16244
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), (0, import_datalog2.variable)("kind")],
|
|
16245
|
+
[(0, import_datalog2.lit)("stepsTo", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), (0, import_datalog2.variable)("kind"))]
|
|
16246
|
+
),
|
|
16247
|
+
(0, import_datalog2.rule)(
|
|
16248
|
+
"reaches",
|
|
16249
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), (0, import_datalog2.variable)("kind")],
|
|
16250
|
+
[
|
|
16251
|
+
(0, import_datalog2.lit)("stepsTo", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"), VALUE_STEP),
|
|
16252
|
+
(0, import_datalog2.lit)("reaches", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"), (0, import_datalog2.variable)("kind"))
|
|
16253
|
+
]
|
|
16254
|
+
),
|
|
16255
|
+
// Two rules rather than one leaving the rest of the walk's kind free.
|
|
16256
|
+
// A free kind is a second question about the same relation, and a
|
|
16257
|
+
// demand-driven run then derives both to answer either.
|
|
16258
|
+
(0, import_datalog2.rule)(
|
|
16259
|
+
"reaches",
|
|
16260
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), RESULT_STEP],
|
|
16261
|
+
[
|
|
16262
|
+
(0, import_datalog2.lit)("stepsTo", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"), RESULT_STEP),
|
|
16263
|
+
(0, import_datalog2.lit)("reaches", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"), VALUE_STEP)
|
|
16264
|
+
]
|
|
16265
|
+
),
|
|
16266
|
+
(0, import_datalog2.rule)(
|
|
16267
|
+
"reaches",
|
|
16268
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), RESULT_STEP],
|
|
16269
|
+
[
|
|
16270
|
+
(0, import_datalog2.lit)("stepsTo", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"), RESULT_STEP),
|
|
16271
|
+
(0, import_datalog2.lit)("reaches", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"), RESULT_STEP)
|
|
16272
|
+
]
|
|
16273
|
+
),
|
|
16274
|
+
// What a value comes down to: the walk that never ran a call, stopped
|
|
16275
|
+
// at a function or an object. Something already written out comes to
|
|
16276
|
+
// itself, and every other walk ends at one of those.
|
|
16277
|
+
(0, import_datalog2.rule)("comesTo", [(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("x")], [(0, import_datalog2.lit)("func", (0, import_datalog2.variable)("x"))]),
|
|
16278
|
+
(0, import_datalog2.rule)("comesTo", [(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("x")], [(0, import_datalog2.lit)("objectValue", (0, import_datalog2.variable)("x"))]),
|
|
16279
|
+
(0, import_datalog2.rule)(
|
|
16280
|
+
"comesTo",
|
|
16281
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16282
|
+
[(0, import_datalog2.lit)("reaches", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), VALUE_STEP), (0, import_datalog2.lit)("func", (0, import_datalog2.variable)("z"))]
|
|
16283
|
+
),
|
|
16284
|
+
(0, import_datalog2.rule)(
|
|
16285
|
+
"comesTo",
|
|
16286
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16287
|
+
[(0, import_datalog2.lit)("reaches", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), VALUE_STEP), (0, import_datalog2.lit)("objectValue", (0, import_datalog2.variable)("z"))]
|
|
16288
|
+
),
|
|
16289
|
+
// The same stopping condition, for the walk that ran a call. A call
|
|
16290
|
+
// gets no `comesTo` answer on purpose: coming back with what a
|
|
16291
|
+
// factory returned would fight the unwrapping answer.
|
|
16292
|
+
(0, import_datalog2.rule)(
|
|
16293
|
+
"givesBack",
|
|
16294
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16295
|
+
[(0, import_datalog2.lit)("reaches", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), RESULT_STEP), (0, import_datalog2.lit)("func", (0, import_datalog2.variable)("z"))]
|
|
16296
|
+
),
|
|
16297
|
+
(0, import_datalog2.rule)(
|
|
16298
|
+
"givesBack",
|
|
16299
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16300
|
+
[(0, import_datalog2.lit)("reaches", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), RESULT_STEP), (0, import_datalog2.lit)("objectValue", (0, import_datalog2.variable)("z"))]
|
|
16301
|
+
),
|
|
16302
|
+
// Following a value to the expression it is written as, whatever kind
|
|
16303
|
+
// that is. A GraphQL document is neither a function nor an object, so
|
|
16304
|
+
// `comesTo` never reaches one.
|
|
16305
|
+
(0, import_datalog2.rule)("isWrittenAs", [(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("x")], [(0, import_datalog2.lit)("writtenValue", (0, import_datalog2.variable)("x"))]),
|
|
16306
|
+
(0, import_datalog2.rule)("isWrittenAs", [(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("x")], [(0, import_datalog2.lit)("objectValue", (0, import_datalog2.variable)("x"))]),
|
|
16307
|
+
(0, import_datalog2.rule)(
|
|
16308
|
+
"isWrittenAs",
|
|
16309
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16310
|
+
[(0, import_datalog2.lit)("reaches", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), VALUE_STEP), (0, import_datalog2.lit)("writtenValue", (0, import_datalog2.variable)("z"))]
|
|
16311
|
+
),
|
|
16312
|
+
(0, import_datalog2.rule)(
|
|
16313
|
+
"isWrittenAs",
|
|
16314
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16315
|
+
[(0, import_datalog2.lit)("reaches", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), VALUE_STEP), (0, import_datalog2.lit)("objectValue", (0, import_datalog2.variable)("z"))]
|
|
16316
|
+
),
|
|
16317
|
+
// What one call site put in a parameter, told apart from what the
|
|
16318
|
+
// other callers passed.
|
|
16319
|
+
(0, import_datalog2.rule)(
|
|
16320
|
+
"paramAt",
|
|
16321
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("p"), (0, import_datalog2.variable)("z")],
|
|
16322
|
+
[
|
|
16323
|
+
(0, import_datalog2.lit)("passesArgument", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("p"), (0, import_datalog2.variable)("a")),
|
|
16324
|
+
(0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("a"), (0, import_datalog2.variable)("z"))
|
|
16325
|
+
]
|
|
16326
|
+
),
|
|
16327
|
+
// An argument arriving at the parameter it is passed to, by position
|
|
16328
|
+
// or by the name the caller wrote, keeping the call it went through
|
|
16329
|
+
// so `paramAt` can tell two call sites apart.
|
|
16330
|
+
(0, import_datalog2.rule)(
|
|
16331
|
+
"passesArgument",
|
|
16332
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("p"), (0, import_datalog2.variable)("a")],
|
|
16333
|
+
[
|
|
16334
|
+
(0, import_datalog2.lit)("paramOf", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("k"), (0, import_datalog2.variable)("p")),
|
|
16335
|
+
(0, import_datalog2.lit)("callsFunction", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("f")),
|
|
16336
|
+
(0, import_datalog2.lit)("callArg", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("k"), (0, import_datalog2.variable)("a"))
|
|
16337
|
+
]
|
|
16338
|
+
),
|
|
16339
|
+
(0, import_datalog2.rule)(
|
|
16340
|
+
"passesArgument",
|
|
16341
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("p"), (0, import_datalog2.variable)("a")],
|
|
16342
|
+
[
|
|
16343
|
+
(0, import_datalog2.lit)("paramNamed", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("p")),
|
|
16344
|
+
(0, import_datalog2.lit)("callsFunction", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("f")),
|
|
16345
|
+
(0, import_datalog2.lit)("callKeywordArg", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("a"))
|
|
16346
|
+
]
|
|
16347
|
+
),
|
|
16348
|
+
// Which module's export a re-exported name forwards to, however
|
|
16349
|
+
// many barrels deep the forwarding runs.
|
|
16350
|
+
(0, import_datalog2.rule)(
|
|
16351
|
+
"moduleForwards",
|
|
16352
|
+
[(0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("m2"), (0, import_datalog2.variable)("n2")],
|
|
16353
|
+
[(0, import_datalog2.lit)("reExports", (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("m2"), (0, import_datalog2.variable)("n2"))]
|
|
16354
|
+
),
|
|
16355
|
+
(0, import_datalog2.rule)(
|
|
16356
|
+
"moduleForwards",
|
|
16357
|
+
[(0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("m3"), (0, import_datalog2.variable)("n3")],
|
|
16358
|
+
[
|
|
16359
|
+
(0, import_datalog2.lit)("reExports", (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("m2"), (0, import_datalog2.variable)("n2")),
|
|
16360
|
+
(0, import_datalog2.lit)("moduleForwards", (0, import_datalog2.variable)("m2"), (0, import_datalog2.variable)("n2"), (0, import_datalog2.variable)("m3"), (0, import_datalog2.variable)("n3"))
|
|
16361
|
+
]
|
|
16362
|
+
),
|
|
16363
|
+
// What a module exports: directly, or through re-export chains.
|
|
16364
|
+
(0, import_datalog2.rule)(
|
|
16365
|
+
"moduleExport",
|
|
16366
|
+
[(0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("value")],
|
|
16367
|
+
[(0, import_datalog2.lit)("exportsAs", (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("value"))],
|
|
16368
|
+
"export"
|
|
16369
|
+
),
|
|
16370
|
+
(0, import_datalog2.rule)(
|
|
16371
|
+
"moduleExport",
|
|
16372
|
+
[(0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("value")],
|
|
16373
|
+
[
|
|
16374
|
+
(0, import_datalog2.lit)("reExports", (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("m2"), (0, import_datalog2.variable)("n2")),
|
|
16375
|
+
(0, import_datalog2.lit)("moduleExport", (0, import_datalog2.variable)("m2"), (0, import_datalog2.variable)("n2"), (0, import_datalog2.variable)("value"))
|
|
16376
|
+
],
|
|
16377
|
+
"re-export"
|
|
16378
|
+
),
|
|
16379
|
+
(0, import_datalog2.rule)(
|
|
16380
|
+
"moduleExport",
|
|
16381
|
+
[(0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("value")],
|
|
16382
|
+
[
|
|
16383
|
+
(0, import_datalog2.lit)("reExportsAll", (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("m2")),
|
|
16384
|
+
(0, import_datalog2.lit)("moduleExport", (0, import_datalog2.variable)("m2"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("value"))
|
|
16385
|
+
],
|
|
16386
|
+
"re-export all"
|
|
16387
|
+
),
|
|
16388
|
+
// The function a call runs, written from the call's side because a
|
|
16389
|
+
// caller asking what a call gives back has the call in hand.
|
|
16390
|
+
(0, import_datalog2.rule)(
|
|
16391
|
+
"invokes",
|
|
16392
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("f")],
|
|
16393
|
+
[(0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c")), (0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("f"))]
|
|
16394
|
+
),
|
|
16395
|
+
// The callee is itself a call: `daoBuilder()()`.
|
|
16396
|
+
(0, import_datalog2.rule)(
|
|
16397
|
+
"invokes",
|
|
16398
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("f")],
|
|
16399
|
+
[(0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c")), (0, import_datalog2.lit)("givesBack", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("f"))]
|
|
16400
|
+
),
|
|
16401
|
+
// The object an expression refers to: a name through `comesTo`, a
|
|
16402
|
+
// factory call through what it gives back. Naming the step is what
|
|
16403
|
+
// makes `routes.list` and `make(body).handle` one rule.
|
|
16404
|
+
(0, import_datalog2.rule)(
|
|
16405
|
+
"objectOf",
|
|
16406
|
+
[(0, import_datalog2.variable)("o"), (0, import_datalog2.variable)("obj")],
|
|
16407
|
+
[(0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("o"), (0, import_datalog2.variable)("obj")), (0, import_datalog2.lit)("objectValue", (0, import_datalog2.variable)("obj"))]
|
|
16408
|
+
),
|
|
16409
|
+
(0, import_datalog2.rule)(
|
|
16410
|
+
"objectOf",
|
|
16411
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("obj")],
|
|
16412
|
+
[(0, import_datalog2.lit)("givesBack", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("obj")), (0, import_datalog2.lit)("objectValue", (0, import_datalog2.variable)("obj"))]
|
|
16413
|
+
),
|
|
16414
|
+
// Which calls a function, found by the name the call is written as
|
|
16415
|
+
// rather than by resolving every callee in the project. A caller knows
|
|
16416
|
+
// the function and wants its call sites, so both of these start from
|
|
16417
|
+
// the function. Starting from `call` instead asks what every call in
|
|
16418
|
+
// the project imports, which was 72% of everything derived.
|
|
16419
|
+
(0, import_datalog2.rule)(
|
|
16420
|
+
"callsFunction",
|
|
16421
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("f")],
|
|
16422
|
+
[(0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("f")), (0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c"))]
|
|
16423
|
+
),
|
|
16424
|
+
(0, import_datalog2.rule)(
|
|
16425
|
+
"callsFunction",
|
|
16426
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("f")],
|
|
16427
|
+
[
|
|
16428
|
+
(0, import_datalog2.lit)("moduleExport", (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("f")),
|
|
16429
|
+
(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")),
|
|
16430
|
+
(0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c"))
|
|
16431
|
+
]
|
|
16432
|
+
),
|
|
16433
|
+
// The same, for a language whose adapter writes the import down as a
|
|
16434
|
+
// declaration and the call's callee as the name referring to it.
|
|
16435
|
+
(0, import_datalog2.rule)(
|
|
16436
|
+
"callsFunction",
|
|
16437
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("f")],
|
|
16438
|
+
[
|
|
16439
|
+
(0, import_datalog2.lit)("moduleExport", (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("f")),
|
|
16440
|
+
(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("d"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")),
|
|
16441
|
+
(0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("d")),
|
|
16442
|
+
(0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c"))
|
|
16443
|
+
]
|
|
16444
|
+
),
|
|
16445
|
+
// What an object contains, its base class included, so a method the base
|
|
16446
|
+
// declares is found on a subclass that never overrode it. A method both
|
|
16447
|
+
// declare gives two, and the caller decides. This is its own relation
|
|
16448
|
+
// rather than more `holdsProperty`, which stays something an adapter
|
|
16449
|
+
// states and the rules only read.
|
|
16450
|
+
(0, import_datalog2.rule)(
|
|
16451
|
+
"contains",
|
|
16452
|
+
[(0, import_datalog2.variable)("o"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("held")],
|
|
16453
|
+
[(0, import_datalog2.lit)("holdsProperty", (0, import_datalog2.variable)("o"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("held"))]
|
|
16454
|
+
),
|
|
16455
|
+
(0, import_datalog2.rule)(
|
|
16456
|
+
"contains",
|
|
16457
|
+
[(0, import_datalog2.variable)("cls"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("held")],
|
|
16458
|
+
[
|
|
16459
|
+
(0, import_datalog2.lit)("extends", (0, import_datalog2.variable)("cls"), (0, import_datalog2.variable)("base")),
|
|
16460
|
+
(0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("base"), (0, import_datalog2.variable)("baseCls")),
|
|
16461
|
+
(0, import_datalog2.lit)("contains", (0, import_datalog2.variable)("baseCls"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("held"))
|
|
16462
|
+
]
|
|
16463
|
+
),
|
|
16464
|
+
// Which function a factory returns, and which of its parameters that
|
|
16465
|
+
// function calls: together they are what makes it a wrapper.
|
|
16466
|
+
(0, import_datalog2.rule)(
|
|
16467
|
+
"returnsFunc",
|
|
16468
|
+
[(0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("g")],
|
|
16469
|
+
[
|
|
16470
|
+
(0, import_datalog2.lit)("returnsValue", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("value")),
|
|
16471
|
+
(0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("value"), (0, import_datalog2.variable)("g")),
|
|
16472
|
+
(0, import_datalog2.lit)("func", (0, import_datalog2.variable)("g"))
|
|
16473
|
+
]
|
|
16474
|
+
),
|
|
16475
|
+
// A call made by a nested closure counts as made by the function
|
|
16476
|
+
// that declares it; the closure runs as part of that function.
|
|
16477
|
+
(0, import_datalog2.rule)("bodyCallsDeep", [(0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("c")], [(0, import_datalog2.lit)("bodyCalls", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("c"))]),
|
|
16478
|
+
(0, import_datalog2.rule)(
|
|
16479
|
+
"bodyCallsDeep",
|
|
16480
|
+
[(0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("c")],
|
|
16481
|
+
[(0, import_datalog2.lit)("containsFn", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("g")), (0, import_datalog2.lit)("bodyCallsDeep", (0, import_datalog2.variable)("g"), (0, import_datalog2.variable)("c"))]
|
|
16482
|
+
),
|
|
16483
|
+
(0, import_datalog2.rule)(
|
|
16484
|
+
"unwraps",
|
|
16485
|
+
[(0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("k")],
|
|
16486
|
+
[
|
|
16487
|
+
(0, import_datalog2.lit)("returnsFunc", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("g")),
|
|
16488
|
+
(0, import_datalog2.lit)("bodyCallsDeep", (0, import_datalog2.variable)("g"), (0, import_datalog2.variable)("c")),
|
|
16489
|
+
(0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("p")),
|
|
16490
|
+
(0, import_datalog2.lit)("paramOf", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("k"), (0, import_datalog2.variable)("p"))
|
|
16491
|
+
]
|
|
16492
|
+
),
|
|
16493
|
+
// Argument flow: which parameter a value traces back to. Directly
|
|
16494
|
+
// (an identifier bound to the parameter), or through a call to
|
|
16495
|
+
// another unwrapping factory. This is what lets
|
|
16496
|
+
// `createProtected(h) { return service.withAuth(h); }` unwrap:
|
|
16497
|
+
// the returned call passes h through withAuth, which unwraps.
|
|
16498
|
+
(0, import_datalog2.rule)(
|
|
16499
|
+
"flowsToParam",
|
|
16500
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("p")],
|
|
16501
|
+
[
|
|
16502
|
+
(0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("p")),
|
|
16503
|
+
(0, import_datalog2.lit)("paramOf", (0, import_datalog2.variable)("anyF"), (0, import_datalog2.variable)("anyK"), (0, import_datalog2.variable)("p"))
|
|
16504
|
+
]
|
|
16505
|
+
),
|
|
16506
|
+
(0, import_datalog2.rule)(
|
|
16507
|
+
"flowsToParam",
|
|
16508
|
+
[(0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("p")],
|
|
16509
|
+
[
|
|
16510
|
+
(0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c")),
|
|
16511
|
+
(0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("f")),
|
|
16512
|
+
(0, import_datalog2.lit)("unwraps", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("k")),
|
|
16513
|
+
(0, import_datalog2.lit)("callArg", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("k"), (0, import_datalog2.variable)("a")),
|
|
16514
|
+
(0, import_datalog2.lit)("flowsToParam", (0, import_datalog2.variable)("a"), (0, import_datalog2.variable)("p"))
|
|
16515
|
+
]
|
|
16516
|
+
),
|
|
16517
|
+
(0, import_datalog2.rule)(
|
|
16518
|
+
"unwraps",
|
|
16519
|
+
[(0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("k")],
|
|
16520
|
+
[
|
|
16521
|
+
(0, import_datalog2.lit)("returnsValue", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("value")),
|
|
16522
|
+
(0, import_datalog2.lit)("flowsToParam", (0, import_datalog2.variable)("value"), (0, import_datalog2.variable)("p")),
|
|
16523
|
+
(0, import_datalog2.lit)("paramOf", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("k"), (0, import_datalog2.variable)("p"))
|
|
16524
|
+
]
|
|
16525
|
+
),
|
|
16526
|
+
// Where a name comes from, when what it refers to lives outside the
|
|
16527
|
+
// source being read. A walk ends at something written out in source,
|
|
16528
|
+
// so it never reaches a library's own function.
|
|
16529
|
+
(0, import_datalog2.rule)(
|
|
16530
|
+
"comesFrom",
|
|
16531
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")],
|
|
16532
|
+
[(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))]
|
|
16533
|
+
),
|
|
16534
|
+
(0, import_datalog2.rule)(
|
|
16535
|
+
"comesFrom",
|
|
16536
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")],
|
|
16537
|
+
[
|
|
16538
|
+
(0, import_datalog2.lit)("reaches", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"), VALUE_STEP),
|
|
16539
|
+
(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))
|
|
16540
|
+
]
|
|
16541
|
+
),
|
|
16542
|
+
// Calling f ends up calling the name n that module m exports, one
|
|
16543
|
+
// hop through f's own body or deeper through a wrapper of a wrapper.
|
|
16544
|
+
// Several results is normal: a composed decorator applies them all.
|
|
16545
|
+
(0, import_datalog2.rule)(
|
|
16546
|
+
"callsInto",
|
|
16547
|
+
[(0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")],
|
|
16548
|
+
[
|
|
16549
|
+
(0, import_datalog2.lit)("bodyCallsDeep", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("c")),
|
|
16550
|
+
(0, import_datalog2.lit)("comesFrom", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))
|
|
16551
|
+
]
|
|
16552
|
+
),
|
|
16553
|
+
(0, import_datalog2.rule)(
|
|
16554
|
+
"callsInto",
|
|
16555
|
+
[(0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")],
|
|
16556
|
+
[
|
|
16557
|
+
(0, import_datalog2.lit)("bodyCallsDeep", (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("c")),
|
|
16558
|
+
(0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("g")),
|
|
16559
|
+
(0, import_datalog2.lit)("callsInto", (0, import_datalog2.variable)("g"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))
|
|
16560
|
+
]
|
|
16561
|
+
),
|
|
16562
|
+
// The question callers ask: what a value comes to, narrowed to the
|
|
16563
|
+
// functions. Objects appear in the middle of chains and never in an
|
|
16564
|
+
// answer.
|
|
16565
|
+
(0, import_datalog2.rule)(
|
|
16566
|
+
"resolves",
|
|
16567
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16568
|
+
[(0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")), (0, import_datalog2.lit)("func", (0, import_datalog2.variable)("z"))]
|
|
16569
|
+
)
|
|
16570
|
+
];
|
|
16571
|
+
var RESOLUTION_QUESTIONS = [
|
|
16572
|
+
(0, import_datalog2.rule)(
|
|
16573
|
+
"wantedResolves",
|
|
16574
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16575
|
+
[(0, import_datalog2.lit)("wanted", (0, import_datalog2.variable)("x")), (0, import_datalog2.lit)("resolves", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"))]
|
|
16576
|
+
),
|
|
16577
|
+
(0, import_datalog2.rule)(
|
|
16578
|
+
"wantedComesTo",
|
|
16579
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16580
|
+
[(0, import_datalog2.lit)("wanted", (0, import_datalog2.variable)("x")), (0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"))]
|
|
16581
|
+
),
|
|
16582
|
+
(0, import_datalog2.rule)(
|
|
16583
|
+
"wantedComesTo",
|
|
16584
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16585
|
+
[(0, import_datalog2.lit)("wantedOrigin", (0, import_datalog2.variable)("x")), (0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"))]
|
|
16586
|
+
),
|
|
16587
|
+
(0, import_datalog2.rule)(
|
|
16588
|
+
"wantedIsWrittenAs",
|
|
16589
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16590
|
+
[(0, import_datalog2.lit)("wanted", (0, import_datalog2.variable)("x")), (0, import_datalog2.lit)("isWrittenAs", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"))]
|
|
16591
|
+
),
|
|
16592
|
+
// A call is given no `comesTo`, so this is the only way to ask what
|
|
16593
|
+
// object one arrives at, and without it a demand-driven run derives
|
|
16594
|
+
// `objectOf` nowhere.
|
|
16595
|
+
(0, import_datalog2.rule)(
|
|
16596
|
+
"wantedObjectOf",
|
|
16597
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16598
|
+
[(0, import_datalog2.lit)("wanted", (0, import_datalog2.variable)("x")), (0, import_datalog2.lit)("objectOf", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"))]
|
|
16599
|
+
),
|
|
16600
|
+
// Keyed by the parameter, since that is what a caller has in hand
|
|
16601
|
+
// when it wants the call sites told apart.
|
|
16602
|
+
(0, import_datalog2.rule)(
|
|
16603
|
+
"wantedParamAt",
|
|
16604
|
+
[(0, import_datalog2.variable)("p"), (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("z")],
|
|
16605
|
+
[(0, import_datalog2.lit)("wanted", (0, import_datalog2.variable)("p")), (0, import_datalog2.lit)("paramAt", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("p"), (0, import_datalog2.variable)("z"))]
|
|
16606
|
+
),
|
|
16607
|
+
(0, import_datalog2.rule)(
|
|
16608
|
+
"wantedComesFrom",
|
|
16609
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")],
|
|
16610
|
+
[(0, import_datalog2.lit)("wantedOrigin", (0, import_datalog2.variable)("x")), (0, import_datalog2.lit)("comesFrom", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))]
|
|
16611
|
+
),
|
|
16612
|
+
// Call-origin questions, for attribution, in their own demand
|
|
16613
|
+
// class. Attribution stops at the import declaration, so nothing
|
|
16614
|
+
// here demands reaches or callsInto. The chains are closures with
|
|
16615
|
+
// no depth bound: an alias run of any length resolves.
|
|
16616
|
+
(0, import_datalog2.rule)("callOriginChain", [(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("x")], [(0, import_datalog2.lit)("wantedCallOrigin", (0, import_datalog2.variable)("x"))]),
|
|
16617
|
+
(0, import_datalog2.rule)(
|
|
16618
|
+
"callOriginChain",
|
|
16619
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16620
|
+
[(0, import_datalog2.lit)("callOriginChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")), (0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))]
|
|
16621
|
+
),
|
|
16622
|
+
(0, import_datalog2.rule)(
|
|
16623
|
+
"callOriginChain",
|
|
16624
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16625
|
+
[
|
|
16626
|
+
(0, import_datalog2.lit)("callOriginChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")),
|
|
16627
|
+
(0, import_datalog2.lit)("endsHolding", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))
|
|
16628
|
+
]
|
|
16629
|
+
),
|
|
16630
|
+
(0, import_datalog2.rule)(
|
|
16631
|
+
"callOriginChain",
|
|
16632
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16633
|
+
[
|
|
16634
|
+
(0, import_datalog2.lit)("callOriginChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")),
|
|
16635
|
+
(0, import_datalog2.lit)("fallbackBranch", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))
|
|
16636
|
+
]
|
|
16637
|
+
),
|
|
16638
|
+
// The chain with at least one hop taken, which is what tells a
|
|
16639
|
+
// destructured binding apart from asking about a node directly.
|
|
16640
|
+
(0, import_datalog2.rule)(
|
|
16641
|
+
"callOriginChainStepped",
|
|
16642
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16643
|
+
[(0, import_datalog2.lit)("callOriginChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")), (0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))]
|
|
16644
|
+
),
|
|
16645
|
+
(0, import_datalog2.rule)(
|
|
16646
|
+
"callOriginChainStepped",
|
|
16647
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16648
|
+
[
|
|
16649
|
+
(0, import_datalog2.lit)("callOriginChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")),
|
|
16650
|
+
(0, import_datalog2.lit)("endsHolding", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))
|
|
16651
|
+
]
|
|
16652
|
+
),
|
|
16653
|
+
(0, import_datalog2.rule)(
|
|
16654
|
+
"callOriginChainStepped",
|
|
16655
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16656
|
+
[
|
|
16657
|
+
(0, import_datalog2.lit)("callOriginChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")),
|
|
16658
|
+
(0, import_datalog2.lit)("fallbackBranch", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))
|
|
16659
|
+
]
|
|
16660
|
+
),
|
|
16661
|
+
(0, import_datalog2.rule)(
|
|
16662
|
+
"wantedCallOriginPair",
|
|
16663
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")],
|
|
16664
|
+
[
|
|
16665
|
+
(0, import_datalog2.lit)("callOriginChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")),
|
|
16666
|
+
(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))
|
|
16667
|
+
]
|
|
16668
|
+
),
|
|
16669
|
+
// An import of a project barrel is an import of what the barrel
|
|
16670
|
+
// forwards, so the pair surfaces the module behind the chain.
|
|
16671
|
+
(0, import_datalog2.rule)(
|
|
16672
|
+
"wantedCallOriginPair",
|
|
16673
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m2"), (0, import_datalog2.variable)("n2")],
|
|
16674
|
+
[
|
|
16675
|
+
(0, import_datalog2.lit)("callOriginChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")),
|
|
16676
|
+
(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")),
|
|
16677
|
+
(0, import_datalog2.lit)("moduleForwards", (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("m2"), (0, import_datalog2.variable)("n2"))
|
|
16678
|
+
]
|
|
16679
|
+
),
|
|
16680
|
+
// A namespace member: the module's export of the member's own name.
|
|
16681
|
+
// The imports literal leads, since it is the smallest relation.
|
|
16682
|
+
(0, import_datalog2.rule)(
|
|
16683
|
+
"wantedCallOriginPair",
|
|
16684
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("p")],
|
|
16685
|
+
[
|
|
16686
|
+
(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("o"), (0, import_datalog2.variable)("m"), NAMESPACE_IMPORT),
|
|
16687
|
+
(0, import_datalog2.lit)("readsProperty", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("o"), (0, import_datalog2.variable)("p")),
|
|
16688
|
+
(0, import_datalog2.lit)("callOriginChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"))
|
|
16689
|
+
]
|
|
16690
|
+
),
|
|
16691
|
+
(0, import_datalog2.rule)(
|
|
16692
|
+
"wantedCallOriginPair",
|
|
16693
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("p")],
|
|
16694
|
+
[
|
|
16695
|
+
(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("d"), (0, import_datalog2.variable)("m"), NAMESPACE_IMPORT),
|
|
16696
|
+
(0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("o"), (0, import_datalog2.variable)("d")),
|
|
16697
|
+
(0, import_datalog2.lit)("readsProperty", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("o"), (0, import_datalog2.variable)("p")),
|
|
16698
|
+
(0, import_datalog2.lit)("callOriginChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"))
|
|
16699
|
+
]
|
|
16700
|
+
),
|
|
16701
|
+
// What a call made: through the call to its callee, whose own alias
|
|
16702
|
+
// chain leads to the import.
|
|
16703
|
+
(0, import_datalog2.rule)(
|
|
16704
|
+
"callMadeChain",
|
|
16705
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("f")],
|
|
16706
|
+
[(0, import_datalog2.lit)("callOriginChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("c")), (0, import_datalog2.lit)("call", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("f"))]
|
|
16707
|
+
),
|
|
16708
|
+
(0, import_datalog2.rule)(
|
|
16709
|
+
"callMadeChain",
|
|
16710
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16711
|
+
[(0, import_datalog2.lit)("callMadeChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")), (0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))]
|
|
16712
|
+
),
|
|
16713
|
+
(0, import_datalog2.rule)(
|
|
16714
|
+
"callMadeChain",
|
|
16715
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16716
|
+
[(0, import_datalog2.lit)("callMadeChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")), (0, import_datalog2.lit)("endsHolding", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))]
|
|
16717
|
+
),
|
|
16718
|
+
(0, import_datalog2.rule)(
|
|
16719
|
+
"wantedCallOriginPair",
|
|
16720
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")],
|
|
16721
|
+
[
|
|
16722
|
+
(0, import_datalog2.lit)("callMadeChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")),
|
|
16723
|
+
(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))
|
|
16724
|
+
]
|
|
16725
|
+
),
|
|
16726
|
+
// A member destructured off what a call made keeps the member name
|
|
16727
|
+
// as one more path segment.
|
|
16728
|
+
(0, import_datalog2.rule)(
|
|
16729
|
+
"callMemberChain",
|
|
16730
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("f"), (0, import_datalog2.variable)("p")],
|
|
16731
|
+
[
|
|
16732
|
+
(0, import_datalog2.lit)("callOriginChainStepped", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("e")),
|
|
16733
|
+
(0, import_datalog2.lit)("readsProperty", (0, import_datalog2.variable)("e"), (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("p")),
|
|
16734
|
+
(0, import_datalog2.lit)("call", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("f"))
|
|
16735
|
+
]
|
|
16736
|
+
),
|
|
16737
|
+
(0, import_datalog2.rule)(
|
|
16738
|
+
"callMemberChain",
|
|
16739
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), (0, import_datalog2.variable)("p")],
|
|
16740
|
+
[
|
|
16741
|
+
(0, import_datalog2.lit)("callMemberChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("p")),
|
|
16742
|
+
(0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))
|
|
16743
|
+
]
|
|
16744
|
+
),
|
|
16745
|
+
(0, import_datalog2.rule)(
|
|
16746
|
+
"callMemberChain",
|
|
16747
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z"), (0, import_datalog2.variable)("p")],
|
|
16748
|
+
[
|
|
16749
|
+
(0, import_datalog2.lit)("callMemberChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("p")),
|
|
16750
|
+
(0, import_datalog2.lit)("endsHolding", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))
|
|
16751
|
+
]
|
|
16752
|
+
),
|
|
16753
|
+
(0, import_datalog2.rule)(
|
|
16754
|
+
"wantedCallOriginMember",
|
|
16755
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("p")],
|
|
16756
|
+
[
|
|
16757
|
+
(0, import_datalog2.lit)("callMemberChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("p")),
|
|
16758
|
+
(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))
|
|
16759
|
+
]
|
|
16760
|
+
),
|
|
16761
|
+
(0, import_datalog2.rule)(
|
|
16762
|
+
"wantedCallsInto",
|
|
16763
|
+
[(0, import_datalog2.variable)("g"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")],
|
|
16764
|
+
[
|
|
16765
|
+
(0, import_datalog2.lit)("wantedOrigin", (0, import_datalog2.variable)("x")),
|
|
16766
|
+
(0, import_datalog2.lit)("comesTo", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("g")),
|
|
16767
|
+
(0, import_datalog2.lit)("callsInto", (0, import_datalog2.variable)("g"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))
|
|
16768
|
+
]
|
|
16769
|
+
),
|
|
16770
|
+
// Subject identity, its own demand class; the README's subject
|
|
16771
|
+
// section says why the origin pair rides on the written-value walk.
|
|
16772
|
+
(0, import_datalog2.rule)(
|
|
16773
|
+
"wantedSubjectWritten",
|
|
16774
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("r")],
|
|
16775
|
+
[(0, import_datalog2.lit)("wantedSubject", (0, import_datalog2.variable)("x")), (0, import_datalog2.lit)("isWrittenAs", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("r"))]
|
|
16776
|
+
),
|
|
16777
|
+
(0, import_datalog2.rule)(
|
|
16778
|
+
"wantedSubjectConstruction",
|
|
16779
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")],
|
|
16780
|
+
[
|
|
16781
|
+
(0, import_datalog2.lit)("wantedSubject", (0, import_datalog2.variable)("x")),
|
|
16782
|
+
(0, import_datalog2.lit)("isWrittenAs", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("r")),
|
|
16783
|
+
(0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c")),
|
|
16784
|
+
(0, import_datalog2.lit)("comesFrom", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"))
|
|
16785
|
+
]
|
|
16786
|
+
),
|
|
16787
|
+
// The export table of one module, keyed by the module asked about.
|
|
16788
|
+
// The moduleExport rules flatten re-export chains of any length, and
|
|
16789
|
+
// the demand cone stays on export facts alone.
|
|
16790
|
+
(0, import_datalog2.rule)(
|
|
16791
|
+
"wantedModuleExport",
|
|
16792
|
+
[(0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("value")],
|
|
16793
|
+
[
|
|
16794
|
+
(0, import_datalog2.lit)("wantedExportsOf", (0, import_datalog2.variable)("m")),
|
|
16795
|
+
(0, import_datalog2.lit)("moduleExport", (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("value"))
|
|
16796
|
+
]
|
|
16797
|
+
),
|
|
16798
|
+
// The calls behind a receiver, for a pack that wants the anchor a
|
|
16799
|
+
// chain hangs off; the README's anchor section says which hops and
|
|
16800
|
+
// why the asking side applies the single-answer policy.
|
|
16801
|
+
// A class's ancestry, one hop per extends through the binding that
|
|
16802
|
+
// says which class the written base is; the names on the way out
|
|
16803
|
+
// are what a storage pack matches its library's bases against.
|
|
16804
|
+
(0, import_datalog2.rule)("ancestryChain", [(0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("c")], [(0, import_datalog2.lit)("wantedAncestry", (0, import_datalog2.variable)("c"))]),
|
|
16805
|
+
(0, import_datalog2.rule)(
|
|
16806
|
+
"ancestryChain",
|
|
16807
|
+
[(0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("b2")],
|
|
16808
|
+
[
|
|
16809
|
+
(0, import_datalog2.lit)("ancestryChain", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("b")),
|
|
16810
|
+
(0, import_datalog2.lit)("extends", (0, import_datalog2.variable)("b"), (0, import_datalog2.variable)("x")),
|
|
16811
|
+
(0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("b2"))
|
|
16812
|
+
]
|
|
16813
|
+
),
|
|
16814
|
+
(0, import_datalog2.rule)(
|
|
16815
|
+
"wantedBaseName",
|
|
16816
|
+
[(0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("n")],
|
|
16817
|
+
[(0, import_datalog2.lit)("ancestryChain", (0, import_datalog2.variable)("c"), (0, import_datalog2.variable)("b")), (0, import_datalog2.lit)("extendsNamed", (0, import_datalog2.variable)("b"), (0, import_datalog2.variable)("n"))]
|
|
16818
|
+
),
|
|
16819
|
+
(0, import_datalog2.rule)("anchorChain", [(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("x")], [(0, import_datalog2.lit)("wantedAnchor", (0, import_datalog2.variable)("x"))]),
|
|
16820
|
+
(0, import_datalog2.rule)(
|
|
16821
|
+
"anchorChain",
|
|
16822
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16823
|
+
[(0, import_datalog2.lit)("anchorChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")), (0, import_datalog2.lit)("binds", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))]
|
|
16824
|
+
),
|
|
16825
|
+
(0, import_datalog2.rule)(
|
|
16826
|
+
"anchorChain",
|
|
16827
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16828
|
+
[(0, import_datalog2.lit)("anchorChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")), (0, import_datalog2.lit)("endsHolding", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))]
|
|
16829
|
+
),
|
|
16830
|
+
(0, import_datalog2.rule)(
|
|
16831
|
+
"anchorChain",
|
|
16832
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16833
|
+
[(0, import_datalog2.lit)("anchorChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")), (0, import_datalog2.lit)("fallbackBranch", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("z"))]
|
|
16834
|
+
),
|
|
16835
|
+
(0, import_datalog2.rule)(
|
|
16836
|
+
"anchorChain",
|
|
16837
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("z")],
|
|
16838
|
+
[
|
|
16839
|
+
(0, import_datalog2.lit)("anchorChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")),
|
|
16840
|
+
(0, import_datalog2.lit)("imports", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n")),
|
|
16841
|
+
(0, import_datalog2.lit)("moduleExport", (0, import_datalog2.variable)("m"), (0, import_datalog2.variable)("n"), (0, import_datalog2.variable)("z"))
|
|
16842
|
+
]
|
|
16843
|
+
),
|
|
16844
|
+
(0, import_datalog2.rule)(
|
|
16845
|
+
"anchorChain",
|
|
16846
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("c")],
|
|
16847
|
+
[(0, import_datalog2.lit)("anchorChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("r")), (0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c"))]
|
|
16848
|
+
),
|
|
16849
|
+
(0, import_datalog2.rule)(
|
|
16850
|
+
"anchorChain",
|
|
16851
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("o")],
|
|
16852
|
+
[
|
|
16853
|
+
(0, import_datalog2.lit)("anchorChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("y")),
|
|
16854
|
+
(0, import_datalog2.lit)("readsProperty", (0, import_datalog2.variable)("y"), (0, import_datalog2.variable)("o"), (0, import_datalog2.variable)("n"))
|
|
16855
|
+
]
|
|
16856
|
+
),
|
|
16857
|
+
(0, import_datalog2.rule)(
|
|
16858
|
+
"wantedAnchorCall",
|
|
16859
|
+
[(0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("r")],
|
|
16860
|
+
[(0, import_datalog2.lit)("anchorChain", (0, import_datalog2.variable)("x"), (0, import_datalog2.variable)("r")), (0, import_datalog2.lit)("call", (0, import_datalog2.variable)("r"), (0, import_datalog2.variable)("c"))]
|
|
16861
|
+
)
|
|
16862
|
+
];
|
|
16863
|
+
var ANSWER_RELATIONS = [
|
|
16864
|
+
...new Set(RESOLUTION_QUESTIONS.map((r) => r.head.relation))
|
|
16865
|
+
];
|
|
16866
|
+
|
|
16006
16867
|
// src/storage.ts
|
|
16007
16868
|
function children2(node) {
|
|
16008
16869
|
return node.namedChildren.filter((child) => child !== null);
|
|
@@ -16023,21 +16884,17 @@ function rootConstant(node) {
|
|
|
16023
16884
|
}
|
|
16024
16885
|
return rootConstant(receiver);
|
|
16025
16886
|
}
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
}
|
|
16035
|
-
return facts.facts("extends").filter((row) => String(row[0]) === classKey).flatMap(
|
|
16036
|
-
(row) => facts.facts("binds").filter((bound) => String(bound[0]) === String(row[1])).map((bound) => String(bound[1]))
|
|
16037
|
-
).some((next) => reachesBase(facts, next, bases, seen));
|
|
16887
|
+
var ANCESTRY_PROGRAM = (0, import_datalog3.deriveOnDemand)(
|
|
16888
|
+
[...RESOLUTION_RULES, ...RESOLUTION_QUESTIONS],
|
|
16889
|
+
ANSWER_RELATIONS
|
|
16890
|
+
);
|
|
16891
|
+
function reachesBase(facts, classKey, bases) {
|
|
16892
|
+
facts.add("wantedAncestry", [classKey]);
|
|
16893
|
+
(0, import_datalog3.evaluate)(facts, ANCESTRY_PROGRAM.rules);
|
|
16894
|
+
return facts.lookup("wantedBaseName", 0, classKey).some((row) => bases.includes(String(row[1])));
|
|
16038
16895
|
}
|
|
16039
|
-
function classBehind(facts,
|
|
16040
|
-
const wanted = `#${
|
|
16896
|
+
function classBehind(facts, constant2) {
|
|
16897
|
+
const wanted = `#${constant2.text}`;
|
|
16041
16898
|
const bound = new Set(
|
|
16042
16899
|
facts.facts("binds").filter((row) => String(row[0]).endsWith(wanted)).map((row) => String(row[1]))
|
|
16043
16900
|
);
|
|
@@ -16080,11 +16937,11 @@ function storageEffects(calls, options) {
|
|
|
16080
16937
|
if (partOfOne.has(call.id)) {
|
|
16081
16938
|
continue;
|
|
16082
16939
|
}
|
|
16083
|
-
const
|
|
16084
|
-
if (
|
|
16940
|
+
const constant2 = rootConstant(call);
|
|
16941
|
+
if (constant2 === null) {
|
|
16085
16942
|
continue;
|
|
16086
16943
|
}
|
|
16087
|
-
const classKey = classBehind(options.facts,
|
|
16944
|
+
const classKey = classBehind(options.facts, constant2);
|
|
16088
16945
|
if (classKey === void 0) {
|
|
16089
16946
|
continue;
|
|
16090
16947
|
}
|
|
@@ -16102,7 +16959,7 @@ function storageEffects(calls, options) {
|
|
|
16102
16959
|
recognition: "ruby-storage",
|
|
16103
16960
|
storageSystem: pattern.storageSystem,
|
|
16104
16961
|
scope: pattern.baseClasses[0] ?? "",
|
|
16105
|
-
container:
|
|
16962
|
+
container: constant2.text
|
|
16106
16963
|
}),
|
|
16107
16964
|
callee: call.text,
|
|
16108
16965
|
interaction: {
|
|
@@ -16274,7 +17131,10 @@ async function graphqlObjectFieldUnits(pattern, pack, info, ownBlocks, fileBlock
|
|
|
16274
17131
|
const knownClasses = ownBlocks[0]?.knownClasses ?? /* @__PURE__ */ new Set();
|
|
16275
17132
|
const scope = { nesting: info.bodyNesting, knownClasses };
|
|
16276
17133
|
const declsByName = /* @__PURE__ */ new Map();
|
|
16277
|
-
for (const stmt of
|
|
17134
|
+
for (const stmt of runStatements(
|
|
17135
|
+
info.bodyNode,
|
|
17136
|
+
blockConfiguresCall(pattern)
|
|
17137
|
+
)) {
|
|
16278
17138
|
const decl = await readFieldCall(stmt, scope, ctx, ancestry);
|
|
16279
17139
|
if (decl !== null) {
|
|
16280
17140
|
declsByName.set(decl.fieldName, decl);
|
|
@@ -16284,6 +17144,17 @@ async function graphqlObjectFieldUnits(pattern, pack, info, ownBlocks, fileBlock
|
|
|
16284
17144
|
(decl) => buildFieldUnit(pack, typeName, decl, options.filePath)
|
|
16285
17145
|
);
|
|
16286
17146
|
}
|
|
17147
|
+
function blockConfiguresCall(pattern) {
|
|
17148
|
+
const names = /* @__PURE__ */ new Set([
|
|
17149
|
+
pattern.fieldCallName,
|
|
17150
|
+
pattern.typeCallName,
|
|
17151
|
+
pattern.argumentCallName
|
|
17152
|
+
]);
|
|
17153
|
+
return (call) => {
|
|
17154
|
+
const method = field(call, "method")?.text;
|
|
17155
|
+
return field(call, "receiver") === null && method !== void 0 && names.has(method);
|
|
17156
|
+
};
|
|
17157
|
+
}
|
|
16287
17158
|
function branchesFor(body, range) {
|
|
16288
17159
|
if (body.effects === void 0 && body.extraEffects === void 0) {
|
|
16289
17160
|
return [];
|
|
@@ -16359,10 +17230,13 @@ async function readFieldCall(stmt, scope, ctx, ancestry) {
|
|
|
16359
17230
|
}
|
|
16360
17231
|
const callArgs = readCallArgs(field(stmt, "arguments"));
|
|
16361
17232
|
const nameArg = callArgs.positional[0];
|
|
16362
|
-
|
|
16363
|
-
if (symbol2 === null) {
|
|
17233
|
+
if (nameArg === void 0) {
|
|
16364
17234
|
return null;
|
|
16365
17235
|
}
|
|
17236
|
+
const symbol2 = symbolValue(nameArg);
|
|
17237
|
+
if (symbol2 === null) {
|
|
17238
|
+
return computedNameDeclaration(stmt, nameArg);
|
|
17239
|
+
}
|
|
16366
17240
|
const read = await readFieldShape(
|
|
16367
17241
|
symbol2,
|
|
16368
17242
|
callArgs,
|
|
@@ -16373,11 +17247,29 @@ async function readFieldCall(stmt, scope, ctx, ancestry) {
|
|
|
16373
17247
|
);
|
|
16374
17248
|
return {
|
|
16375
17249
|
fieldName: resolvedName(symbol2, callArgs, ctx.pattern),
|
|
17250
|
+
namedOnTheWire: true,
|
|
16376
17251
|
node: stmt,
|
|
16377
17252
|
contract: read.contract,
|
|
16378
17253
|
body: read.body
|
|
16379
17254
|
};
|
|
16380
17255
|
}
|
|
17256
|
+
function computedNameDeclaration(stmt, nameArg) {
|
|
17257
|
+
const range = rangeOf(stmt);
|
|
17258
|
+
return {
|
|
17259
|
+
fieldName: nameArg.text,
|
|
17260
|
+
namedOnTheWire: false,
|
|
17261
|
+
node: stmt,
|
|
17262
|
+
contract: null,
|
|
17263
|
+
body: {
|
|
17264
|
+
readings: [
|
|
17265
|
+
(0, import_extractor3.unreadableReading)(
|
|
17266
|
+
`This field is named by ${nameArg.text}, which is worked out when the class body runs, so the name the schema exposes it under was not read here`,
|
|
17267
|
+
range
|
|
17268
|
+
)
|
|
17269
|
+
]
|
|
17270
|
+
}
|
|
17271
|
+
};
|
|
17272
|
+
}
|
|
16381
17273
|
function wiringReference(callArgs, wiringKeywords) {
|
|
16382
17274
|
for (const keyword of wiringKeywords) {
|
|
16383
17275
|
const ref = callArgs.keyword[keyword];
|
|
@@ -16502,7 +17394,10 @@ function readClassContract(ancestry, pattern) {
|
|
|
16502
17394
|
args: /* @__PURE__ */ new Map()
|
|
16503
17395
|
};
|
|
16504
17396
|
const handlers = classCallHandlers(pattern);
|
|
16505
|
-
for (const { block, statement } of inheritedStatements(
|
|
17397
|
+
for (const { block, statement } of inheritedStatements(
|
|
17398
|
+
ancestry,
|
|
17399
|
+
blockConfiguresCall(pattern)
|
|
17400
|
+
)) {
|
|
16506
17401
|
if (statement.type !== "call" || field(statement, "receiver") !== null) {
|
|
16507
17402
|
continue;
|
|
16508
17403
|
}
|
|
@@ -16589,15 +17484,16 @@ function buildFieldUnit(pack, typeName, decl, filePath) {
|
|
|
16589
17484
|
kind: "resolver",
|
|
16590
17485
|
file: filePath,
|
|
16591
17486
|
range: rangeOf(decl.node),
|
|
17487
|
+
span: spanOf(decl.node),
|
|
16592
17488
|
exportName: null,
|
|
16593
17489
|
exportPath: null
|
|
16594
17490
|
},
|
|
16595
|
-
boundaryBinding: (0, import_behavioral_ir.graphqlResolverBinding)({
|
|
17491
|
+
boundaryBinding: decl.namedOnTheWire ? (0, import_behavioral_ir.graphqlResolverBinding)({
|
|
16596
17492
|
transport: pack.protocol,
|
|
16597
17493
|
recognition: pack.name,
|
|
16598
17494
|
typeName,
|
|
16599
17495
|
fieldName: decl.fieldName
|
|
16600
|
-
}),
|
|
17496
|
+
}) : null,
|
|
16601
17497
|
parameters,
|
|
16602
17498
|
branches: branchesFor(decl.body, rangeOf(decl.node)),
|
|
16603
17499
|
...decl.body.bodyContent !== void 0 ? { bodyContent: decl.body.bodyContent } : {},
|
|
@@ -16658,7 +17554,7 @@ async function parseRuby(source) {
|
|
|
16658
17554
|
// src/project.ts
|
|
16659
17555
|
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
16660
17556
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
16661
|
-
var
|
|
17557
|
+
var import_datalog4 = require("@suss/datalog");
|
|
16662
17558
|
var import_extractor4 = require("@suss/extractor");
|
|
16663
17559
|
|
|
16664
17560
|
// src/facts/values.ts
|
|
@@ -16668,14 +17564,6 @@ function nodeId(filePath, node) {
|
|
|
16668
17564
|
function nameId(filePath, name) {
|
|
16669
17565
|
return `${filePath}#${name}`;
|
|
16670
17566
|
}
|
|
16671
|
-
var DECLARATION_TYPES2 = /* @__PURE__ */ new Set([
|
|
16672
|
-
"method",
|
|
16673
|
-
"singleton_method",
|
|
16674
|
-
"lambda",
|
|
16675
|
-
"class",
|
|
16676
|
-
"module",
|
|
16677
|
-
"singleton_class"
|
|
16678
|
-
]);
|
|
16679
17567
|
var WRITTEN_VALUE_TYPES = /* @__PURE__ */ new Set([
|
|
16680
17568
|
"string",
|
|
16681
17569
|
"integer",
|
|
@@ -16813,7 +17701,7 @@ function emitHash(emitter, hash2) {
|
|
|
16813
17701
|
}
|
|
16814
17702
|
function walkExpressions(node, visit) {
|
|
16815
17703
|
for (const child of children3(node)) {
|
|
16816
|
-
if (
|
|
17704
|
+
if (OWN_BODY_TYPES.has(child.type)) {
|
|
16817
17705
|
continue;
|
|
16818
17706
|
}
|
|
16819
17707
|
visit(child);
|
|
@@ -16871,7 +17759,7 @@ function emitMethodFacts(emitter, method) {
|
|
|
16871
17759
|
}
|
|
16872
17760
|
const recordNested = (node) => {
|
|
16873
17761
|
for (const child of children3(node)) {
|
|
16874
|
-
if (
|
|
17762
|
+
if (OWN_BODY_TYPES.has(child.type)) {
|
|
16875
17763
|
add(emitter, "containsFn", funcKey, nodeId(emitter.filePath, child));
|
|
16876
17764
|
continue;
|
|
16877
17765
|
}
|
|
@@ -17101,7 +17989,7 @@ function emitConstantBindings(db, perFile) {
|
|
|
17101
17989
|
|
|
17102
17990
|
// src/project.ts
|
|
17103
17991
|
async function extractRubyProject(options) {
|
|
17104
|
-
const db = new
|
|
17992
|
+
const db = new import_datalog4.Database();
|
|
17105
17993
|
const summaries = [];
|
|
17106
17994
|
const constants = [];
|
|
17107
17995
|
const cache = createFileCache(
|