@neocompose/cli 0.89.8 → 0.89.9
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/CHANGELOG.md +12 -0
- package/dist/neo-runtime.mjs +1533 -446
- package/dist/test-worker.mjs +213 -23
- package/package.json +1 -1
- package/skills/neocompose-cli/SKILL.md +1 -1
- package/skills/neocompose-cli/references/cli-development.md +1 -1
- package/skills/neocompose-cli/references/declarations/constructors.md +20 -0
- package/skills/neocompose-cli/references/declarations/declarations.md +3 -0
- package/skills/neocompose-cli/references/neoscript/collections.md +2 -0
- package/skills/neocompose-cli/references/neoscript/delegates-and-listeners.md +2 -0
- package/skills/neocompose-cli/references/values/identities.md +9 -8
- package/skills/neocompose-cli/references/world/variants.md +5 -2
package/dist/neo-runtime.mjs
CHANGED
|
@@ -7354,42 +7354,6 @@ function descendantClassIdsInChildIndex(classId, childrenByClassId) {
|
|
|
7354
7354
|
}
|
|
7355
7355
|
return result;
|
|
7356
7356
|
}
|
|
7357
|
-
function addDependentMemberIds(memberIds, members2) {
|
|
7358
|
-
const childIdsByParentId = /* @__PURE__ */ new Map();
|
|
7359
|
-
const entryIdsByOwnerId = /* @__PURE__ */ new Map();
|
|
7360
|
-
const remainingOwnersByEntryId = /* @__PURE__ */ new Map();
|
|
7361
|
-
for (const member of members2) {
|
|
7362
|
-
if (member.extendsMemberId) {
|
|
7363
|
-
const children3 = childIdsByParentId.get(member.extendsMemberId);
|
|
7364
|
-
if (children3 === void 0) {
|
|
7365
|
-
childIdsByParentId.set(member.extendsMemberId, [member.id]);
|
|
7366
|
-
} else children3.push(member.id);
|
|
7367
|
-
}
|
|
7368
|
-
const entries = member.elementMemberIds ?? (member.entryMemberId ? [member.entryMemberId] : []);
|
|
7369
|
-
if (entries.length > 0) {
|
|
7370
|
-
entryIdsByOwnerId.set(member.id, entries);
|
|
7371
|
-
for (const entryId of entries)
|
|
7372
|
-
remainingOwnersByEntryId.set(
|
|
7373
|
-
entryId,
|
|
7374
|
-
(remainingOwnersByEntryId.get(entryId) ?? 0) + 1
|
|
7375
|
-
);
|
|
7376
|
-
}
|
|
7377
|
-
}
|
|
7378
|
-
const pending = [...memberIds];
|
|
7379
|
-
function include(memberId) {
|
|
7380
|
-
if (memberIds.has(memberId)) return;
|
|
7381
|
-
memberIds.add(memberId);
|
|
7382
|
-
pending.push(memberId);
|
|
7383
|
-
}
|
|
7384
|
-
for (let id2 = pending.pop(); id2 !== void 0; id2 = pending.pop()) {
|
|
7385
|
-
for (const childId of childIdsByParentId.get(id2) ?? []) include(childId);
|
|
7386
|
-
for (const entryId of entryIdsByOwnerId.get(id2) ?? []) {
|
|
7387
|
-
const remainingOwners = remainingOwnersByEntryId.get(entryId) - 1;
|
|
7388
|
-
remainingOwnersByEntryId.set(entryId, remainingOwners);
|
|
7389
|
-
if (remainingOwners === 0) include(entryId);
|
|
7390
|
-
}
|
|
7391
|
-
}
|
|
7392
|
-
}
|
|
7393
7357
|
var UnresolvedMemberInheritanceError, NO_CLASSES, NO_MEMBERS, resolvedClassSchemas;
|
|
7394
7358
|
var init_inheritance = __esm({
|
|
7395
7359
|
"../packages/models/src/classes/inheritance.ts"() {
|
|
@@ -19407,7 +19371,7 @@ var init_registry = __esm({
|
|
|
19407
19371
|
"../packages/manifest/schema-contract/registry.mjs"() {
|
|
19408
19372
|
"use strict";
|
|
19409
19373
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
19410
|
-
cliVersion: "0.89.
|
|
19374
|
+
cliVersion: "0.89.9",
|
|
19411
19375
|
projectFileUploadBatchSize: 32,
|
|
19412
19376
|
documentRecords: {
|
|
19413
19377
|
member: {
|
|
@@ -24412,7 +24376,7 @@ function mayUseLocalInitializer(text, names2) {
|
|
|
24412
24376
|
}
|
|
24413
24377
|
return false;
|
|
24414
24378
|
}
|
|
24415
|
-
function localInitializerUses(expression) {
|
|
24379
|
+
function localInitializerUses(expression, options = {}) {
|
|
24416
24380
|
const uses = [];
|
|
24417
24381
|
const pending = [
|
|
24418
24382
|
{ node: expression, owned: true, path: { parent: void 0, key: "" } }
|
|
@@ -24431,7 +24395,12 @@ function localInitializerUses(expression) {
|
|
|
24431
24395
|
const keys = [];
|
|
24432
24396
|
for (let step = path; step?.parent !== void 0; step = step.parent)
|
|
24433
24397
|
keys.push(step.key);
|
|
24434
|
-
uses.push({
|
|
24398
|
+
uses.push({
|
|
24399
|
+
node,
|
|
24400
|
+
owned,
|
|
24401
|
+
path: path === null ? null : keys.reverse(),
|
|
24402
|
+
...current.reference ? { reference: true } : {}
|
|
24403
|
+
});
|
|
24435
24404
|
break;
|
|
24436
24405
|
}
|
|
24437
24406
|
case "annotated":
|
|
@@ -24479,8 +24448,18 @@ function localInitializerUses(expression) {
|
|
|
24479
24448
|
}
|
|
24480
24449
|
break;
|
|
24481
24450
|
case "call":
|
|
24482
|
-
if (node.callee.kind === "ident" && node.callee.name === "Reference")
|
|
24451
|
+
if (node.callee.kind === "ident" && node.callee.name === "Reference") {
|
|
24452
|
+
if (options.includeReferences && node.args.length === 1 && node.args[0]?.kind === "ident" && node.argumentNames?.[0] == null) {
|
|
24453
|
+
pending.push({
|
|
24454
|
+
node: node.args[0],
|
|
24455
|
+
owned: false,
|
|
24456
|
+
path: null,
|
|
24457
|
+
bound,
|
|
24458
|
+
reference: true
|
|
24459
|
+
});
|
|
24460
|
+
}
|
|
24483
24461
|
break;
|
|
24462
|
+
}
|
|
24484
24463
|
add([node.callee, ...node.args], false);
|
|
24485
24464
|
break;
|
|
24486
24465
|
case "member":
|
|
@@ -24525,10 +24504,10 @@ function applyInitializerCodeSplices(code, splices) {
|
|
|
24525
24504
|
parts.push(code.slice(offset));
|
|
24526
24505
|
return parts.join("");
|
|
24527
24506
|
}
|
|
24528
|
-
function rewriteLocalInitializerUses(code, replace) {
|
|
24507
|
+
function rewriteLocalInitializerUses(code, replace, options = {}) {
|
|
24529
24508
|
const source = new SourceText(code);
|
|
24530
24509
|
const splices = [];
|
|
24531
|
-
for (const use of localInitializerUses(parseExpression(code))) {
|
|
24510
|
+
for (const use of localInitializerUses(parseExpression(code), options)) {
|
|
24532
24511
|
const text = replace(use);
|
|
24533
24512
|
if (text === null) continue;
|
|
24534
24513
|
const start = source.offsetAt({
|
|
@@ -24634,10 +24613,27 @@ function validateExecutableLocalUses(documents, localExpressions) {
|
|
|
24634
24613
|
}
|
|
24635
24614
|
}
|
|
24636
24615
|
if (locals.size === 0) return [];
|
|
24637
|
-
const
|
|
24616
|
+
const terminalNames = /* @__PURE__ */ new Map();
|
|
24617
|
+
const terminalName = (name) => {
|
|
24618
|
+
const chain = /* @__PURE__ */ new Set();
|
|
24619
|
+
let terminal2 = name;
|
|
24620
|
+
while (!chain.has(terminal2)) {
|
|
24621
|
+
const cached = terminalNames.get(terminal2);
|
|
24622
|
+
if (cached !== void 0) {
|
|
24623
|
+
terminal2 = cached;
|
|
24624
|
+
break;
|
|
24625
|
+
}
|
|
24626
|
+
chain.add(terminal2);
|
|
24627
|
+
const expression = localExpressions.get(terminal2);
|
|
24628
|
+
if (expression?.kind !== "ident" || !locals.has(expression.name)) break;
|
|
24629
|
+
terminal2 = expression.name;
|
|
24630
|
+
}
|
|
24631
|
+
for (const alias of chain) terminalNames.set(alias, terminal2);
|
|
24632
|
+
return terminal2;
|
|
24633
|
+
};
|
|
24638
24634
|
const uses = [];
|
|
24639
24635
|
const owners = /* @__PURE__ */ new Map();
|
|
24640
|
-
const add = (text, uri, origin, parent,
|
|
24636
|
+
const add = (text, uri, origin, parent, template = false, shadowed = /* @__PURE__ */ new Set()) => {
|
|
24641
24637
|
if (!mayUseLocalInitializer(text, locals)) return;
|
|
24642
24638
|
let expression;
|
|
24643
24639
|
try {
|
|
@@ -24645,10 +24641,8 @@ function validateExecutableLocalUses(documents, localExpressions) {
|
|
|
24645
24641
|
} catch {
|
|
24646
24642
|
return;
|
|
24647
24643
|
}
|
|
24648
|
-
if (parent !== void 0)
|
|
24649
|
-
|
|
24650
|
-
aliases.set(parent, expression.name);
|
|
24651
|
-
}
|
|
24644
|
+
if (parent !== void 0 && expression.kind === "ident" && locals.has(expression.name))
|
|
24645
|
+
return;
|
|
24652
24646
|
for (const { node, owned } of localInitializerUses(expression)) {
|
|
24653
24647
|
if (!locals.has(node.name) || shadowed.has(node.name)) continue;
|
|
24654
24648
|
const start = {
|
|
@@ -24661,14 +24655,14 @@ function validateExecutableLocalUses(documents, localExpressions) {
|
|
|
24661
24655
|
uri,
|
|
24662
24656
|
start,
|
|
24663
24657
|
parent,
|
|
24664
|
-
staticOwner: expression === node ? staticOwner : void 0,
|
|
24665
24658
|
template
|
|
24666
24659
|
};
|
|
24667
24660
|
uses.push(use);
|
|
24668
24661
|
if (owned) {
|
|
24669
|
-
const
|
|
24662
|
+
const terminal2 = terminalName(node.name);
|
|
24663
|
+
const entries = owners.get(terminal2) ?? [];
|
|
24670
24664
|
entries.push(use);
|
|
24671
|
-
owners.set(
|
|
24665
|
+
owners.set(terminal2, entries);
|
|
24672
24666
|
}
|
|
24673
24667
|
}
|
|
24674
24668
|
};
|
|
@@ -24684,7 +24678,6 @@ function validateExecutableLocalUses(documents, localExpressions) {
|
|
|
24684
24678
|
uri,
|
|
24685
24679
|
member.initializer.range.start,
|
|
24686
24680
|
void 0,
|
|
24687
|
-
isStatic ? `${declaration.name}.${member.name}` : void 0,
|
|
24688
24681
|
!isStatic,
|
|
24689
24682
|
new Set(
|
|
24690
24683
|
declaration.headerParameters?.map((parameter4) => parameter4.name)
|
|
@@ -24721,23 +24714,20 @@ function validateExecutableLocalUses(documents, localExpressions) {
|
|
|
24721
24714
|
const placements = /* @__PURE__ */ new Map();
|
|
24722
24715
|
const active = /* @__PURE__ */ new Set();
|
|
24723
24716
|
const placement = (name) => {
|
|
24717
|
+
name = terminalName(name);
|
|
24724
24718
|
const cached = placements.get(name);
|
|
24725
24719
|
if (cached !== void 0) return cached;
|
|
24726
|
-
if (active.has(name))
|
|
24727
|
-
return { count: 0, template: false, staticOwner: void 0 };
|
|
24720
|
+
if (active.has(name)) return { count: 0, template: false };
|
|
24728
24721
|
active.add(name);
|
|
24729
24722
|
const result = {
|
|
24730
24723
|
count: 0,
|
|
24731
|
-
template: false
|
|
24732
|
-
staticOwner: void 0
|
|
24724
|
+
template: false
|
|
24733
24725
|
};
|
|
24734
24726
|
for (const owner of owners.get(name) ?? []) {
|
|
24735
24727
|
const parent = owner.parent === void 0 ? void 0 : placement(owner.parent);
|
|
24736
24728
|
if (parent?.count === 0) continue;
|
|
24737
24729
|
result.count += parent?.count ?? 1;
|
|
24738
24730
|
result.template ||= parent?.template ?? owner.template;
|
|
24739
|
-
const alias = owner.parent !== void 0 && aliases.get(owner.parent) === name;
|
|
24740
|
-
result.staticOwner = alias ? parent?.staticOwner : owner.staticOwner;
|
|
24741
24731
|
if (result.count > 1) break;
|
|
24742
24732
|
}
|
|
24743
24733
|
active.delete(name);
|
|
@@ -24763,22 +24753,6 @@ function validateExecutableLocalUses(documents, localExpressions) {
|
|
|
24763
24753
|
if (declaration.kind === "enum") scalarTypes.add(declaration.name);
|
|
24764
24754
|
}
|
|
24765
24755
|
}
|
|
24766
|
-
const identities = /* @__PURE__ */ new Map();
|
|
24767
|
-
const resolving = /* @__PURE__ */ new Set();
|
|
24768
|
-
const hasIdentity = (name) => {
|
|
24769
|
-
const cached = identities.get(name);
|
|
24770
|
-
if (cached !== void 0) return cached;
|
|
24771
|
-
if (resolving.has(name)) return false;
|
|
24772
|
-
resolving.add(name);
|
|
24773
|
-
const alias = aliases.get(name);
|
|
24774
|
-
const expression = localExpressions.get(name);
|
|
24775
|
-
const identified = alias !== void 0 ? hasIdentity(alias) : locals.get(name).annotations.some((annotation2) => annotation2.name === "id") || expression?.kind === "annotated" && expression.annotations.some(
|
|
24776
|
-
(annotation2) => annotation2.name === "id"
|
|
24777
|
-
);
|
|
24778
|
-
resolving.delete(name);
|
|
24779
|
-
identities.set(name, identified);
|
|
24780
|
-
return identified;
|
|
24781
|
-
};
|
|
24782
24756
|
const reportedOwners = /* @__PURE__ */ new Set();
|
|
24783
24757
|
for (const use of uses) {
|
|
24784
24758
|
const declaration = locals.get(use.name);
|
|
@@ -24807,13 +24781,6 @@ function validateExecutableLocalUses(documents, localExpressions) {
|
|
|
24807
24781
|
);
|
|
24808
24782
|
continue;
|
|
24809
24783
|
}
|
|
24810
|
-
const hasId = hasIdentity(use.name);
|
|
24811
|
-
if (!hasId && owner.staticOwner === void 0) {
|
|
24812
|
-
report(
|
|
24813
|
-
use,
|
|
24814
|
-
`Local initializer ${use.name} has no stable instance identity. Keep an @id on its nested owning value, or place it directly in a static member before referencing it.`
|
|
24815
|
-
);
|
|
24816
|
-
}
|
|
24817
24784
|
if (owner.template) {
|
|
24818
24785
|
report(
|
|
24819
24786
|
use,
|
|
@@ -25265,6 +25232,7 @@ var init_local_values = __esm({
|
|
|
25265
25232
|
/** Static members whose initializer is a bare local name, by that name. */
|
|
25266
25233
|
ownerMembers = /* @__PURE__ */ new Map();
|
|
25267
25234
|
scalarTypes;
|
|
25235
|
+
pendingReferences = /* @__PURE__ */ new Map();
|
|
25268
25236
|
resolve(expression, source, valueId) {
|
|
25269
25237
|
if (expression.kind !== "ident") return { expression, source };
|
|
25270
25238
|
let text;
|
|
@@ -25331,12 +25299,55 @@ var init_local_values = __esm({
|
|
|
25331
25299
|
executable(code, runtimeIdentifiers = /* @__PURE__ */ new Set(), materializationRoot, identity3, storedValueAtPath) {
|
|
25332
25300
|
if (this.definitions.size === 0 || !mayUseLocalInitializer(code, this.definitions))
|
|
25333
25301
|
return { code, splices: [] };
|
|
25302
|
+
const terminalName = (name) => {
|
|
25303
|
+
this.inline(name);
|
|
25304
|
+
return this.terminalInitializers.get(name)?.global.name ?? name;
|
|
25305
|
+
};
|
|
25306
|
+
const owned = /* @__PURE__ */ new Set();
|
|
25307
|
+
const read = /* @__PURE__ */ new Set();
|
|
25308
|
+
const scanned = /* @__PURE__ */ new Set();
|
|
25309
|
+
const usedNames = new Set(runtimeIdentifiers);
|
|
25310
|
+
const scan = (text, runtimeNames) => {
|
|
25311
|
+
for (const match of text.matchAll(/[A-Za-z_]\w*/g))
|
|
25312
|
+
usedNames.add(match[0]);
|
|
25313
|
+
for (const use of localInitializerUses(
|
|
25314
|
+
parseCachedInitializer(this.syntax?.expressions, text),
|
|
25315
|
+
{ includeReferences: true }
|
|
25316
|
+
)) {
|
|
25317
|
+
if (!this.has(use.node.name) || runtimeNames.has(use.node.name))
|
|
25318
|
+
continue;
|
|
25319
|
+
const name = terminalName(use.node.name);
|
|
25320
|
+
if (!use.owned) {
|
|
25321
|
+
read.add(name);
|
|
25322
|
+
continue;
|
|
25323
|
+
}
|
|
25324
|
+
owned.add(name);
|
|
25325
|
+
if (scanned.has(name)) continue;
|
|
25326
|
+
scanned.add(name);
|
|
25327
|
+
scan(this.inline(name).text, /* @__PURE__ */ new Set());
|
|
25328
|
+
}
|
|
25329
|
+
};
|
|
25330
|
+
scan(code, runtimeIdentifiers);
|
|
25331
|
+
const shared = /* @__PURE__ */ new Map();
|
|
25332
|
+
for (const name of owned) {
|
|
25333
|
+
if (!read.has(name) || this.scalarTypes.has(this.definitions.get(name).type.name))
|
|
25334
|
+
continue;
|
|
25335
|
+
let variable2 = `__neo_owned_${shared.size}`;
|
|
25336
|
+
while (usedNames.has(variable2) || this.definitions.has(variable2) || runtimeIdentifiers.has(variable2))
|
|
25337
|
+
variable2 += "_";
|
|
25338
|
+
usedNames.add(variable2);
|
|
25339
|
+
shared.set(name, variable2);
|
|
25340
|
+
}
|
|
25341
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
25334
25342
|
const active = /* @__PURE__ */ new Set();
|
|
25335
25343
|
const expand = (text, path, runtimeNames) => rewriteLocalInitializerUses(
|
|
25336
25344
|
text,
|
|
25337
|
-
({ node, owned, path: relativePath }) => {
|
|
25345
|
+
({ node, owned: owned2, path: relativePath, reference: reference2 }) => {
|
|
25338
25346
|
if (!this.has(node.name) || runtimeNames.has(node.name)) return null;
|
|
25339
|
-
if (!
|
|
25347
|
+
if (!owned2) {
|
|
25348
|
+
const variable3 = shared.get(terminalName(node.name));
|
|
25349
|
+
if (variable3 !== void 0) return variable3;
|
|
25350
|
+
if (reference2) return null;
|
|
25340
25351
|
const definition2 = this.definitions.get(node.name);
|
|
25341
25352
|
if (this.scalarTypes.has(definition2.type.name)) {
|
|
25342
25353
|
throw new Error(
|
|
@@ -25362,9 +25373,13 @@ var init_local_values = __esm({
|
|
|
25362
25373
|
const annotation2 = terminal2.expression.kind === "annotated" ? terminal2.expression.annotations.find(
|
|
25363
25374
|
(entry) => entry.name === "id"
|
|
25364
25375
|
)?.args[0] : void 0;
|
|
25365
|
-
|
|
25376
|
+
const existingId = storedValueAtPath?.(
|
|
25377
|
+
materializationRoot,
|
|
25378
|
+
placementPath
|
|
25379
|
+
);
|
|
25380
|
+
if (annotation2?.kind === "litString" && existingId !== annotation2.value) {
|
|
25366
25381
|
throw new Error(
|
|
25367
|
-
`Local initializer ${terminal2.global.name} has an @id that does not identify its existing row inside this constructor-backed owner. Remove that @id and
|
|
25382
|
+
`Local initializer ${terminal2.global.name} has an @id that does not identify its existing row inside this constructor-backed owner. Remove that @id and let preparation assign the owning tree, or place the value directly in its own static member.`
|
|
25368
25383
|
);
|
|
25369
25384
|
}
|
|
25370
25385
|
const source = terminal2.global.source;
|
|
@@ -25372,7 +25387,7 @@ var init_local_values = __esm({
|
|
|
25372
25387
|
const id2 = annotation2?.kind === "litString" ? annotation2.value : `__pending__:value:${encodeURIComponent(source.uri)}:${source.range.start.line}:${source.range.start.character}:${encodeURIComponent(terminal2.global.name)}${suffix}`;
|
|
25373
25388
|
for (const { global } of steps) {
|
|
25374
25389
|
const owners = this.owners.get(global.name) ?? /* @__PURE__ */ new Map();
|
|
25375
|
-
owners.set(id2, global.name);
|
|
25390
|
+
owners.set(existingId ?? id2, global.name);
|
|
25376
25391
|
this.owners.set(global.name, owners);
|
|
25377
25392
|
}
|
|
25378
25393
|
identity3?.sites.set(id2, {
|
|
@@ -25391,10 +25406,50 @@ var init_local_values = __esm({
|
|
|
25391
25406
|
});
|
|
25392
25407
|
}
|
|
25393
25408
|
active.delete(node.name);
|
|
25409
|
+
const name = terminalName(node.name);
|
|
25410
|
+
const variable2 = shared.get(name);
|
|
25411
|
+
if (variable2 !== void 0) {
|
|
25412
|
+
bindings.set(variable2, {
|
|
25413
|
+
code: result,
|
|
25414
|
+
type: typeText(this.definitions.get(name).type)
|
|
25415
|
+
});
|
|
25416
|
+
return variable2;
|
|
25417
|
+
}
|
|
25394
25418
|
return result;
|
|
25395
|
-
}
|
|
25419
|
+
},
|
|
25420
|
+
{ includeReferences: true }
|
|
25396
25421
|
);
|
|
25397
|
-
|
|
25422
|
+
const expanded = expand(code, [], runtimeIdentifiers);
|
|
25423
|
+
if (bindings.size === 0) return expanded;
|
|
25424
|
+
const ordered = [];
|
|
25425
|
+
const visited = /* @__PURE__ */ new Set();
|
|
25426
|
+
const visit = (variable2) => {
|
|
25427
|
+
if (visited.has(variable2)) return;
|
|
25428
|
+
visited.add(variable2);
|
|
25429
|
+
for (const use of localInitializerUses(
|
|
25430
|
+
parseCachedInitializer(
|
|
25431
|
+
this.syntax?.expressions,
|
|
25432
|
+
bindings.get(variable2).code
|
|
25433
|
+
),
|
|
25434
|
+
{ includeReferences: true }
|
|
25435
|
+
)) {
|
|
25436
|
+
if (bindings.has(use.node.name)) visit(use.node.name);
|
|
25437
|
+
}
|
|
25438
|
+
ordered.push(variable2);
|
|
25439
|
+
};
|
|
25440
|
+
for (const variable2 of bindings.keys()) visit(variable2);
|
|
25441
|
+
const declarations = ordered.map((variable2) => {
|
|
25442
|
+
const binding = bindings.get(variable2);
|
|
25443
|
+
return `${binding.type} ${variable2} = ${binding.code};`;
|
|
25444
|
+
});
|
|
25445
|
+
const bound = `(() => {
|
|
25446
|
+
${declarations.join("\n")}
|
|
25447
|
+
return ${expanded.code};
|
|
25448
|
+
})()`;
|
|
25449
|
+
return {
|
|
25450
|
+
code: bound,
|
|
25451
|
+
splices: [{ start: 0, end: code.length, text: bound }]
|
|
25452
|
+
};
|
|
25398
25453
|
}
|
|
25399
25454
|
initializer(global) {
|
|
25400
25455
|
const cached = this.initializers.get(global.name);
|
|
@@ -25439,7 +25494,8 @@ var init_local_values = __esm({
|
|
|
25439
25494
|
* lowered, so the answer does not depend on which file lowered first: the
|
|
25440
25495
|
* `@id` its declaration carries (through any alias chain), else the static
|
|
25441
25496
|
* member whose initializer is the local, whose row derives from the member.
|
|
25442
|
-
*
|
|
25497
|
+
* Nested idless locals use a temporary reference resolved after their owners
|
|
25498
|
+
* lower. Constructor-backed owners settle it to the materialized child ID.
|
|
25443
25499
|
*/
|
|
25444
25500
|
declaredTarget(name) {
|
|
25445
25501
|
const definition2 = this.definitions.get(name);
|
|
@@ -25452,7 +25508,11 @@ var init_local_values = __esm({
|
|
|
25452
25508
|
return { id: id2.value, typeName };
|
|
25453
25509
|
}
|
|
25454
25510
|
const owners = this.ownerMembers.get(name);
|
|
25455
|
-
if (owners === void 0)
|
|
25511
|
+
if (owners === void 0) {
|
|
25512
|
+
const locator = `__pending__:local-reference:${encodeURIComponent(name)}`;
|
|
25513
|
+
this.pendingReferences.set(locator, name);
|
|
25514
|
+
return { id: locator, typeName };
|
|
25515
|
+
}
|
|
25456
25516
|
if (owners.length !== 1) {
|
|
25457
25517
|
throw new Error(
|
|
25458
25518
|
`Reference(${name}) requires exactly one owning assignment.`
|
|
@@ -25461,8 +25521,25 @@ var init_local_values = __esm({
|
|
|
25461
25521
|
const owner = owners[0];
|
|
25462
25522
|
return { ownerMemberId: owner.memberId, ownerPath: owner.path, typeName };
|
|
25463
25523
|
}
|
|
25524
|
+
remapTargets(replacements) {
|
|
25525
|
+
for (const owners of this.owners.values()) {
|
|
25526
|
+
for (const [id2, label] of [...owners]) {
|
|
25527
|
+
const target = replacements.get(id2);
|
|
25528
|
+
if (target === void 0) continue;
|
|
25529
|
+
owners.delete(id2);
|
|
25530
|
+
owners.set(target, label);
|
|
25531
|
+
}
|
|
25532
|
+
}
|
|
25533
|
+
}
|
|
25534
|
+
referenceTargets() {
|
|
25535
|
+
return new Map(
|
|
25536
|
+
[...this.pendingReferences].map(([id2, name]) => [id2, this.target(name)])
|
|
25537
|
+
);
|
|
25538
|
+
}
|
|
25464
25539
|
target(name) {
|
|
25465
|
-
|
|
25540
|
+
this.inline(name);
|
|
25541
|
+
const terminal2 = this.terminalInitializers.get(name)?.global.name ?? name;
|
|
25542
|
+
const owners = this.owners.get(terminal2);
|
|
25466
25543
|
if (owners?.size !== 1)
|
|
25467
25544
|
throw new Error(
|
|
25468
25545
|
`Reference(${name}) requires exactly one owning assignment.`
|
|
@@ -34598,7 +34675,7 @@ var init_canonical_json = __esm({
|
|
|
34598
34675
|
});
|
|
34599
34676
|
|
|
34600
34677
|
// ../packages/neoscript-runtime/src/neoscript/initializer-dependencies.ts
|
|
34601
|
-
function materializeInitializerDependencies(pending, materialize) {
|
|
34678
|
+
function materializeInitializerDependencies(pending, materialize, onFailure) {
|
|
34602
34679
|
const active = /* @__PURE__ */ new Set();
|
|
34603
34680
|
for (const rootId of pending) {
|
|
34604
34681
|
const stack = [rootId];
|
|
@@ -34611,19 +34688,27 @@ function materializeInitializerDependencies(pending, materialize) {
|
|
|
34611
34688
|
active.delete(valueId);
|
|
34612
34689
|
stack.pop();
|
|
34613
34690
|
} catch (error) {
|
|
34614
|
-
if (
|
|
34615
|
-
|
|
34616
|
-
|
|
34691
|
+
if (error instanceof PendingInitializerDependency && pending.has(error.valueId)) {
|
|
34692
|
+
if (!active.has(error.valueId)) {
|
|
34693
|
+
active.add(error.valueId);
|
|
34694
|
+
stack.push(error.valueId);
|
|
34695
|
+
continue;
|
|
34696
|
+
}
|
|
34617
34697
|
const cycle = new NSGetterRuntimeError(
|
|
34618
34698
|
`Initializer dependency cycle: ${[...stack, error.valueId].join(" -> ")}. Remove a dependency so these values can be initialized in order.`
|
|
34619
34699
|
);
|
|
34620
34700
|
cycle.initializerValueId = valueId;
|
|
34621
34701
|
cycle.node = error.node;
|
|
34622
34702
|
cycle.source = error.source;
|
|
34623
|
-
|
|
34703
|
+
error = cycle;
|
|
34704
|
+
}
|
|
34705
|
+
if (onFailure === void 0) throw error;
|
|
34706
|
+
onFailure(stack, error);
|
|
34707
|
+
for (const id2 of stack) {
|
|
34708
|
+
pending.delete(id2);
|
|
34709
|
+
active.delete(id2);
|
|
34624
34710
|
}
|
|
34625
|
-
|
|
34626
|
-
stack.push(error.valueId);
|
|
34711
|
+
stack.length = 0;
|
|
34627
34712
|
}
|
|
34628
34713
|
}
|
|
34629
34714
|
}
|
|
@@ -39361,6 +39446,7 @@ function indexRuntimeCollectionChange(collection, entry, ctx, removedEntries = n
|
|
|
39361
39446
|
indexes4.memberByRowId.clear();
|
|
39362
39447
|
}
|
|
39363
39448
|
if (Array.isArray(collection)) forgetLocalListIndexes(ctx, collection);
|
|
39449
|
+
else indexes4.declaredListByArray = /* @__PURE__ */ new WeakMap();
|
|
39364
39450
|
markOverlayMutated(ctx, collection);
|
|
39365
39451
|
if (ctx.__valueOverlay instanceof LazyValueOverlay)
|
|
39366
39452
|
indexes4.overlayRevision = ctx.__valueOverlay.revision;
|
|
@@ -42945,6 +43031,7 @@ function replaceRowValue(row, value, receiver, ctx) {
|
|
|
42945
43031
|
unindexEvaluatorRow(indexes4, row, true);
|
|
42946
43032
|
row.value = value;
|
|
42947
43033
|
indexEvaluatorRow(indexes4, row, true);
|
|
43034
|
+
indexes4.declaredListByArray = /* @__PURE__ */ new WeakMap();
|
|
42948
43035
|
markOverlayMutated(ctx, receiver);
|
|
42949
43036
|
if (ctx.__valueOverlay instanceof LazyValueOverlay)
|
|
42950
43037
|
indexes4.overlayRevision = ctx.__valueOverlay.revision;
|
|
@@ -47183,6 +47270,17 @@ function runtimeTypeCheck(value, checkType, ctx, seenCollections = /* @__PURE__
|
|
|
47183
47270
|
case 8 /* Enum */:
|
|
47184
47271
|
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
47185
47272
|
case 7 /* Class */: {
|
|
47273
|
+
if (isVariantClassId(checkType.classId)) {
|
|
47274
|
+
if (!isVariantRefValue(value)) return false;
|
|
47275
|
+
const targetParameter = evaluatorSchemaIndex(ctx).classesById.get(
|
|
47276
|
+
checkType.classId
|
|
47277
|
+
)?.genericParams?.[0];
|
|
47278
|
+
const target = targetParameter === void 0 ? void 0 : receiverClosedTypeArguments(checkType.typeArguments, ctx)?.[targetParameter.id];
|
|
47279
|
+
return target?.type !== 7 /* Class */ || evaluatorSchemaIndex(ctx).classIsOrExtends(
|
|
47280
|
+
value.classId,
|
|
47281
|
+
target.classId
|
|
47282
|
+
);
|
|
47283
|
+
}
|
|
47186
47284
|
if (typeof value !== "object") return false;
|
|
47187
47285
|
const row = trackedRowForValueReference(value, ctx);
|
|
47188
47286
|
const runtimeClassId = row === null ? void 0 : classIdForValueRow(row, ctx);
|
|
@@ -52225,6 +52323,21 @@ function encodeRequiredConstructorArgument(args) {
|
|
|
52225
52323
|
`Constructor argument '${args.parameterId}' has an unresolved generic type.`
|
|
52226
52324
|
);
|
|
52227
52325
|
}
|
|
52326
|
+
if (args.typeInfo.type === 7 /* Class */ && isVariantClassId(args.typeInfo.classId)) {
|
|
52327
|
+
if (args.value === null || args.value === void 0) return null;
|
|
52328
|
+
const selection2 = readVariantSelection(
|
|
52329
|
+
args.value,
|
|
52330
|
+
`Constructor argument '${args.parameterId}'`
|
|
52331
|
+
);
|
|
52332
|
+
if (selection2.rowValueId !== null) {
|
|
52333
|
+
adoptTracked(selection2.rowValueId, "variant-row");
|
|
52334
|
+
}
|
|
52335
|
+
return {
|
|
52336
|
+
classId: selection2.classId,
|
|
52337
|
+
variantId: selection2.variantId,
|
|
52338
|
+
...selection2.rowValueId === null ? {} : { rowValueId: selection2.rowValueId }
|
|
52339
|
+
};
|
|
52340
|
+
}
|
|
52228
52341
|
if (args.typeInfo.type === 7 /* Class */ || args.typeInfo.type === 22 /* Interface */) {
|
|
52229
52342
|
if (args.value === null || args.value === void 0) return null;
|
|
52230
52343
|
const aggregateId2 = trackedId ?? replayedAggregateId;
|
|
@@ -57001,22 +57114,29 @@ var init_lookup_declared_type = __esm({
|
|
|
57001
57114
|
});
|
|
57002
57115
|
|
|
57003
57116
|
// ../packages/neoscript-runtime/src/values/member-declared-type-info.ts
|
|
57004
|
-
function resolveMemberDeclaredTypeInfo(member, members2, ownerClass = null, env) {
|
|
57117
|
+
function resolveMemberDeclaredTypeInfo(member, members2, classes, ownerClass = null, env) {
|
|
57005
57118
|
return resolveMemberDeclaredTypeInfoInternal(
|
|
57006
57119
|
member,
|
|
57007
57120
|
members2,
|
|
57121
|
+
classes,
|
|
57008
57122
|
/* @__PURE__ */ new Set(),
|
|
57009
57123
|
ownerClass,
|
|
57010
57124
|
env,
|
|
57011
57125
|
ownerClass === null ? void 0 : classConstrainedGenerics([ownerClass])
|
|
57012
57126
|
);
|
|
57013
57127
|
}
|
|
57014
|
-
function resolveMemberDeclaredTypeInfoInternal(member, members2, seen, ownerClass, env, isClassConstrained) {
|
|
57128
|
+
function resolveMemberDeclaredTypeInfoInternal(member, members2, classes, seen, ownerClass, env, isClassConstrained) {
|
|
57015
57129
|
const resolved = env === void 0 ? resolveMember(member, members2) : substituteMember(member, env, members2);
|
|
57016
57130
|
const memberId = getField(resolved, "id");
|
|
57017
57131
|
if (typeof memberId === "string" && seen.has(memberId)) return null;
|
|
57018
57132
|
const nextSeen = typeof memberId === "string" ? /* @__PURE__ */ new Set([...seen, memberId]) : new Set(seen);
|
|
57019
57133
|
if (isMemberNSPropertyBase(resolved)) return resolved.returnTypeInfo;
|
|
57134
|
+
if (isMemberVariantBase(resolved)) {
|
|
57135
|
+
return variantMemberDeclaredTypeInfo(
|
|
57136
|
+
resolved,
|
|
57137
|
+
neoVariantSystemClass(classes, resolved.valueTypeInfo != null)
|
|
57138
|
+
);
|
|
57139
|
+
}
|
|
57020
57140
|
if (isClassSlotMember(resolved)) {
|
|
57021
57141
|
const typeArguments = Object.fromEntries(
|
|
57022
57142
|
Object.entries(declaredSlotArguments(resolved) ?? {}).flatMap(
|
|
@@ -57036,6 +57156,7 @@ function resolveMemberDeclaredTypeInfoInternal(member, members2, seen, ownerClas
|
|
|
57036
57156
|
const argumentType2 = resolveMemberDeclaredTypeInfoInternal(
|
|
57037
57157
|
argumentMember,
|
|
57038
57158
|
members2,
|
|
57159
|
+
classes,
|
|
57039
57160
|
nextSeen,
|
|
57040
57161
|
ownerClass,
|
|
57041
57162
|
env,
|
|
@@ -57106,6 +57227,7 @@ function resolveMemberDeclaredTypeInfoInternal(member, members2, seen, ownerClas
|
|
|
57106
57227
|
const typeInfo = resolveMemberDeclaredTypeInfoInternal(
|
|
57107
57228
|
descriptor,
|
|
57108
57229
|
members2,
|
|
57230
|
+
classes,
|
|
57109
57231
|
nextSeen,
|
|
57110
57232
|
ownerClass,
|
|
57111
57233
|
env,
|
|
@@ -57134,6 +57256,7 @@ function resolveMemberDeclaredTypeInfoInternal(member, members2, seen, ownerClas
|
|
|
57134
57256
|
const entryTypeInfo = resolveMemberDeclaredTypeInfoInternal(
|
|
57135
57257
|
entry,
|
|
57136
57258
|
members2,
|
|
57259
|
+
classes,
|
|
57137
57260
|
nextSeen,
|
|
57138
57261
|
ownerClass,
|
|
57139
57262
|
env,
|
|
@@ -57158,6 +57281,7 @@ function resolveMemberDeclaredTypeInfoInternal(member, members2, seen, ownerClas
|
|
|
57158
57281
|
return resolveMemberDeclaredTypeInfoInternal(
|
|
57159
57282
|
collection,
|
|
57160
57283
|
members2,
|
|
57284
|
+
classes,
|
|
57161
57285
|
nextSeen,
|
|
57162
57286
|
ownerClass,
|
|
57163
57287
|
env,
|
|
@@ -57206,6 +57330,7 @@ var init_member_declared_type_info = __esm({
|
|
|
57206
57330
|
init_inheritance();
|
|
57207
57331
|
init_parameter_defaults();
|
|
57208
57332
|
init_core();
|
|
57333
|
+
init_variant_member();
|
|
57209
57334
|
}
|
|
57210
57335
|
});
|
|
57211
57336
|
|
|
@@ -57214,6 +57339,15 @@ function recordEntries(value) {
|
|
|
57214
57339
|
if (typeof value !== "object" || value === null) return [];
|
|
57215
57340
|
return Object.values(value);
|
|
57216
57341
|
}
|
|
57342
|
+
function isVariantArgument(value, typeInfo) {
|
|
57343
|
+
return typeInfo?.type === 7 /* Class */ && isVariantClassId(typeInfo.classId) && isVariantRefValue(value);
|
|
57344
|
+
}
|
|
57345
|
+
function remapVariantArgument(value, typeInfo, remap) {
|
|
57346
|
+
if (!isVariantArgument(value, typeInfo)) return value;
|
|
57347
|
+
if (typeof value.rowValueId !== "string") return value;
|
|
57348
|
+
const rowValueId = remap(value.rowValueId);
|
|
57349
|
+
return rowValueId === value.rowValueId ? value : { ...value, rowValueId };
|
|
57350
|
+
}
|
|
57217
57351
|
function resolveSemanticOwnerMembersForValues(document, targetValueIds, additionalRoots, rootOwners, rootKinds, graphOf = () => new MaterializedValueGraphContext(
|
|
57218
57352
|
document,
|
|
57219
57353
|
void 0,
|
|
@@ -57525,7 +57659,11 @@ function tryResolveTypeInfo(document, rawTypeInfo, env) {
|
|
|
57525
57659
|
function tryMemberTypeInfo(document, rawMember, env) {
|
|
57526
57660
|
try {
|
|
57527
57661
|
const member = substituteMember(rawMember, env, document.members);
|
|
57528
|
-
const typeInfo = resolveMemberDeclaredTypeInfo(
|
|
57662
|
+
const typeInfo = resolveMemberDeclaredTypeInfo(
|
|
57663
|
+
member,
|
|
57664
|
+
document.members,
|
|
57665
|
+
document.classes
|
|
57666
|
+
);
|
|
57529
57667
|
if (typeInfo === null) return null;
|
|
57530
57668
|
return tryResolveTypeInfo(document, typeInfo, env);
|
|
57531
57669
|
} catch {
|
|
@@ -57565,6 +57703,7 @@ var init_constructor_argument_ownership = __esm({
|
|
|
57565
57703
|
init_core();
|
|
57566
57704
|
init_interface_implementers();
|
|
57567
57705
|
init_members();
|
|
57706
|
+
init_reference_category();
|
|
57568
57707
|
init_neoscript();
|
|
57569
57708
|
init_project_schema_index();
|
|
57570
57709
|
init_member_declared_type_info();
|
|
@@ -57805,7 +57944,7 @@ var init_constructor_argument_ownership = __esm({
|
|
|
57805
57944
|
const typeInfo = parameterTypes.get(parameterId);
|
|
57806
57945
|
return [
|
|
57807
57946
|
parameterId,
|
|
57808
|
-
typeInfo !== void 0 && (isAggregateTypeInfo(typeInfo) || typeInfo.type === 29 /* Reference */) && typeof argument2 === "string" ? rewriteId(argument2) : argument2
|
|
57947
|
+
typeInfo !== void 0 && (isAggregateTypeInfo(typeInfo) || typeInfo.type === 29 /* Reference */) && typeof argument2 === "string" ? rewriteId(argument2) : remapVariantArgument(argument2, typeInfo, rewriteId)
|
|
57809
57948
|
];
|
|
57810
57949
|
}
|
|
57811
57950
|
)
|
|
@@ -57841,15 +57980,18 @@ var init_constructor_argument_ownership = __esm({
|
|
|
57841
57980
|
ids.push(edge.targetValueId);
|
|
57842
57981
|
return ids;
|
|
57843
57982
|
}
|
|
57844
|
-
/**
|
|
57983
|
+
/** Reference targets and bound lookup rows retained by creation data. */
|
|
57845
57984
|
referenceArgumentIds(row) {
|
|
57846
57985
|
if (!isLiteralValueContent(row)) return [];
|
|
57847
57986
|
const args = row.constructorArgs;
|
|
57848
57987
|
if (args === void 0 || args === null) return [];
|
|
57849
57988
|
const ids = [];
|
|
57850
|
-
for (const parameterId of this.
|
|
57989
|
+
for (const [parameterId, typeInfo] of this.constructorParameterTypes(row)) {
|
|
57851
57990
|
const argument2 = args[parameterId];
|
|
57852
|
-
if (typeof argument2 === "string")
|
|
57991
|
+
if (typeInfo.type === 29 /* Reference */ && typeof argument2 === "string")
|
|
57992
|
+
ids.push(argument2);
|
|
57993
|
+
else if (isVariantArgument(argument2, typeInfo) && typeof argument2.rowValueId === "string")
|
|
57994
|
+
ids.push(argument2.rowValueId);
|
|
57853
57995
|
}
|
|
57854
57996
|
return ids;
|
|
57855
57997
|
}
|
|
@@ -57858,23 +58000,23 @@ var init_constructor_argument_ownership = __esm({
|
|
|
57858
58000
|
const args = row.constructorArgs;
|
|
57859
58001
|
if (args === void 0 || args === null) return args;
|
|
57860
58002
|
let remapped;
|
|
57861
|
-
for (const parameterId of this.
|
|
58003
|
+
for (const [parameterId, typeInfo] of this.constructorParameterTypes(
|
|
57862
58004
|
row,
|
|
57863
58005
|
contextualMember
|
|
57864
58006
|
)) {
|
|
57865
58007
|
const argument2 = args[parameterId];
|
|
57866
|
-
|
|
57867
|
-
const target = remap(argument2);
|
|
58008
|
+
const target = typeInfo.type === 29 /* Reference */ && typeof argument2 === "string" ? remap(argument2) : remapVariantArgument(argument2, typeInfo, remap);
|
|
57868
58009
|
if (target !== argument2) (remapped ??= { ...args })[parameterId] = target;
|
|
57869
58010
|
}
|
|
57870
58011
|
return remapped ?? args;
|
|
57871
58012
|
}
|
|
57872
|
-
*
|
|
57873
|
-
|
|
57874
|
-
|
|
57875
|
-
|
|
57876
|
-
|
|
57877
|
-
if (typeInfo
|
|
58013
|
+
*variantArgumentSelections(row) {
|
|
58014
|
+
if (!isLiteralValueContent(row)) return;
|
|
58015
|
+
if (row.constructorArgs == null) return;
|
|
58016
|
+
for (const [parameterId, typeInfo] of this.constructorParameterTypes(row)) {
|
|
58017
|
+
const argument2 = row.constructorArgs[parameterId];
|
|
58018
|
+
if (isVariantArgument(argument2, typeInfo)) yield argument2;
|
|
58019
|
+
}
|
|
57878
58020
|
}
|
|
57879
58021
|
slotEntries(row) {
|
|
57880
58022
|
const value = row.value;
|
|
@@ -57975,6 +58117,17 @@ var init_constructor_argument_ownership = __esm({
|
|
|
57975
58117
|
if (member === void 0) return null;
|
|
57976
58118
|
return this.memberTypeInfo(member, env);
|
|
57977
58119
|
}
|
|
58120
|
+
if ((rawTypeInfo.type === 7 /* Class */ || rawTypeInfo.type === 22 /* Interface */) && rawTypeInfo.typeArguments !== void 0) {
|
|
58121
|
+
const typeArguments = {};
|
|
58122
|
+
for (const [parameterId, argument2] of Object.entries(
|
|
58123
|
+
rawTypeInfo.typeArguments
|
|
58124
|
+
)) {
|
|
58125
|
+
const resolved = this.resolveTypeInfo(argument2, env);
|
|
58126
|
+
if (resolved === null) return null;
|
|
58127
|
+
typeArguments[parameterId] = resolved;
|
|
58128
|
+
}
|
|
58129
|
+
return { ...rawTypeInfo, typeArguments };
|
|
58130
|
+
}
|
|
57978
58131
|
if (rawTypeInfo.type === 30 /* Tuple */) {
|
|
57979
58132
|
const elements = [];
|
|
57980
58133
|
for (const element of rawTypeInfo.elements) {
|
|
@@ -58006,7 +58159,8 @@ var init_constructor_argument_ownership = __esm({
|
|
|
58006
58159
|
const member = substituteMember(rawMember, env, this.document.members);
|
|
58007
58160
|
const typeInfo = resolveMemberDeclaredTypeInfo(
|
|
58008
58161
|
member,
|
|
58009
|
-
this.document.members
|
|
58162
|
+
this.document.members,
|
|
58163
|
+
this.document.classes
|
|
58010
58164
|
);
|
|
58011
58165
|
return typeInfo === null ? null : this.resolveTypeInfo(typeInfo, env);
|
|
58012
58166
|
} catch {
|
|
@@ -63101,7 +63255,7 @@ function indexedInitializerEvaluatorLookups(document, key, revision) {
|
|
|
63101
63255
|
});
|
|
63102
63256
|
return lookups;
|
|
63103
63257
|
}
|
|
63104
|
-
function createInitializerMaterializationBatch(authoredDocument, pendingInitializerIds) {
|
|
63258
|
+
function createInitializerMaterializationBatch(authoredDocument, pendingInitializerIds, referenceOwners) {
|
|
63105
63259
|
const indexed = createInitializerBatchLookups(authoredDocument);
|
|
63106
63260
|
let hasListenerMetadata;
|
|
63107
63261
|
const unorderedListEntryIds2 = indexed.snapshot().unorderedListEntryIds;
|
|
@@ -63251,7 +63405,12 @@ function createInitializerMaterializationBatch(authoredDocument, pendingInitiali
|
|
|
63251
63405
|
base.valueById(id2),
|
|
63252
63406
|
(id3) => virtual().declarationDefaultGraph(id3, member)
|
|
63253
63407
|
),
|
|
63254
|
-
valueById: (id2) =>
|
|
63408
|
+
valueById: (id2) => {
|
|
63409
|
+
const owner = referenceOwners?.get(id2);
|
|
63410
|
+
if (owner !== void 0 && pendingInitializerIds?.has(owner))
|
|
63411
|
+
throw new PendingInitializerDependency(owner);
|
|
63412
|
+
return base.valueById(id2) ?? expandedById.get(id2) ?? virtual().valueById(id2);
|
|
63413
|
+
},
|
|
63255
63414
|
rowForValueReference: (value) => base.rowForValueReference(value) ?? expandedByReference.get(value) ?? virtual().rowForValueReference(value),
|
|
63256
63415
|
virtualInstanceRowsForValue: (id2) => {
|
|
63257
63416
|
const cached = cachedById.get(id2);
|
|
@@ -63631,13 +63790,37 @@ function derivedGenericArgumentMemberId(parentRecordId, genericParamId) {
|
|
|
63631
63790
|
)
|
|
63632
63791
|
);
|
|
63633
63792
|
}
|
|
63634
|
-
|
|
63793
|
+
function pendingGenericArgumentMemberId(parentRecordId, genericParamId) {
|
|
63794
|
+
return `${PENDING_GENERIC_ARGUMENT_PREFIX}${encodeURIComponent(parentRecordId)}:${encodeURIComponent(genericParamId)}`;
|
|
63795
|
+
}
|
|
63796
|
+
function pendingGenericArgumentIdentity(token) {
|
|
63797
|
+
if (!token.startsWith(PENDING_GENERIC_ARGUMENT_PREFIX)) return null;
|
|
63798
|
+
const parts = token.slice(PENDING_GENERIC_ARGUMENT_PREFIX.length).split(":");
|
|
63799
|
+
if (parts.length !== 2)
|
|
63800
|
+
throw new Error(
|
|
63801
|
+
`Pending generic argument identity must have two components: ${token}.`
|
|
63802
|
+
);
|
|
63803
|
+
if (!parts[0])
|
|
63804
|
+
throw new Error(
|
|
63805
|
+
`Pending generic argument identity has no parent: ${token}.`
|
|
63806
|
+
);
|
|
63807
|
+
if (!parts[1])
|
|
63808
|
+
throw new Error(
|
|
63809
|
+
`Pending generic argument identity has no parameter: ${token}.`
|
|
63810
|
+
);
|
|
63811
|
+
return {
|
|
63812
|
+
parentRecordId: decodeURIComponent(parts[0]),
|
|
63813
|
+
genericParamId: decodeURIComponent(parts[1])
|
|
63814
|
+
};
|
|
63815
|
+
}
|
|
63816
|
+
var NEO_GENERIC_ARGUMENT_MEMBER_NAMESPACE, PENDING_GENERIC_ARGUMENT_PREFIX;
|
|
63635
63817
|
var init_generic_argument_member_id = __esm({
|
|
63636
63818
|
"../src/models/members/generic-argument-member-id.ts"() {
|
|
63637
63819
|
"use strict";
|
|
63638
63820
|
init_dist_node();
|
|
63639
63821
|
init_system_record_id();
|
|
63640
63822
|
NEO_GENERIC_ARGUMENT_MEMBER_NAMESPACE = "6a4e1d38-9b52-5c0f-8d71-3e2a7f4b6c19";
|
|
63823
|
+
PENDING_GENERIC_ARGUMENT_PREFIX = "__pending__:generic-argument-member:";
|
|
63641
63824
|
}
|
|
63642
63825
|
});
|
|
63643
63826
|
|
|
@@ -74918,11 +75101,97 @@ var init_strict_resolver = __esm({
|
|
|
74918
75101
|
if (callee.kind !== "member") return null;
|
|
74919
75102
|
const isInitialize = callee.name === VARIANT_INITIALIZE_NAME;
|
|
74920
75103
|
const isApply = callee.name === VARIANT_APPLY_NAME;
|
|
74921
|
-
|
|
75104
|
+
const isBind = callee.name === "Bind";
|
|
75105
|
+
if (!isInitialize && !isApply && !isBind) return null;
|
|
74922
75106
|
if (callee.receiver.kind === "ident" && !this.hasValueReceiver(callee.receiver.name, scope) && this.project.typeByName.has(callee.receiver.name)) {
|
|
74923
75107
|
return null;
|
|
74924
75108
|
}
|
|
74925
75109
|
const receiver = receiverValue ? receiverValue() : this.resolveExpression(callee.receiver, scope);
|
|
75110
|
+
if (isBind) {
|
|
75111
|
+
const variantInfo2 = this.variantTypeInfo(receiver.type);
|
|
75112
|
+
if (variantInfo2 === null) return null;
|
|
75113
|
+
if (variantInfo2.valueType === null) {
|
|
75114
|
+
throw new CompileError("Only a lookup variant can bind a row.", pos);
|
|
75115
|
+
}
|
|
75116
|
+
if (callee.optional === true) {
|
|
75117
|
+
throw new CompileError("Bind requires a non-null lookup variant.", pos);
|
|
75118
|
+
}
|
|
75119
|
+
if (receiver.pointer.type !== "variant" /* Variant */) {
|
|
75120
|
+
throw new CompileError(
|
|
75121
|
+
"Bind requires a declared lookup variant path.",
|
|
75122
|
+
pos
|
|
75123
|
+
);
|
|
75124
|
+
}
|
|
75125
|
+
requireArgCount("NeoLookupVariant.Bind", argumentsList2, 1, pos);
|
|
75126
|
+
const row2 = argumentsList2[0];
|
|
75127
|
+
if (row2.kind !== "call") {
|
|
75128
|
+
throw new CompileError(
|
|
75129
|
+
'Bind requires Reference(id: "value-id").',
|
|
75130
|
+
row2.pos
|
|
75131
|
+
);
|
|
75132
|
+
}
|
|
75133
|
+
if (row2.callee.kind !== "ident" || row2.callee.name !== "Reference") {
|
|
75134
|
+
throw new CompileError(
|
|
75135
|
+
"Bind requires a Reference row argument.",
|
|
75136
|
+
row2.pos
|
|
75137
|
+
);
|
|
75138
|
+
}
|
|
75139
|
+
requireArgCount("Bind Reference", row2.args, 1, row2.pos);
|
|
75140
|
+
if (row2.argumentNames?.[0] !== "id") {
|
|
75141
|
+
throw new CompileError(
|
|
75142
|
+
'Bind requires Reference(id: "value-id").',
|
|
75143
|
+
row2.pos
|
|
75144
|
+
);
|
|
75145
|
+
}
|
|
75146
|
+
const id2 = row2.args[0];
|
|
75147
|
+
if (id2.kind !== "litString") {
|
|
75148
|
+
throw new CompileError(
|
|
75149
|
+
"Bound row id must be a string literal.",
|
|
75150
|
+
id2.pos
|
|
75151
|
+
);
|
|
75152
|
+
}
|
|
75153
|
+
if (id2.value.length === 0) {
|
|
75154
|
+
throw new CompileError("Bound row id must not be empty.", id2.pos);
|
|
75155
|
+
}
|
|
75156
|
+
if (row2.typeArguments !== void 0) {
|
|
75157
|
+
if (row2.typeArguments.length !== 1) {
|
|
75158
|
+
throw new CompileError(
|
|
75159
|
+
"Reference requires exactly one generic target type.",
|
|
75160
|
+
row2.pos
|
|
75161
|
+
);
|
|
75162
|
+
}
|
|
75163
|
+
this.requireAssignable(
|
|
75164
|
+
this.resolveType(row2.typeArguments[0]),
|
|
75165
|
+
variantInfo2.valueType,
|
|
75166
|
+
row2.pos,
|
|
75167
|
+
"Lookup variant row"
|
|
75168
|
+
);
|
|
75169
|
+
}
|
|
75170
|
+
const rowType = this.context.persistedReferenceTypes?.get(id2.value);
|
|
75171
|
+
if (rowType !== void 0) {
|
|
75172
|
+
this.requireAssignable(
|
|
75173
|
+
neoScriptReadType(rowType),
|
|
75174
|
+
variantInfo2.valueType,
|
|
75175
|
+
row2.pos,
|
|
75176
|
+
"Lookup variant row"
|
|
75177
|
+
);
|
|
75178
|
+
}
|
|
75179
|
+
const bound = this.project.typeByName.get(NEO_VARIANT_TYPE_NAME);
|
|
75180
|
+
if (bound === void 0) {
|
|
75181
|
+
throw new CompileError(
|
|
75182
|
+
`The seeded '${NEO_VARIANT_TYPE_NAME}' class is missing.`,
|
|
75183
|
+
pos
|
|
75184
|
+
);
|
|
75185
|
+
}
|
|
75186
|
+
return {
|
|
75187
|
+
pointer: { ...receiver.pointer, rowValueId: id2.value },
|
|
75188
|
+
type: {
|
|
75189
|
+
kind: "named",
|
|
75190
|
+
typeId: bound.id,
|
|
75191
|
+
typeArguments: receiver.type.kind === "named" ? receiver.type.typeArguments?.slice(0, 1) ?? [] : []
|
|
75192
|
+
}
|
|
75193
|
+
};
|
|
75194
|
+
}
|
|
74926
75195
|
if (isInitialize) {
|
|
74927
75196
|
const variantInfo2 = this.variantTypeInfo(receiver.type);
|
|
74928
75197
|
if (variantInfo2 === null) return null;
|
|
@@ -76824,6 +77093,33 @@ var init_strict_resolver = __esm({
|
|
|
76824
77093
|
typeArguments
|
|
76825
77094
|
);
|
|
76826
77095
|
}
|
|
77096
|
+
if (callee.kind === "lambda" && expected !== void 0) {
|
|
77097
|
+
rejectTypeArguments();
|
|
77098
|
+
const parameterTypes = callee.params.map((parameter4) => {
|
|
77099
|
+
if (parameter4.type === null) {
|
|
77100
|
+
throw new CompileError(
|
|
77101
|
+
"An immediately invoked lambda requires explicit parameter types.",
|
|
77102
|
+
parameter4.pos
|
|
77103
|
+
);
|
|
77104
|
+
}
|
|
77105
|
+
return this.resolveType(parameter4.type);
|
|
77106
|
+
});
|
|
77107
|
+
return this.resolveDelegateCall(
|
|
77108
|
+
this.resolveDelegateLambda(
|
|
77109
|
+
callee,
|
|
77110
|
+
{
|
|
77111
|
+
kind: "delegate",
|
|
77112
|
+
parameterTypes,
|
|
77113
|
+
returnType: expected
|
|
77114
|
+
},
|
|
77115
|
+
scope
|
|
77116
|
+
),
|
|
77117
|
+
argumentsList2,
|
|
77118
|
+
scope,
|
|
77119
|
+
pos,
|
|
77120
|
+
false
|
|
77121
|
+
);
|
|
77122
|
+
}
|
|
76827
77123
|
const variantCall = this.resolveVariantCall(
|
|
76828
77124
|
callee,
|
|
76829
77125
|
argumentsList2,
|
|
@@ -90569,7 +90865,7 @@ var init_neoscript_language_context_adapter = __esm({
|
|
|
90569
90865
|
init_dialogue_types();
|
|
90570
90866
|
init_dialogue_group_language();
|
|
90571
90867
|
init_analyzer_types();
|
|
90572
|
-
NEOSCRIPT_COMPILER_ADAPTER_REVISION =
|
|
90868
|
+
NEOSCRIPT_COMPILER_ADAPTER_REVISION = 7;
|
|
90573
90869
|
UNKNOWN_TYPE2 = {
|
|
90574
90870
|
kind: "primitive",
|
|
90575
90871
|
name: "unknown"
|
|
@@ -91206,6 +91502,7 @@ function compileMemberInitializerBody(args) {
|
|
|
91206
91502
|
const returnTypeInfo = resolveMemberDeclaredTypeInfo(
|
|
91207
91503
|
args.member,
|
|
91208
91504
|
members2,
|
|
91505
|
+
args.classes,
|
|
91209
91506
|
args.thisClass
|
|
91210
91507
|
);
|
|
91211
91508
|
if (returnTypeInfo === null) {
|
|
@@ -91253,7 +91550,8 @@ function compileValueRowInitializerBody(args) {
|
|
|
91253
91550
|
}
|
|
91254
91551
|
const returnTypeInfo = resolveMemberDeclaredTypeInfo(
|
|
91255
91552
|
args.member,
|
|
91256
|
-
args.members
|
|
91553
|
+
args.members,
|
|
91554
|
+
args.classes
|
|
91257
91555
|
);
|
|
91258
91556
|
if (returnTypeInfo === null) {
|
|
91259
91557
|
throw new Error(
|
|
@@ -91436,6 +91734,7 @@ function compileConstructorBaseInitializerFields(args, owner) {
|
|
|
91436
91734
|
const declaredTypeInfo = resolveMemberDeclaredTypeInfo(
|
|
91437
91735
|
member,
|
|
91438
91736
|
args.members,
|
|
91737
|
+
args.classes,
|
|
91439
91738
|
args.classes.find(
|
|
91440
91739
|
(schemaClass2) => schemaClass2.id === entry.ownerClassId
|
|
91441
91740
|
) ?? null
|
|
@@ -101910,6 +102209,29 @@ function buildProjectGraph(documents) {
|
|
|
101910
102209
|
rootType
|
|
101911
102210
|
];
|
|
101912
102211
|
const globals = [];
|
|
102212
|
+
const variants = [];
|
|
102213
|
+
for (const entries of buildNeoVariantScopeIndex(
|
|
102214
|
+
documents
|
|
102215
|
+
).variantsByScope.values()) {
|
|
102216
|
+
for (const entry of entries) {
|
|
102217
|
+
const classId = graph.typeIdsByName.byName.get(entry.className);
|
|
102218
|
+
if (classId === void 0) continue;
|
|
102219
|
+
const folder = entry.scope.slice(`${entry.className}.${NEO_VARIANT_SCOPE_NAME}`.length + 1).split(".").join("/");
|
|
102220
|
+
const valueType = entry.declaration.type.typeArguments[1];
|
|
102221
|
+
const valueTypeId = valueType === void 0 ? void 0 : graph.typeIdsByName.byName.get(valueType.name);
|
|
102222
|
+
variants.push({
|
|
102223
|
+
id: sourceIdentity2(
|
|
102224
|
+
entry.declaration.annotations,
|
|
102225
|
+
`variant:${entry.uri}:${entry.className}:${entry.scope}:${entry.name}`
|
|
102226
|
+
),
|
|
102227
|
+
classId,
|
|
102228
|
+
name: entry.name,
|
|
102229
|
+
folder: folder.length === 0 ? null : folder,
|
|
102230
|
+
...valueTypeId === void 0 ? {} : { valueTypeId },
|
|
102231
|
+
location: location(entry.uri, entry.declaration.nameRange)
|
|
102232
|
+
});
|
|
102233
|
+
}
|
|
102234
|
+
}
|
|
101913
102235
|
const extensions = [];
|
|
101914
102236
|
const memberInfo = new Map(graph.memberInfo);
|
|
101915
102237
|
const roots = [];
|
|
@@ -101963,7 +102285,7 @@ function buildProjectGraph(documents) {
|
|
|
101963
102285
|
return {
|
|
101964
102286
|
...graph,
|
|
101965
102287
|
memberInfo,
|
|
101966
|
-
project: { ...graph.project, types, globals, roots, extensions }
|
|
102288
|
+
project: { ...graph.project, types, globals, roots, extensions, variants }
|
|
101967
102289
|
};
|
|
101968
102290
|
}
|
|
101969
102291
|
function buildDeclarationGraph(documents) {
|
|
@@ -102952,6 +103274,7 @@ var init_project_source_script_compiler = __esm({
|
|
|
102952
103274
|
init_project_root();
|
|
102953
103275
|
init_function_overload_identity();
|
|
102954
103276
|
init_project_source_registry();
|
|
103277
|
+
init_project_source_variants();
|
|
102955
103278
|
init_compilation_product();
|
|
102956
103279
|
init_runtime_source();
|
|
102957
103280
|
init_lexer();
|
|
@@ -123991,6 +124314,14 @@ function isNamePath(expression) {
|
|
|
123991
124314
|
return expression.kind === "member" && isNamePath(expression.receiver);
|
|
123992
124315
|
}
|
|
123993
124316
|
function isLiteralCall(expression) {
|
|
124317
|
+
if (expression.callee.kind === "member" && expression.callee.name === "Bind") {
|
|
124318
|
+
let receiver = expression.callee.receiver;
|
|
124319
|
+
while (receiver.kind === "member") {
|
|
124320
|
+
if (receiver.name === "Variants" && isNamePath(receiver.receiver))
|
|
124321
|
+
return true;
|
|
124322
|
+
receiver = receiver.receiver;
|
|
124323
|
+
}
|
|
124324
|
+
}
|
|
123994
124325
|
if (expression.callee.kind === "ident" && expression.callee.name === "Reference") {
|
|
123995
124326
|
if (expression.argumentNames?.some((name) => name !== null)) return true;
|
|
123996
124327
|
const [place] = expression.args;
|
|
@@ -128194,7 +128525,8 @@ function lowerBindings(context, ownerClass, ownerParameters, ownerRecordId, para
|
|
|
128194
128525
|
continue;
|
|
128195
128526
|
}
|
|
128196
128527
|
const baseBinding = baseArguments?.[parameterId];
|
|
128197
|
-
const
|
|
128528
|
+
const derive = isPendingId(ownerRecordId) || isPendingId(parameterId) ? pendingGenericArgumentMemberId : derivedGenericArgumentMemberId;
|
|
128529
|
+
const memberId = baseBinding?.kind === "member" ? baseBinding.memberId : derive(ownerRecordId, parameterId);
|
|
128198
128530
|
result[parameterId] = { kind: "member", memberId };
|
|
128199
128531
|
lowerGenericArgument(
|
|
128200
128532
|
context,
|
|
@@ -128848,6 +129180,7 @@ var init_lower_members = __esm({
|
|
|
128848
129180
|
init_ui_action_source();
|
|
128849
129181
|
init_entry_member_id();
|
|
128850
129182
|
init_generic_argument_member_id();
|
|
129183
|
+
init_pending_id();
|
|
128851
129184
|
init_structured_leaf_source();
|
|
128852
129185
|
init_member_kind_type_names();
|
|
128853
129186
|
init_set_literal_duplicates();
|
|
@@ -135329,6 +135662,59 @@ var init_dialogue_lower = __esm({
|
|
|
135329
135662
|
}
|
|
135330
135663
|
});
|
|
135331
135664
|
|
|
135665
|
+
// src/project-source/identity-rewriter.ts
|
|
135666
|
+
function createIdentityRewriter(assignments, onReplace) {
|
|
135667
|
+
if (assignments.size === 0) return (value) => value;
|
|
135668
|
+
const root = { children: /* @__PURE__ */ new Map() };
|
|
135669
|
+
for (const [source, replacement] of assignments) {
|
|
135670
|
+
let prefix = root;
|
|
135671
|
+
for (let index = 0; index < source.length; index += 1) {
|
|
135672
|
+
const character = source[index];
|
|
135673
|
+
let child2 = prefix.children.get(character);
|
|
135674
|
+
if (child2 === void 0) {
|
|
135675
|
+
child2 = { children: /* @__PURE__ */ new Map() };
|
|
135676
|
+
prefix.children.set(character, child2);
|
|
135677
|
+
}
|
|
135678
|
+
prefix = child2;
|
|
135679
|
+
}
|
|
135680
|
+
prefix.replacement = replacement;
|
|
135681
|
+
}
|
|
135682
|
+
return (value) => {
|
|
135683
|
+
const exact = assignments.get(value);
|
|
135684
|
+
if (exact !== void 0) {
|
|
135685
|
+
onReplace?.(value);
|
|
135686
|
+
return exact;
|
|
135687
|
+
}
|
|
135688
|
+
const parts = [];
|
|
135689
|
+
let copiedThrough = 0;
|
|
135690
|
+
for (let start = 0; start < value.length; start += 1) {
|
|
135691
|
+
let prefix = root.children.get(value[start]);
|
|
135692
|
+
let replacement;
|
|
135693
|
+
let end = start;
|
|
135694
|
+
for (let index = start; prefix !== void 0; index += 1) {
|
|
135695
|
+
if (prefix.replacement !== void 0) {
|
|
135696
|
+
replacement = prefix.replacement;
|
|
135697
|
+
end = index + 1;
|
|
135698
|
+
}
|
|
135699
|
+
prefix = prefix.children.get(value[index + 1]);
|
|
135700
|
+
}
|
|
135701
|
+
if (replacement === void 0) continue;
|
|
135702
|
+
onReplace?.(value.slice(start, end));
|
|
135703
|
+
parts.push(value.slice(copiedThrough, start), replacement);
|
|
135704
|
+
copiedThrough = end;
|
|
135705
|
+
start = end - 1;
|
|
135706
|
+
}
|
|
135707
|
+
if (copiedThrough === 0) return value;
|
|
135708
|
+
parts.push(value.slice(copiedThrough));
|
|
135709
|
+
return parts.join("");
|
|
135710
|
+
};
|
|
135711
|
+
}
|
|
135712
|
+
var init_identity_rewriter = __esm({
|
|
135713
|
+
"src/project-source/identity-rewriter.ts"() {
|
|
135714
|
+
"use strict";
|
|
135715
|
+
}
|
|
135716
|
+
});
|
|
135717
|
+
|
|
135332
135718
|
// ../src/database/document-initializer-compiler.ts
|
|
135333
135719
|
function initializerCompilerState(document, compilationProject) {
|
|
135334
135720
|
const existing = documentInitializerCompilerStates.get(document);
|
|
@@ -135353,7 +135739,9 @@ function compilationProjectForDocument(document, state) {
|
|
|
135353
135739
|
classes: document.classes,
|
|
135354
135740
|
enums: document.enums,
|
|
135355
135741
|
interfaces: document.interfaces,
|
|
135356
|
-
constructors: document.constructors ?? []
|
|
135742
|
+
constructors: document.constructors ?? [],
|
|
135743
|
+
variants: document.variants ?? [],
|
|
135744
|
+
variantFolders: document.variantFolders ?? []
|
|
135357
135745
|
});
|
|
135358
135746
|
return state.compilationProject;
|
|
135359
135747
|
}
|
|
@@ -135452,6 +135840,8 @@ function compileValueInitializerDependency(document, valueId, compilationProject
|
|
|
135452
135840
|
enums: document.enums,
|
|
135453
135841
|
interfaces: document.interfaces,
|
|
135454
135842
|
constructors: document.constructors ?? [],
|
|
135843
|
+
variants: document.variants ?? [],
|
|
135844
|
+
variantFolders: document.variantFolders ?? [],
|
|
135455
135845
|
member: site.member,
|
|
135456
135846
|
valueRow: { ...site.row },
|
|
135457
135847
|
valueId: site.row.id,
|
|
@@ -135470,7 +135860,9 @@ function compileMemberInitializerDependency(document, memberId, compilationProje
|
|
|
135470
135860
|
classes: document.classes,
|
|
135471
135861
|
enums: document.enums,
|
|
135472
135862
|
interfaces: document.interfaces,
|
|
135473
|
-
constructors: document.constructors ?? []
|
|
135863
|
+
constructors: document.constructors ?? [],
|
|
135864
|
+
variants: document.variants ?? [],
|
|
135865
|
+
variantFolders: document.variantFolders ?? []
|
|
135474
135866
|
};
|
|
135475
135867
|
const memberIndex = documentMemberCompilationIndex(document);
|
|
135476
135868
|
const member = memberIndex.membersById.get(memberId);
|
|
@@ -146026,6 +146418,7 @@ function appendAuthoredOwnedValueCascadeDeletes(args) {
|
|
|
146026
146418
|
while (parentId != null && !visited.has(parentId)) {
|
|
146027
146419
|
visited.add(parentId);
|
|
146028
146420
|
const parent = postValuesById.get(parentId);
|
|
146421
|
+
if (isInitValueContent(parent)) break;
|
|
146029
146422
|
if (parent !== void 0 && isLiteralValueContent(parent) && isVirtualInstanceRootShape(parent) && postPlacements.has(parentId)) {
|
|
146030
146423
|
survivingConstructionIds.add(parentId);
|
|
146031
146424
|
break;
|
|
@@ -146736,6 +147129,7 @@ function* prepareServerOwnedSchemaCommitPasses(args) {
|
|
|
146736
147129
|
appendConstructionTypes
|
|
146737
147130
|
});
|
|
146738
147131
|
materializePreparedInstanceInitializers({
|
|
147132
|
+
referenceOwners: args.initializerReferenceOwners,
|
|
146739
147133
|
document: args.document,
|
|
146740
147134
|
physicalValues: args.document.physicalValues,
|
|
146741
147135
|
prepared,
|
|
@@ -147087,7 +147481,8 @@ function materializePreparedInstanceInitializers(args) {
|
|
|
147087
147481
|
if (pendingInitializerIds.size === 0) return;
|
|
147088
147482
|
const batch = createInitializerMaterializationBatch(
|
|
147089
147483
|
materializationScope.document,
|
|
147090
|
-
pendingInitializerIds
|
|
147484
|
+
pendingInitializerIds,
|
|
147485
|
+
args.referenceOwners
|
|
147091
147486
|
);
|
|
147092
147487
|
materializeInitializerDependencies(pendingInitializerIds, (valueId) => {
|
|
147093
147488
|
const site = pendingSites.get(valueId);
|
|
@@ -149271,6 +149666,8 @@ function compileOwnedValueRowInitializer(args) {
|
|
|
149271
149666
|
enums: document.enums,
|
|
149272
149667
|
interfaces: document.interfaces,
|
|
149273
149668
|
constructors: document.constructors ?? [],
|
|
149669
|
+
variants: document.variants ?? [],
|
|
149670
|
+
variantFolders: document.variantFolders ?? [],
|
|
149274
149671
|
compilationProject: args.compilationProject,
|
|
149275
149672
|
member,
|
|
149276
149673
|
valueRow: row,
|
|
@@ -149336,7 +149733,9 @@ function prepareServerOwnedValueInitializerBodies(args) {
|
|
|
149336
149733
|
classes: document.classes,
|
|
149337
149734
|
enums: document.enums,
|
|
149338
149735
|
interfaces: document.interfaces,
|
|
149339
|
-
constructors: document.constructors ?? []
|
|
149736
|
+
constructors: document.constructors ?? [],
|
|
149737
|
+
variants: document.variants ?? [],
|
|
149738
|
+
variantFolders: document.variantFolders ?? []
|
|
149340
149739
|
});
|
|
149341
149740
|
compilationProjects.set(document, compilationProject);
|
|
149342
149741
|
return compilationProject;
|
|
@@ -152997,12 +153396,12 @@ function assertNoVariantTypePositions(args) {
|
|
|
152997
153396
|
for (const declaredConstructor of args.constructors ?? []) {
|
|
152998
153397
|
const ids = [];
|
|
152999
153398
|
for (const argument2 of declaredConstructor.argumentTypes ?? []) {
|
|
153000
|
-
typeInfoClassIds(argument2, ids, args.classesById);
|
|
153399
|
+
typeInfoClassIds(argument2, ids, args.classesById, true);
|
|
153001
153400
|
}
|
|
153002
153401
|
for (const classId of ids) {
|
|
153003
153402
|
if (!isVariantFamilyClassId(classId, args.classesById)) continue;
|
|
153004
153403
|
throw new Error(
|
|
153005
|
-
`Constructor "${declaredConstructor.id}" declares a parameter of ${variantFamilyLabel(classId, args.classesById)}, which
|
|
153404
|
+
`Constructor "${declaredConstructor.id}" declares a parameter of ${variantFamilyLabel(classId, args.classesById)}, which cannot be used as a constructor argument type.`
|
|
153006
153405
|
);
|
|
153007
153406
|
}
|
|
153008
153407
|
}
|
|
@@ -158355,7 +158754,10 @@ function assertStagedVariantMemberValuesValid(projected, changes) {
|
|
|
158355
158754
|
const variantMembers = projected.members.filter(
|
|
158356
158755
|
(member) => member.kind === 27 /* Variant */
|
|
158357
158756
|
);
|
|
158358
|
-
if (variantMembers.length === 0
|
|
158757
|
+
if (variantMembers.length === 0 && !projected.values.some(
|
|
158758
|
+
(row) => isLiteralValueContent(row) && row.constructorArgs != null
|
|
158759
|
+
))
|
|
158760
|
+
return;
|
|
158359
158761
|
const classesById = new Map(
|
|
158360
158762
|
projected.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
158361
158763
|
);
|
|
@@ -158433,6 +158835,46 @@ function assertStagedVariantMemberValuesValid(projected, changes) {
|
|
|
158433
158835
|
});
|
|
158434
158836
|
}
|
|
158435
158837
|
}
|
|
158838
|
+
let constructorGraph;
|
|
158839
|
+
for (const row of projected.values) {
|
|
158840
|
+
if (!isLiteralValueContent(row) || row.constructorArgs == null) continue;
|
|
158841
|
+
constructorGraph ??= new MaterializedValueGraphContext(
|
|
158842
|
+
projected,
|
|
158843
|
+
valuesById
|
|
158844
|
+
);
|
|
158845
|
+
for (const [
|
|
158846
|
+
parameterId,
|
|
158847
|
+
typeInfo
|
|
158848
|
+
] of constructorGraph.constructorParameterTypes(row)) {
|
|
158849
|
+
if (typeInfo.type !== 7 /* Class */) continue;
|
|
158850
|
+
const systemClass = classesById.get(typeInfo.classId);
|
|
158851
|
+
const worldKind = systemClass?.system?.worldKind;
|
|
158852
|
+
if (worldKind !== NeoWorldSystemClassKind.Variant && worldKind !== NeoWorldSystemClassKind.LookupVariant)
|
|
158853
|
+
continue;
|
|
158854
|
+
const label = `Constructor argument "${parameterId}" of row "${row.id}"`;
|
|
158855
|
+
const targetParamId = systemClass?.genericParams?.[0]?.id;
|
|
158856
|
+
const targetTypeInfo = targetParamId === void 0 ? void 0 : typeInfo.typeArguments?.[targetParamId];
|
|
158857
|
+
if (targetTypeInfo === void 0)
|
|
158858
|
+
throw new Error(`${label} declares no variant target type.`);
|
|
158859
|
+
const valueParamId = systemClass?.genericParams?.[1]?.id;
|
|
158860
|
+
const valueTypeInfo = valueParamId === void 0 ? void 0 : typeInfo.typeArguments?.[valueParamId];
|
|
158861
|
+
if (worldKind === NeoWorldSystemClassKind.LookupVariant && valueTypeInfo === void 0)
|
|
158862
|
+
throw new Error(`${label} declares no lookup value type.`);
|
|
158863
|
+
const declaration = {
|
|
158864
|
+
kind: 27 /* Variant */,
|
|
158865
|
+
name: parameterId,
|
|
158866
|
+
targetTypeInfo,
|
|
158867
|
+
...valueTypeInfo === void 0 ? {} : { valueTypeInfo },
|
|
158868
|
+
...typeInfo.required ? { requirement: 1 /* Required */ } : {}
|
|
158869
|
+
};
|
|
158870
|
+
assertVariantMemberTargetValid({ declaration, label, classesById });
|
|
158871
|
+
graded.push({
|
|
158872
|
+
value: row.constructorArgs[parameterId],
|
|
158873
|
+
declaration,
|
|
158874
|
+
label
|
|
158875
|
+
});
|
|
158876
|
+
}
|
|
158877
|
+
}
|
|
158436
158878
|
for (const entry of graded) {
|
|
158437
158879
|
assertVariantReferenceValid({
|
|
158438
158880
|
value: entry.value,
|
|
@@ -158733,7 +159175,14 @@ var init_project_version_whole_graph_validation = __esm({
|
|
|
158733
159175
|
25 /* NSDelegate */,
|
|
158734
159176
|
26 /* NSAction */
|
|
158735
159177
|
]);
|
|
158736
|
-
VARIANT_MEMBER_TRIGGER_RECORD_KINDS = /* @__PURE__ */ new Set([
|
|
159178
|
+
VARIANT_MEMBER_TRIGGER_RECORD_KINDS = /* @__PURE__ */ new Set([
|
|
159179
|
+
"member",
|
|
159180
|
+
"class",
|
|
159181
|
+
"constructor",
|
|
159182
|
+
"value",
|
|
159183
|
+
"variant",
|
|
159184
|
+
"variant-folder"
|
|
159185
|
+
]);
|
|
158737
159186
|
}
|
|
158738
159187
|
});
|
|
158739
159188
|
|
|
@@ -158813,6 +159262,7 @@ function preparationArgs(context) {
|
|
|
158813
159262
|
const { args } = context;
|
|
158814
159263
|
return {
|
|
158815
159264
|
document: context.document,
|
|
159265
|
+
initializerReferenceOwners: args.initializerReferenceOwners,
|
|
158816
159266
|
contentHashHeads: context.contentHashHeads,
|
|
158817
159267
|
changes: args.changes,
|
|
158818
159268
|
authoredValueSeeds: args.authoredValueSeeds,
|
|
@@ -159308,59 +159758,6 @@ var init_client_commit_preparation = __esm({
|
|
|
159308
159758
|
}
|
|
159309
159759
|
});
|
|
159310
159760
|
|
|
159311
|
-
// src/project-source/identity-rewriter.ts
|
|
159312
|
-
function createIdentityRewriter(assignments, onReplace) {
|
|
159313
|
-
if (assignments.size === 0) return (value) => value;
|
|
159314
|
-
const root = { children: /* @__PURE__ */ new Map() };
|
|
159315
|
-
for (const [source, replacement] of assignments) {
|
|
159316
|
-
let prefix = root;
|
|
159317
|
-
for (let index = 0; index < source.length; index += 1) {
|
|
159318
|
-
const character = source[index];
|
|
159319
|
-
let child2 = prefix.children.get(character);
|
|
159320
|
-
if (child2 === void 0) {
|
|
159321
|
-
child2 = { children: /* @__PURE__ */ new Map() };
|
|
159322
|
-
prefix.children.set(character, child2);
|
|
159323
|
-
}
|
|
159324
|
-
prefix = child2;
|
|
159325
|
-
}
|
|
159326
|
-
prefix.replacement = replacement;
|
|
159327
|
-
}
|
|
159328
|
-
return (value) => {
|
|
159329
|
-
const exact = assignments.get(value);
|
|
159330
|
-
if (exact !== void 0) {
|
|
159331
|
-
onReplace?.(value);
|
|
159332
|
-
return exact;
|
|
159333
|
-
}
|
|
159334
|
-
const parts = [];
|
|
159335
|
-
let copiedThrough = 0;
|
|
159336
|
-
for (let start = 0; start < value.length; start += 1) {
|
|
159337
|
-
let prefix = root.children.get(value[start]);
|
|
159338
|
-
let replacement;
|
|
159339
|
-
let end = start;
|
|
159340
|
-
for (let index = start; prefix !== void 0; index += 1) {
|
|
159341
|
-
if (prefix.replacement !== void 0) {
|
|
159342
|
-
replacement = prefix.replacement;
|
|
159343
|
-
end = index + 1;
|
|
159344
|
-
}
|
|
159345
|
-
prefix = prefix.children.get(value[index + 1]);
|
|
159346
|
-
}
|
|
159347
|
-
if (replacement === void 0) continue;
|
|
159348
|
-
onReplace?.(value.slice(start, end));
|
|
159349
|
-
parts.push(value.slice(copiedThrough, start), replacement);
|
|
159350
|
-
copiedThrough = end;
|
|
159351
|
-
start = end - 1;
|
|
159352
|
-
}
|
|
159353
|
-
if (copiedThrough === 0) return value;
|
|
159354
|
-
parts.push(value.slice(copiedThrough));
|
|
159355
|
-
return parts.join("");
|
|
159356
|
-
};
|
|
159357
|
-
}
|
|
159358
|
-
var init_identity_rewriter = __esm({
|
|
159359
|
-
"src/project-source/identity-rewriter.ts"() {
|
|
159360
|
-
"use strict";
|
|
159361
|
-
}
|
|
159362
|
-
});
|
|
159363
|
-
|
|
159364
159761
|
// src/project-source/trusted-commit-verification.ts
|
|
159365
159762
|
function verifyProjectSourceCommitAgainstStateV4(args) {
|
|
159366
159763
|
const root = "/neo-source-verify-virtual";
|
|
@@ -159559,6 +159956,21 @@ function validateAssignments(value) {
|
|
|
159559
159956
|
return assignments;
|
|
159560
159957
|
}
|
|
159561
159958
|
function derivedAssignment(pendingId2) {
|
|
159959
|
+
const genericArgument = pendingGenericArgumentIdentity(pendingId2);
|
|
159960
|
+
if (genericArgument !== null)
|
|
159961
|
+
return {
|
|
159962
|
+
ownerLocator: genericArgument.parentRecordId,
|
|
159963
|
+
derive: (parent, assignments) => {
|
|
159964
|
+
const parameter4 = isPendingId(genericArgument.genericParamId) ? assignments.get(genericArgument.genericParamId) : genericArgument.genericParamId;
|
|
159965
|
+
if (parameter4 === void 0)
|
|
159966
|
+
throw new ProjectSourceCommitVerificationError(
|
|
159967
|
+
`Generic argument assignment ${pendingId2} names parameter ${genericArgument.genericParamId}, which has no pending id assignment.`
|
|
159968
|
+
);
|
|
159969
|
+
return derivedGenericArgumentMemberId(parent, parameter4);
|
|
159970
|
+
},
|
|
159971
|
+
label: "Generic argument assignment",
|
|
159972
|
+
ownerNoun: "binding owner"
|
|
159973
|
+
};
|
|
159562
159974
|
const tupleElement = pendingTupleElementIdentity(pendingId2);
|
|
159563
159975
|
if (tupleElement !== null)
|
|
159564
159976
|
return {
|
|
@@ -159657,6 +160069,15 @@ function relocatedAssignment(pendingId2, assignments, byPosition, used) {
|
|
|
159657
160069
|
const key = positionIndependentPendingKey(pendingId2);
|
|
159658
160070
|
const relocated = key === null ? void 0 : byPosition.get(key);
|
|
159659
160071
|
if (relocated !== void 0) return relocated;
|
|
160072
|
+
const genericArgument = pendingGenericArgumentIdentity(pendingId2);
|
|
160073
|
+
if (genericArgument !== null) {
|
|
160074
|
+
const relocate = (id2) => !isPendingId(id2) || assignments.has(id2) ? id2 : relocatedAssignment(id2, assignments, byPosition, used);
|
|
160075
|
+
const parent = relocate(genericArgument.parentRecordId);
|
|
160076
|
+
const parameter4 = relocate(genericArgument.genericParamId);
|
|
160077
|
+
if (parent === null || parameter4 === null) return null;
|
|
160078
|
+
const rebuilt = pendingGenericArgumentMemberId(parent, parameter4);
|
|
160079
|
+
return assignments.has(rebuilt) ? rebuilt : null;
|
|
160080
|
+
}
|
|
159660
160081
|
for (const [owner, rebuild] of [
|
|
159661
160082
|
[pendingMemberValueMemberId(pendingId2), pendingMemberValueId],
|
|
159662
160083
|
[pendingEntryMemberDeclaringId(pendingId2), pendingEntryMemberId],
|
|
@@ -159989,6 +160410,7 @@ var init_trusted_commit_verification = __esm({
|
|
|
159989
160410
|
"use strict";
|
|
159990
160411
|
init_tuple_element_member_id();
|
|
159991
160412
|
init_identity_rewriter();
|
|
160413
|
+
init_generic_argument_member_id();
|
|
159992
160414
|
init_lower_support();
|
|
159993
160415
|
init_schema_source_validation();
|
|
159994
160416
|
init_projectRecordBuckets();
|
|
@@ -160062,6 +160484,7 @@ function sourceCommitPreparation(args) {
|
|
|
160062
160484
|
timestamp: args.serverTimestamp
|
|
160063
160485
|
}),
|
|
160064
160486
|
authoredValueSeeds: args.authoredValueSeeds,
|
|
160487
|
+
initializerReferenceOwners: args.initializerReferenceOwners,
|
|
160065
160488
|
forceRecompile: args.forceRecompile,
|
|
160066
160489
|
scriptSources: args.scriptSources,
|
|
160067
160490
|
serverTimestamp: args.serverTimestamp
|
|
@@ -160249,7 +160672,9 @@ function replayStoredConstructionV4(args) {
|
|
|
160249
160672
|
classes: document.classes,
|
|
160250
160673
|
enums: document.enums,
|
|
160251
160674
|
interfaces: document.interfaces,
|
|
160252
|
-
constructors: document.constructors ?? []
|
|
160675
|
+
constructors: document.constructors ?? [],
|
|
160676
|
+
variants: document.variants ?? [],
|
|
160677
|
+
variantFolders: document.variantFolders ?? []
|
|
160253
160678
|
}) : void 0);
|
|
160254
160679
|
if (args.compileDocumentBodies === true) {
|
|
160255
160680
|
if (compilationProject === void 0) {
|
|
@@ -160298,6 +160723,8 @@ function replayStoredConstructionV4(args) {
|
|
|
160298
160723
|
enums: document.enums,
|
|
160299
160724
|
interfaces: document.interfaces,
|
|
160300
160725
|
constructors: document.constructors,
|
|
160726
|
+
variants: document.variants ?? [],
|
|
160727
|
+
variantFolders: document.variantFolders ?? [],
|
|
160301
160728
|
member: compileMember,
|
|
160302
160729
|
valueRow: candidate,
|
|
160303
160730
|
valueId: args.valueId,
|
|
@@ -160369,7 +160796,9 @@ function compilePulledUncompiledConstructorsV4(document, compilationProject, rep
|
|
|
160369
160796
|
classes: document.classes,
|
|
160370
160797
|
enums: document.enums,
|
|
160371
160798
|
interfaces: document.interfaces,
|
|
160372
|
-
constructors: document.constructors ?? []
|
|
160799
|
+
constructors: document.constructors ?? [],
|
|
160800
|
+
variants: document.variants ?? [],
|
|
160801
|
+
variantFolders: document.variantFolders ?? []
|
|
160373
160802
|
});
|
|
160374
160803
|
const compileArgs = {
|
|
160375
160804
|
project: document.project,
|
|
@@ -160380,6 +160809,8 @@ function compilePulledUncompiledConstructorsV4(document, compilationProject, rep
|
|
|
160380
160809
|
enums: document.enums,
|
|
160381
160810
|
interfaces: document.interfaces,
|
|
160382
160811
|
constructors: document.constructors ?? [],
|
|
160812
|
+
variants: document.variants ?? [],
|
|
160813
|
+
variantFolders: document.variantFolders ?? [],
|
|
160383
160814
|
compilationProject: project
|
|
160384
160815
|
};
|
|
160385
160816
|
for (const constructor2 of uncompiled) {
|
|
@@ -160403,7 +160834,9 @@ function compilePulledProjectDocumentForEvaluationV4(document, compilationProjec
|
|
|
160403
160834
|
classes: document.classes,
|
|
160404
160835
|
enums: document.enums,
|
|
160405
160836
|
interfaces: document.interfaces,
|
|
160406
|
-
constructors: document.constructors ?? []
|
|
160837
|
+
constructors: document.constructors ?? [],
|
|
160838
|
+
variants: document.variants ?? [],
|
|
160839
|
+
variantFolders: document.variantFolders ?? []
|
|
160407
160840
|
});
|
|
160408
160841
|
documentInitializerCompiler(document, sharedCompilationProject);
|
|
160409
160842
|
const compileArgs = {
|
|
@@ -160415,6 +160848,8 @@ function compilePulledProjectDocumentForEvaluationV4(document, compilationProjec
|
|
|
160415
160848
|
enums: document.enums,
|
|
160416
160849
|
interfaces: document.interfaces,
|
|
160417
160850
|
constructors: document.constructors ?? [],
|
|
160851
|
+
variants: document.variants ?? [],
|
|
160852
|
+
variantFolders: document.variantFolders ?? [],
|
|
160418
160853
|
compilationProject: sharedCompilationProject
|
|
160419
160854
|
};
|
|
160420
160855
|
const constructors = document.constructors ?? [];
|
|
@@ -161570,6 +162005,9 @@ function buildValueEmitContext(records3, manifest, options = {}) {
|
|
|
161570
162005
|
dictionaryKeyOptions: /* @__PURE__ */ new Map(),
|
|
161571
162006
|
localizedTextIds: /* @__PURE__ */ new Set(),
|
|
161572
162007
|
constructionReplays: /* @__PURE__ */ new Map(),
|
|
162008
|
+
constructorOwnedArguments: /* @__PURE__ */ new Map(),
|
|
162009
|
+
constructorArgumentGraph: {},
|
|
162010
|
+
constructorRelations: /* @__PURE__ */ new WeakMap(),
|
|
161573
162011
|
constructorBodySchemaKeys: /* @__PURE__ */ new WeakMap(),
|
|
161574
162012
|
activeStoredConstructorArguments: /* @__PURE__ */ new Set(),
|
|
161575
162013
|
materializedConstructors: /* @__PURE__ */ new Map(),
|
|
@@ -162247,6 +162685,7 @@ function emitStoredConstructorExpression(context, member, valueId, visited = /*
|
|
|
162247
162685
|
context,
|
|
162248
162686
|
schemaClass2,
|
|
162249
162687
|
value,
|
|
162688
|
+
resolvedMember,
|
|
162250
162689
|
className,
|
|
162251
162690
|
environment,
|
|
162252
162691
|
visited,
|
|
@@ -163440,7 +163879,7 @@ function drainValueReferenceObligationsV4(state, manifest, options) {
|
|
|
163440
163879
|
...composeReferenceSitePosition(move.site, options.sourceTextByUri)
|
|
163441
163880
|
});
|
|
163442
163881
|
}
|
|
163443
|
-
for (const obligation of [
|
|
163882
|
+
for (const obligation of options.obligations ?? [
|
|
163444
163883
|
...collectionValueObligations(manifest),
|
|
163445
163884
|
...options.registry.referenceObligations
|
|
163446
163885
|
]) {
|
|
@@ -163460,11 +163899,29 @@ function drainValueReferenceObligationsV4(state, manifest, options) {
|
|
|
163460
163899
|
targetId = obligation.target.id;
|
|
163461
163900
|
else if (obligation.target.spelling === "symbol")
|
|
163462
163901
|
targetId = obligation.target.resolved.id;
|
|
163902
|
+
else if (obligation.target.spelling === "local")
|
|
163903
|
+
targetId = context.localValues.target(obligation.target.name);
|
|
163463
163904
|
break;
|
|
163464
163905
|
}
|
|
163465
163906
|
if (targetId !== void 0 && (options.unavailableValueIds?.has(targetId) === true || options.registry.refusedValueIds.has(targetId)))
|
|
163466
163907
|
continue;
|
|
163467
163908
|
}
|
|
163909
|
+
if (options.deferredReferences !== void 0 && obligation.kind === "reference") {
|
|
163910
|
+
const target = obligation.target;
|
|
163911
|
+
if (target.spelling === "local") {
|
|
163912
|
+
const id2 = context.localValues.target(target.name);
|
|
163913
|
+
if (context.pendingValueIdentitySites.get(id2)?.materializedLocation !== void 0) {
|
|
163914
|
+
target.patch.ids[target.patch.index] = id2;
|
|
163915
|
+
options.deferredReferences.push(obligation);
|
|
163916
|
+
continue;
|
|
163917
|
+
}
|
|
163918
|
+
} else if (target.spelling === "id") {
|
|
163919
|
+
if (referenceTargetById(context, target.id, target.typeName) === null) {
|
|
163920
|
+
options.deferredReferences.push(obligation);
|
|
163921
|
+
continue;
|
|
163922
|
+
}
|
|
163923
|
+
}
|
|
163924
|
+
}
|
|
163468
163925
|
const failure = settleReferenceObligation(
|
|
163469
163926
|
context,
|
|
163470
163927
|
obligation,
|
|
@@ -166425,10 +166882,24 @@ function lowerAuthoredValueRow(context, member, sourceExpression, expectedValueI
|
|
|
166425
166882
|
);
|
|
166426
166883
|
const checksCanonicalConstruction = requiresCanonicalConstruction && !projectedConstructionEditable;
|
|
166427
166884
|
if (source.purpose === "stored" && storedConstructorArgs !== null || checksCanonicalConstruction) {
|
|
166885
|
+
const constructionCode = settleInitializerReferenceSpellings(
|
|
166886
|
+
context.localValues.executable(
|
|
166887
|
+
authoredConstruction2,
|
|
166888
|
+
bindingRuntimeIdentifiers(context, source)
|
|
166889
|
+
).code,
|
|
166890
|
+
(call, site) => settledReferenceTarget(context, call, site, {
|
|
166891
|
+
member: resolvedMember,
|
|
166892
|
+
valueId: expectedValueId,
|
|
166893
|
+
source,
|
|
166894
|
+
expression
|
|
166895
|
+
}),
|
|
166896
|
+
context.syntax
|
|
166897
|
+
).code;
|
|
166428
166898
|
const construction = {
|
|
166429
166899
|
valueId: expectedValueId,
|
|
166430
166900
|
code: compiledCode,
|
|
166431
166901
|
construction: authoredConstruction2,
|
|
166902
|
+
constructionCode,
|
|
166432
166903
|
site: initializerSite
|
|
166433
166904
|
};
|
|
166434
166905
|
context.initializerReconciliations.set(
|
|
@@ -167314,13 +167785,16 @@ function requiredConstructorProjectionMap(classes, constructors, members2, class
|
|
|
167314
167785
|
const required2 = requiredId === void 0 ? void 0 : constructors.get(requiredId);
|
|
167315
167786
|
if (schemaClass2 === void 0 || required2 === void 0) return /* @__PURE__ */ new Map();
|
|
167316
167787
|
const result = /* @__PURE__ */ new Map();
|
|
167788
|
+
const parameterNames = new Set(
|
|
167789
|
+
required2.arguments.map((parameter4) => parameter4.name)
|
|
167790
|
+
);
|
|
167317
167791
|
for (const memberId of Object.values(schemaClass2.schema)) {
|
|
167318
167792
|
const initializer = members2.get(memberId)?.defaultValue;
|
|
167319
167793
|
if (initializer === null || initializer === void 0 || !("init" in initializer)) {
|
|
167320
167794
|
continue;
|
|
167321
167795
|
}
|
|
167322
167796
|
const parameterName = initializer.init.code.trim();
|
|
167323
|
-
if (
|
|
167797
|
+
if (parameterNames.has(parameterName)) {
|
|
167324
167798
|
result.set(parameterName, memberId);
|
|
167325
167799
|
}
|
|
167326
167800
|
}
|
|
@@ -167335,7 +167809,7 @@ function requiredConstructorProjectionMap(classes, constructors, members2, class
|
|
|
167335
167809
|
);
|
|
167336
167810
|
for (const forwarded of required2.baseArguments ?? []) {
|
|
167337
167811
|
const sourceName = forwarded.code.trim();
|
|
167338
|
-
if (!
|
|
167812
|
+
if (!parameterNames.has(sourceName)) {
|
|
167339
167813
|
continue;
|
|
167340
167814
|
}
|
|
167341
167815
|
const memberId = base.get(forwarded.name);
|
|
@@ -170145,6 +170619,7 @@ function classValueBody(context, member, value, visited, targetTyped, outerEnvir
|
|
|
170145
170619
|
context,
|
|
170146
170620
|
schemaClass2,
|
|
170147
170621
|
value,
|
|
170622
|
+
member,
|
|
170148
170623
|
name,
|
|
170149
170624
|
environment,
|
|
170150
170625
|
visited,
|
|
@@ -170166,6 +170641,7 @@ function classValueBody(context, member, value, visited, targetTyped, outerEnvir
|
|
|
170166
170641
|
context,
|
|
170167
170642
|
schemaClass2,
|
|
170168
170643
|
value,
|
|
170644
|
+
member,
|
|
170169
170645
|
name,
|
|
170170
170646
|
environment,
|
|
170171
170647
|
visited,
|
|
@@ -170247,7 +170723,7 @@ function classValueBody(context, member, value, visited, targetTyped, outerEnvir
|
|
|
170247
170723
|
context,
|
|
170248
170724
|
childMemberId,
|
|
170249
170725
|
projection.memberIds
|
|
170250
|
-
)) {
|
|
170726
|
+
) && context.localValues?.byValueId.has(childId) !== true) {
|
|
170251
170727
|
continue;
|
|
170252
170728
|
}
|
|
170253
170729
|
const childMember = context.members.get(childMemberId);
|
|
@@ -170344,7 +170820,20 @@ ${fields.map((field) => indentNeoSource(field, 2)).join(",\n")}
|
|
|
170344
170820
|
projection.arguments
|
|
170345
170821
|
) : targetTyped ? "new()" : `new ${name}()`;
|
|
170346
170822
|
if (typeof value.id === "string" && (storedConstruction !== null || projection.arguments.length > 0 || schemaClass2.requiredConstructorId !== void 0)) {
|
|
170347
|
-
|
|
170823
|
+
const usesLocalArguments = storedArgumentEntries.some(
|
|
170824
|
+
([, id2]) => context.localValues?.byValueId.has(id2)
|
|
170825
|
+
);
|
|
170826
|
+
const canonical = usesLocalArguments ? storedConstructorCallSource(
|
|
170827
|
+
{ ...context, localValues: void 0 },
|
|
170828
|
+
schemaClass2,
|
|
170829
|
+
value,
|
|
170830
|
+
member,
|
|
170831
|
+
name,
|
|
170832
|
+
environment,
|
|
170833
|
+
/* @__PURE__ */ new Set(),
|
|
170834
|
+
targetTyped
|
|
170835
|
+
) : null;
|
|
170836
|
+
context.materializedConstructors.set(value.id, canonical ?? constructor2);
|
|
170348
170837
|
}
|
|
170349
170838
|
if (typeof value.id === "string")
|
|
170350
170839
|
context.materializedConstructorOverrideKeys.set(value.id, overrideKeys);
|
|
@@ -170615,6 +171104,7 @@ function materializedValueSubgraphsEqual(context, currentGraph, replayGraph, cur
|
|
|
170615
171104
|
const typeInfo = resolveMemberDeclaredTypeInfo(
|
|
170616
171105
|
resolvedMember,
|
|
170617
171106
|
document.members,
|
|
171107
|
+
document.classes,
|
|
170618
171108
|
null,
|
|
170619
171109
|
genericEnv
|
|
170620
171110
|
);
|
|
@@ -170680,7 +171170,95 @@ function genericSlotIsRequired(context, member, environment) {
|
|
|
170680
171170
|
const binding = bindingId === void 0 ? void 0 : context.members.get(bindingId);
|
|
170681
171171
|
return binding === void 0 || isRequiredMember(binding);
|
|
170682
171172
|
}
|
|
170683
|
-
function
|
|
171173
|
+
function constructorArgumentGraph(context) {
|
|
171174
|
+
const cached = context.constructorArgumentGraph.value;
|
|
171175
|
+
if (cached !== void 0) return cached;
|
|
171176
|
+
const parents = /* @__PURE__ */ new Map();
|
|
171177
|
+
const graph = context.readMaterializedGraph();
|
|
171178
|
+
for (const [id2, placement] of context.storedPlacements.placementByChildValueId) {
|
|
171179
|
+
const parent = context.values.get(placement.parentValueId);
|
|
171180
|
+
let segment;
|
|
171181
|
+
if (typeof parent?.classId === "string")
|
|
171182
|
+
segment = `!.${placement.schemaKey}`;
|
|
171183
|
+
else {
|
|
171184
|
+
const owner = graph.ownerForValue(placement.parentValueId);
|
|
171185
|
+
const keyEnumId = owner !== void 0 && isMemberDictionaryBase(owner) ? owner.keyEnumId ?? null : null;
|
|
171186
|
+
segment = `![${emitDictionaryKey(placement.schemaKey, dictionaryOptions2(context, keyEnumId))}]`;
|
|
171187
|
+
}
|
|
171188
|
+
parents.set(id2, { parentId: placement.parentValueId, segment });
|
|
171189
|
+
}
|
|
171190
|
+
for (const [id2, row] of context.values) {
|
|
171191
|
+
const children4 = graph.childrenByContainerId.get(id2);
|
|
171192
|
+
if (!Array.isArray(row.value) && children4 === void 0) continue;
|
|
171193
|
+
if (graph.ownerForValue(id2)?.kind !== 6 /* List */) continue;
|
|
171194
|
+
const ids = Array.isArray(row.value) ? row.value : children4?.map((child2) => child2.id) ?? [];
|
|
171195
|
+
for (const [index, childId] of ids.entries())
|
|
171196
|
+
if (typeof childId === "string")
|
|
171197
|
+
parents.set(childId, { parentId: id2, segment: `![${index}]` });
|
|
171198
|
+
}
|
|
171199
|
+
const children3 = /* @__PURE__ */ new Map();
|
|
171200
|
+
for (const [id2, parent] of parents) {
|
|
171201
|
+
const siblings = children3.get(parent.parentId);
|
|
171202
|
+
if (siblings === void 0) children3.set(parent.parentId, [id2]);
|
|
171203
|
+
else siblings.push(id2);
|
|
171204
|
+
}
|
|
171205
|
+
const intervals = /* @__PURE__ */ new Map();
|
|
171206
|
+
let next = 0;
|
|
171207
|
+
const stack = [];
|
|
171208
|
+
for (const id2 of context.values.keys())
|
|
171209
|
+
if (!parents.has(id2)) stack.push({ id: id2, exit: false });
|
|
171210
|
+
while (stack.length > 0) {
|
|
171211
|
+
const frame = stack.pop();
|
|
171212
|
+
if (frame.exit) {
|
|
171213
|
+
intervals.get(frame.id).end = next;
|
|
171214
|
+
continue;
|
|
171215
|
+
}
|
|
171216
|
+
if (intervals.has(frame.id))
|
|
171217
|
+
throw new Error(
|
|
171218
|
+
`Constructor argument ownership cycle reaches ${frame.id}.`
|
|
171219
|
+
);
|
|
171220
|
+
intervals.set(frame.id, { start: next++, end: 0 });
|
|
171221
|
+
stack.push({ id: frame.id, exit: true });
|
|
171222
|
+
for (const child2 of children3.get(frame.id) ?? [])
|
|
171223
|
+
stack.push({ id: child2, exit: false });
|
|
171224
|
+
}
|
|
171225
|
+
return context.constructorArgumentGraph.value = { parents, intervals };
|
|
171226
|
+
}
|
|
171227
|
+
function constructorArgumentRelations(context, value, argumentIds) {
|
|
171228
|
+
const cached = context.constructorRelations.get(value);
|
|
171229
|
+
if (cached !== void 0) return cached;
|
|
171230
|
+
const graph = constructorArgumentGraph(context);
|
|
171231
|
+
const ordered = [...argumentIds].flatMap((id2) => {
|
|
171232
|
+
const interval = graph.intervals.get(id2);
|
|
171233
|
+
return interval === void 0 ? [] : [{ id: id2, ...interval }];
|
|
171234
|
+
}).sort((left, right) => left.start - right.start);
|
|
171235
|
+
const stack = [];
|
|
171236
|
+
const result = /* @__PURE__ */ new Map();
|
|
171237
|
+
for (const current of ordered) {
|
|
171238
|
+
while (stack.length > 0 && stack[stack.length - 1].end <= current.start)
|
|
171239
|
+
stack.pop();
|
|
171240
|
+
const parent = stack[stack.length - 1];
|
|
171241
|
+
if (parent !== void 0) result.set(current.id, { parentId: parent.id });
|
|
171242
|
+
stack.push(current);
|
|
171243
|
+
}
|
|
171244
|
+
context.constructorRelations.set(value, result);
|
|
171245
|
+
return result;
|
|
171246
|
+
}
|
|
171247
|
+
function concreteArgumentTypeName(context, type2, valueId, environment) {
|
|
171248
|
+
const row = context.values.get(valueId);
|
|
171249
|
+
if (typeof row?.classId !== "string")
|
|
171250
|
+
return storedSchemaTypeName(context, type2, environment, valueId);
|
|
171251
|
+
const settled = type2.kind === "generic" ? storedGenericArgumentType(context, type2, environment) : type2;
|
|
171252
|
+
if (settled.kind === "class" && settled.classId === row.classId)
|
|
171253
|
+
return storedSchemaTypeName(context, settled, environment, valueId);
|
|
171254
|
+
return classValueTypeName(
|
|
171255
|
+
context,
|
|
171256
|
+
row.classId,
|
|
171257
|
+
row,
|
|
171258
|
+
valueGenericEnvironment(row, environment)
|
|
171259
|
+
);
|
|
171260
|
+
}
|
|
171261
|
+
function storedConstructorCallSource(context, schemaClass2, value, member, className, environment, visited, targetTyped, cloneAggregateArguments = false, ownedArguments) {
|
|
170684
171262
|
const constructorArgs2 = value.constructorArgs;
|
|
170685
171263
|
if (!isObjectRecord(constructorArgs2)) return null;
|
|
170686
171264
|
const manifestClass = context.manifestClasses.get(
|
|
@@ -170711,7 +171289,103 @@ function storedConstructorCallSource(context, schemaClass2, value, className, en
|
|
|
170711
171289
|
manifestClass,
|
|
170712
171290
|
recordedConstructorId
|
|
170713
171291
|
);
|
|
170714
|
-
const
|
|
171292
|
+
const projectedMembers = requiredConstructorProjectionMap(
|
|
171293
|
+
context.manifestClasses,
|
|
171294
|
+
context.manifestConstructors,
|
|
171295
|
+
context.manifestMembers,
|
|
171296
|
+
stringField2(schemaClass2, "id"),
|
|
171297
|
+
/* @__PURE__ */ new Set()
|
|
171298
|
+
);
|
|
171299
|
+
const aggregateTypes = /* @__PURE__ */ new Map();
|
|
171300
|
+
for (const [index, argument2] of constructor2.arguments.entries()) {
|
|
171301
|
+
const id2 = constructorArgs2[`__arg_${index}__`];
|
|
171302
|
+
const type2 = argument2.type.kind === "generic" ? storedGenericArgumentType(context, argument2.type, environment) : argument2.type;
|
|
171303
|
+
if (typeof id2 === "string" && ["class", "interface", "list", "set", "dictionary"].includes(type2.kind))
|
|
171304
|
+
aggregateTypes.set(id2, type2);
|
|
171305
|
+
}
|
|
171306
|
+
const needsGraphReplay = aggregateTypes.size > 1 && [...aggregateTypes.keys()].some(
|
|
171307
|
+
(id2) => constructorArgumentBodySchemaKey(context, value, id2) !== void 0 || !isSharedConstructorArgument(context, id2, false)
|
|
171308
|
+
);
|
|
171309
|
+
const relations = needsGraphReplay ? constructorArgumentRelations(
|
|
171310
|
+
context,
|
|
171311
|
+
value,
|
|
171312
|
+
new Set(aggregateTypes.keys())
|
|
171313
|
+
) : /* @__PURE__ */ new Map();
|
|
171314
|
+
const relatedArguments = new Set(relations.keys());
|
|
171315
|
+
for (const relation of relations.values())
|
|
171316
|
+
relatedArguments.add(relation.parentId);
|
|
171317
|
+
const readOwnedArguments = () => {
|
|
171318
|
+
const valueId = stringField2(value, "id");
|
|
171319
|
+
const cached = context.constructorOwnedArguments.get(valueId);
|
|
171320
|
+
if (cached !== void 0) return cached;
|
|
171321
|
+
const code = storedConstructorCallSource(
|
|
171322
|
+
context,
|
|
171323
|
+
schemaClass2,
|
|
171324
|
+
value,
|
|
171325
|
+
member,
|
|
171326
|
+
className,
|
|
171327
|
+
environment,
|
|
171328
|
+
/* @__PURE__ */ new Set(),
|
|
171329
|
+
targetTyped,
|
|
171330
|
+
true,
|
|
171331
|
+
new Set(
|
|
171332
|
+
Object.values(constructorArgs2).filter(
|
|
171333
|
+
(argument2) => typeof argument2 === "string"
|
|
171334
|
+
)
|
|
171335
|
+
)
|
|
171336
|
+
);
|
|
171337
|
+
if (code === null)
|
|
171338
|
+
throw new Error(`Stored construction ${valueId} has no replay call.`);
|
|
171339
|
+
if (context.storedValueBase === void 0)
|
|
171340
|
+
context.constructorOwnershipReplayContext ??= context.readReplayContext();
|
|
171341
|
+
if (context.constructorOwnershipReplayContext === void 0) {
|
|
171342
|
+
const document = context.readDocument();
|
|
171343
|
+
let changed = false;
|
|
171344
|
+
const values = document.values.map((row) => {
|
|
171345
|
+
if (!isInitValueContent(row)) return row;
|
|
171346
|
+
const stored = context.storedValueBase?.get(row.id);
|
|
171347
|
+
if (!isMemberValue(stored) || !isLiteralValueContent(stored))
|
|
171348
|
+
return row;
|
|
171349
|
+
changed = true;
|
|
171350
|
+
return stored;
|
|
171351
|
+
});
|
|
171352
|
+
context.constructorOwnershipReplayContext = changed ? createPulledConstructionReplayContext({
|
|
171353
|
+
document: { ...document, values }
|
|
171354
|
+
}) : context.readReplayContext();
|
|
171355
|
+
}
|
|
171356
|
+
const replayContext = context.constructorOwnershipReplayContext;
|
|
171357
|
+
const rows = replayStoredConstructionV4({
|
|
171358
|
+
records: context.records,
|
|
171359
|
+
document: replayContext.document,
|
|
171360
|
+
valueId,
|
|
171361
|
+
code,
|
|
171362
|
+
member: concreteClassMemberForReplay(context, member, environment),
|
|
171363
|
+
compilationProject: context.readCompilationProject(),
|
|
171364
|
+
replayContext
|
|
171365
|
+
});
|
|
171366
|
+
const root = rows.get(valueId);
|
|
171367
|
+
const bodyIds = new Set(
|
|
171368
|
+
isObjectRecord(root?.value) ? Object.values(root.value) : []
|
|
171369
|
+
);
|
|
171370
|
+
const replayArguments2 = isObjectRecord(root?.constructorArgs) ? root.constructorArgs : {};
|
|
171371
|
+
const owned = /* @__PURE__ */ new Set();
|
|
171372
|
+
for (const [key, argument2] of Object.entries(constructorArgs2)) {
|
|
171373
|
+
if (typeof argument2 === "string" && bodyIds.has(replayArguments2[key]))
|
|
171374
|
+
owned.add(argument2);
|
|
171375
|
+
}
|
|
171376
|
+
context.constructorOwnedArguments.set(valueId, owned);
|
|
171377
|
+
const allBodyArgumentsOwned = Object.values(constructorArgs2).every(
|
|
171378
|
+
(argument2) => constructorArgumentBodySchemaKey(context, value, argument2) === void 0 || typeof argument2 === "string" && owned.has(argument2)
|
|
171379
|
+
);
|
|
171380
|
+
if (allBodyArgumentsOwned && replayContext.document === context.readDocument())
|
|
171381
|
+
context.constructionReplays.set(valueId, rows);
|
|
171382
|
+
return owned;
|
|
171383
|
+
};
|
|
171384
|
+
const argumentUses = /* @__PURE__ */ new Map();
|
|
171385
|
+
for (const argument2 of Object.values(constructorArgs2))
|
|
171386
|
+
if (typeof argument2 === "string")
|
|
171387
|
+
argumentUses.set(argument2, (argumentUses.get(argument2) ?? 0) + 1);
|
|
171388
|
+
const preparedArguments = constructor2.arguments.flatMap((argument2, index) => {
|
|
170715
171389
|
const key = `__arg_${index}__`;
|
|
170716
171390
|
if (!(key in constructorArgs2)) {
|
|
170717
171391
|
if (argument2.default !== null || argument2.type.nullable) return [];
|
|
@@ -170724,42 +171398,132 @@ function storedConstructorCallSource(context, schemaClass2, value, className, en
|
|
|
170724
171398
|
schemaClass2,
|
|
170725
171399
|
value,
|
|
170726
171400
|
constructorArgs2[key],
|
|
170727
|
-
argument2.name
|
|
171401
|
+
argument2.name,
|
|
171402
|
+
projectedMembers
|
|
170728
171403
|
);
|
|
170729
|
-
|
|
170730
|
-
|
|
171404
|
+
const bodySchemaKey = constructorArgumentBodySchemaKey(
|
|
171405
|
+
context,
|
|
171406
|
+
value,
|
|
171407
|
+
constructorArgs2[key]
|
|
171408
|
+
);
|
|
171409
|
+
let constructorOwnsGraph = bodySchemaKey !== void 0;
|
|
171410
|
+
const argumentValue = constructorArgs2[key];
|
|
171411
|
+
if (constructorOwnsGraph && typeof argumentValue === "string") {
|
|
171412
|
+
if (ownedArguments !== void 0)
|
|
171413
|
+
constructorOwnsGraph = ownedArguments.has(argumentValue);
|
|
171414
|
+
else if (projectedMembers.has(argument2.name) && argumentUses.get(argumentValue) === 1 && !relatedArguments.has(argumentValue))
|
|
171415
|
+
constructorOwnsGraph = settledMember?.kind !== 9 /* Lookup */;
|
|
171416
|
+
else constructorOwnsGraph = readOwnedArguments().has(argumentValue);
|
|
171417
|
+
}
|
|
171418
|
+
return [{ argument: argument2, argumentValue, settledMember, constructorOwnsGraph }];
|
|
171419
|
+
});
|
|
171420
|
+
const replayArguments = new Map(
|
|
171421
|
+
preparedArguments.flatMap(
|
|
171422
|
+
(entry) => typeof entry.argumentValue === "string" && aggregateTypes.has(entry.argumentValue) ? [[entry.argumentValue, entry]] : []
|
|
171423
|
+
)
|
|
171424
|
+
);
|
|
171425
|
+
const ownedReplayArguments = new Set(
|
|
171426
|
+
preparedArguments.flatMap(
|
|
171427
|
+
(entry) => entry.constructorOwnsGraph && typeof entry.argumentValue === "string" ? [entry.argumentValue] : []
|
|
171428
|
+
)
|
|
171429
|
+
);
|
|
171430
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
171431
|
+
const declarations = [];
|
|
171432
|
+
const bindArgument = (id2) => {
|
|
171433
|
+
const bound = bindings.get(id2);
|
|
171434
|
+
if (bound !== void 0) return bound;
|
|
171435
|
+
const entry = replayArguments.get(id2);
|
|
171436
|
+
if (entry === void 0)
|
|
171437
|
+
throw new Error(
|
|
171438
|
+
`Constructor replay argument ${id2} has no typed parameter.`
|
|
171439
|
+
);
|
|
171440
|
+
const relation = relations.get(id2);
|
|
171441
|
+
const parent = relation === void 0 ? void 0 : bindArgument(relation.parentId);
|
|
171442
|
+
const name = `__neo_argument_${bindings.size}`;
|
|
171443
|
+
const typeName = concreteArgumentTypeName(
|
|
171444
|
+
context,
|
|
171445
|
+
entry.argument.type,
|
|
171446
|
+
id2,
|
|
171447
|
+
environment
|
|
171448
|
+
);
|
|
171449
|
+
if (relation !== void 0 && parent !== void 0) {
|
|
171450
|
+
const graph = constructorArgumentGraph(context);
|
|
171451
|
+
const path = [];
|
|
171452
|
+
let cursor = id2;
|
|
171453
|
+
while (!bindings.has(cursor)) {
|
|
171454
|
+
const edge = graph.parents.get(cursor);
|
|
171455
|
+
if (edge === void 0)
|
|
171456
|
+
throw new Error(
|
|
171457
|
+
`Constructor argument ${cursor} has no owning path to ${relation.parentId}.`
|
|
171458
|
+
);
|
|
171459
|
+
path.push({ id: cursor, segment: edge.segment });
|
|
171460
|
+
cursor = edge.parentId;
|
|
171461
|
+
}
|
|
171462
|
+
let receiver = bindings.get(cursor);
|
|
171463
|
+
for (const step of path.reverse()) {
|
|
171464
|
+
const stepName = `__neo_argument_${bindings.size}`;
|
|
171465
|
+
const source = `${receiver}${step.segment}`;
|
|
171466
|
+
const row = context.values.get(step.id);
|
|
171467
|
+
if (typeof row?.classId === "string") {
|
|
171468
|
+
const concreteType = step.id === id2 ? typeName : classValueTypeName(
|
|
171469
|
+
context,
|
|
171470
|
+
row.classId,
|
|
171471
|
+
row,
|
|
171472
|
+
valueGenericEnvironment(row, environment)
|
|
171473
|
+
);
|
|
171474
|
+
declarations.push(
|
|
171475
|
+
`if (${source} is not ${concreteType} ${stepName}) throw ${quote3(`Constructor argument path ${step.id} no longer has type ${concreteType}.`)};`
|
|
171476
|
+
);
|
|
171477
|
+
} else declarations.push(`var ${stepName} = ${source}!;`);
|
|
171478
|
+
bindings.set(step.id, stepName);
|
|
171479
|
+
receiver = stepName;
|
|
171480
|
+
}
|
|
171481
|
+
return receiver;
|
|
171482
|
+
} else {
|
|
171483
|
+
const owns = ownedArguments?.has(id2) ?? ownedReplayArguments.has(id2);
|
|
171484
|
+
const source = storedConstructorArgumentSource(
|
|
170731
171485
|
context,
|
|
170732
|
-
|
|
170733
|
-
|
|
171486
|
+
entry.argument.type,
|
|
171487
|
+
id2,
|
|
170734
171488
|
environment,
|
|
170735
171489
|
visited,
|
|
170736
|
-
|
|
170737
|
-
settledMember?.payload === 1 /* Partial */,
|
|
170738
|
-
|
|
170739
|
-
|
|
170740
|
-
|
|
170741
|
-
|
|
170742
|
-
|
|
170743
|
-
|
|
170744
|
-
|
|
170745
|
-
|
|
170746
|
-
|
|
170747
|
-
|
|
170748
|
-
|
|
170749
|
-
|
|
170750
|
-
|
|
170751
|
-
|
|
170752
|
-
|
|
170753
|
-
|
|
171490
|
+
true,
|
|
171491
|
+
entry.settledMember?.payload === 1 /* Partial */,
|
|
171492
|
+
owns
|
|
171493
|
+
);
|
|
171494
|
+
declarations.push(`${typeName} ${name} = ${source};`);
|
|
171495
|
+
}
|
|
171496
|
+
bindings.set(id2, name);
|
|
171497
|
+
return name;
|
|
171498
|
+
};
|
|
171499
|
+
const argumentsValue = preparedArguments.map((entry) => {
|
|
171500
|
+
const { argument: argument2, argumentValue, settledMember, constructorOwnsGraph } = entry;
|
|
171501
|
+
if (cloneAggregateArguments && typeof argumentValue === "string" && aggregateTypes.has(argumentValue) && ((argumentUses.get(argumentValue) ?? 0) > 1 || relatedArguments.has(argumentValue)))
|
|
171502
|
+
return `${argument2.name}: ${bindArgument(argumentValue)}`;
|
|
171503
|
+
return `${argument2.name}: ${storedConstructorArgumentSource(
|
|
171504
|
+
context,
|
|
171505
|
+
argument2.type,
|
|
171506
|
+
argumentValue,
|
|
171507
|
+
environment,
|
|
171508
|
+
visited,
|
|
171509
|
+
cloneAggregateArguments,
|
|
171510
|
+
settledMember?.payload === 1 /* Partial */,
|
|
171511
|
+
constructorOwnsGraph
|
|
171512
|
+
)}`;
|
|
170754
171513
|
});
|
|
170755
|
-
|
|
171514
|
+
const call = constructorCallSource(
|
|
170756
171515
|
targetTyped ? "new" : `new ${className}`,
|
|
170757
171516
|
argumentsValue
|
|
170758
171517
|
);
|
|
171518
|
+
return declarations.length === 0 ? call : `(() => { ${declarations.join(" ")} return ${call}; })()`;
|
|
170759
171519
|
}
|
|
170760
|
-
function settledMemberForConstructorArgument(context, schemaClass2, value, argument2, argumentName) {
|
|
171520
|
+
function settledMemberForConstructorArgument(context, schemaClass2, value, argument2, argumentName, projectedMembers) {
|
|
170761
171521
|
if (typeof argument2 !== "string") return void 0;
|
|
170762
171522
|
const schema = isObjectRecord(schemaClass2.schema) ? schemaClass2.schema : {};
|
|
171523
|
+
const projectedMemberId = projectedMembers.get(argumentName);
|
|
171524
|
+
if (projectedMemberId !== void 0) {
|
|
171525
|
+
return context.members.get(projectedMemberId);
|
|
171526
|
+
}
|
|
170763
171527
|
const bodySchemaKey = constructorArgumentBodySchemaKey(
|
|
170764
171528
|
context,
|
|
170765
171529
|
value,
|
|
@@ -170768,16 +171532,6 @@ function settledMemberForConstructorArgument(context, schemaClass2, value, argum
|
|
|
170768
171532
|
if (bodySchemaKey !== void 0) {
|
|
170769
171533
|
return memberForSchemaKey(context, schema, bodySchemaKey);
|
|
170770
171534
|
}
|
|
170771
|
-
const projectedMemberId = requiredConstructorProjectionMap(
|
|
170772
|
-
context.manifestClasses,
|
|
170773
|
-
context.manifestConstructors,
|
|
170774
|
-
context.manifestMembers,
|
|
170775
|
-
stringField2(schemaClass2, "id"),
|
|
170776
|
-
/* @__PURE__ */ new Set()
|
|
170777
|
-
).get(argumentName);
|
|
170778
|
-
if (projectedMemberId !== void 0) {
|
|
170779
|
-
return context.members.get(projectedMemberId);
|
|
170780
|
-
}
|
|
170781
171535
|
const namedSchemaKey = schemaKeyForParameterName(schema, argumentName);
|
|
170782
171536
|
return namedSchemaKey === void 0 ? void 0 : memberForSchemaKey(context, schema, namedSchemaKey);
|
|
170783
171537
|
}
|
|
@@ -171280,7 +172034,12 @@ function storedAggregateReplaySource(context, type2, valueId, environment, const
|
|
|
171280
172034
|
`Stored ${type2.kind} constructor argument references missing value row ${valueId}.`
|
|
171281
172035
|
);
|
|
171282
172036
|
}
|
|
171283
|
-
const typeName =
|
|
172037
|
+
const typeName = concreteArgumentTypeName(
|
|
172038
|
+
context,
|
|
172039
|
+
type2,
|
|
172040
|
+
valueId,
|
|
172041
|
+
environment
|
|
172042
|
+
);
|
|
171284
172043
|
const reference2 = `Reference<${typeName}>(id: ${quote3(valueId)})`;
|
|
171285
172044
|
return isSharedConstructorArgument(context, valueId, constructorOwnsGraph) ? reference2 : `${reference2}.Clone()`;
|
|
171286
172045
|
}
|
|
@@ -171451,8 +172210,10 @@ function storedTypedRowSource(context, type2, valueId, environment, visited, wri
|
|
|
171451
172210
|
);
|
|
171452
172211
|
}
|
|
171453
172212
|
}
|
|
171454
|
-
if (isSharedConstructorArgument(context, valueId, constructorOwnsGraph)) {
|
|
171455
|
-
|
|
172213
|
+
if (context.localValues?.byValueId.has(valueId) || isSharedConstructorArgument(context, valueId, constructorOwnsGraph)) {
|
|
172214
|
+
const local = context.localValues?.byValueId.get(valueId);
|
|
172215
|
+
const target = local === void 0 ? `id: ${quote3(valueId)}` : local.name;
|
|
172216
|
+
return `Reference<${storedSchemaTypeName(context, type2, environment, valueId)}>(${target})`;
|
|
171456
172217
|
}
|
|
171457
172218
|
if (context.activeStoredConstructorArguments.has(valueId)) {
|
|
171458
172219
|
throw new Error(
|
|
@@ -172016,7 +172777,7 @@ function referenceValue(context, member, body, dialogue, slotTypeName = null) {
|
|
|
172016
172777
|
return `Reference<${dialogueSymbol}>(${dialogueSymbol})`;
|
|
172017
172778
|
}
|
|
172018
172779
|
}
|
|
172019
|
-
const symbol = context.localValues?.byValueId.get(id2)?.name ?? context.symbolsByValueId.get(id2);
|
|
172780
|
+
const symbol = (context.values.has(id2) ? context.localValues?.byValueId.get(id2)?.name : void 0) ?? context.symbolsByValueId.get(id2);
|
|
172020
172781
|
if (symbol !== void 0) return `Reference(${symbol})`;
|
|
172021
172782
|
if (slotTypeName !== null) {
|
|
172022
172783
|
const path = slotRootPath(context, id2);
|
|
@@ -173290,7 +174051,9 @@ function buildNeoScriptProject(document) {
|
|
|
173290
174051
|
classes: document.classes,
|
|
173291
174052
|
enums: document.enums,
|
|
173292
174053
|
interfaces: document.interfaces,
|
|
173293
|
-
constructors: document.constructors ?? []
|
|
174054
|
+
constructors: document.constructors ?? [],
|
|
174055
|
+
variants: document.variants,
|
|
174056
|
+
variantFolders: document.variantFolders
|
|
173294
174057
|
});
|
|
173295
174058
|
}
|
|
173296
174059
|
function neoScriptProjectFingerprint(document) {
|
|
@@ -173506,9 +174269,7 @@ function reconcileMaterializedInitializersV4(args) {
|
|
|
173506
174269
|
member: owner,
|
|
173507
174270
|
compilationProject: project
|
|
173508
174271
|
});
|
|
173509
|
-
const authored = compiled(
|
|
173510
|
-
constructorExpressionSlice(reconciliation.code)
|
|
173511
|
-
);
|
|
174272
|
+
const authored = compiled(reconciliation.constructionCode);
|
|
173512
174273
|
if (authored === null || !sameCompiledProgram(authored, compiled(canonicalExpression))) {
|
|
173513
174274
|
replayableValueIds.add(valueId);
|
|
173514
174275
|
}
|
|
@@ -173940,6 +174701,13 @@ function materializeInitializersLocallyV4(args) {
|
|
|
173940
174701
|
},
|
|
173941
174702
|
valueIds: compiledBodyIds
|
|
173942
174703
|
});
|
|
174704
|
+
const failures = [];
|
|
174705
|
+
const unavailableRootIds = /* @__PURE__ */ new Set();
|
|
174706
|
+
const onFailure = args.collectErrors === true ? (ids, error) => {
|
|
174707
|
+
const dependent = error instanceof PendingInitializerDependency && unavailableRootIds.has(error.valueId);
|
|
174708
|
+
for (const id2 of ids) unavailableRootIds.add(id2);
|
|
174709
|
+
if (!dependent) failures.push(error);
|
|
174710
|
+
} : void 0;
|
|
173943
174711
|
const compiledInitializers = /* @__PURE__ */ new Map();
|
|
173944
174712
|
const templateContext = createPulledConstructionReplayContext({
|
|
173945
174713
|
document: authoredDocument,
|
|
@@ -173952,19 +174720,25 @@ function materializeInitializersLocallyV4(args) {
|
|
|
173952
174720
|
walkedRootOwners,
|
|
173953
174721
|
batch.valuesById
|
|
173954
174722
|
);
|
|
173955
|
-
|
|
173956
|
-
|
|
173957
|
-
|
|
173958
|
-
|
|
173959
|
-
|
|
173960
|
-
|
|
173961
|
-
|
|
173962
|
-
|
|
173963
|
-
|
|
173964
|
-
|
|
173965
|
-
|
|
173966
|
-
|
|
173967
|
-
|
|
174723
|
+
try {
|
|
174724
|
+
replayStoredConstructionV4({
|
|
174725
|
+
records: records3,
|
|
174726
|
+
document: authoredDocument,
|
|
174727
|
+
valueId: id2,
|
|
174728
|
+
code: initializerCode(records3, id2),
|
|
174729
|
+
compilationProject,
|
|
174730
|
+
replayContext: templateContext,
|
|
174731
|
+
member: rootOwners.get(id2),
|
|
174732
|
+
initializerOwnerClass: ownerContext.declaringClass,
|
|
174733
|
+
lexicalThisClass: ownerContext.lexicalThisClass,
|
|
174734
|
+
evaluate: false,
|
|
174735
|
+
onCompiledInitializer: (init) => compiledInitializers.set(id2, init)
|
|
174736
|
+
});
|
|
174737
|
+
} catch (error) {
|
|
174738
|
+
if (onFailure === void 0) throw error;
|
|
174739
|
+
onFailure([id2], error);
|
|
174740
|
+
pendingRoots.delete(id2);
|
|
174741
|
+
}
|
|
173968
174742
|
}
|
|
173969
174743
|
const typeMembers = compiledConstructionTypeMembers(
|
|
173970
174744
|
authoredDocument.members,
|
|
@@ -173979,135 +174753,169 @@ function materializeInitializersLocallyV4(args) {
|
|
|
173979
174753
|
batch = createInitializerMaterializationBatch(replayDocument, pendingRoots);
|
|
173980
174754
|
}
|
|
173981
174755
|
batch.upsert(compiledClosures);
|
|
173982
|
-
|
|
173983
|
-
|
|
173984
|
-
|
|
173985
|
-
|
|
173986
|
-
|
|
173987
|
-
|
|
173988
|
-
|
|
173989
|
-
|
|
173990
|
-
|
|
173991
|
-
|
|
173992
|
-
|
|
173993
|
-
|
|
173994
|
-
|
|
173995
|
-
|
|
173996
|
-
|
|
173997
|
-
|
|
173998
|
-
|
|
173999
|
-
|
|
174000
|
-
|
|
174001
|
-
|
|
174002
|
-
|
|
174003
|
-
|
|
174004
|
-
|
|
174005
|
-
|
|
174006
|
-
|
|
174007
|
-
|
|
174008
|
-
|
|
174009
|
-
|
|
174010
|
-
|
|
174011
|
-
|
|
174012
|
-
|
|
174013
|
-
compiledInitializer: compiledInitializers.get(sourceValueId),
|
|
174014
|
-
onCompiledInitializer: (init) => {
|
|
174015
|
-
compiledInitializer = init;
|
|
174016
|
-
compiledInitializers.set(sourceValueId, init);
|
|
174017
|
-
},
|
|
174018
|
-
onConstructionPreservation: (keys) => {
|
|
174019
|
-
pinned = keys;
|
|
174756
|
+
const resolvedLocalIds = /* @__PURE__ */ new Map();
|
|
174757
|
+
materializeInitializerDependencies(
|
|
174758
|
+
pendingRoots,
|
|
174759
|
+
(sourceValueId) => {
|
|
174760
|
+
const batchDocument = batch.document();
|
|
174761
|
+
const database = batchDocument.databaseVM;
|
|
174762
|
+
if (database !== void 0) {
|
|
174763
|
+
batchDocument.databaseVM = {
|
|
174764
|
+
...database,
|
|
174765
|
+
valueById: (id2) => {
|
|
174766
|
+
if (unavailableRootIds.has(id2))
|
|
174767
|
+
throw new PendingInitializerDependency(id2);
|
|
174768
|
+
const location3 = args.localReferenceLocations?.get(id2);
|
|
174769
|
+
if (location3 === void 0) return database.valueById(id2);
|
|
174770
|
+
if (unavailableRootIds.has(location3.rootId))
|
|
174771
|
+
throw new PendingInitializerDependency(location3.rootId);
|
|
174772
|
+
if (pendingRoots.has(location3.rootId))
|
|
174773
|
+
throw new PendingInitializerDependency(location3.rootId);
|
|
174774
|
+
const target = resolvedLocalIds.get(id2) ?? storedValueAtPathV4(
|
|
174775
|
+
batch.valuesById,
|
|
174776
|
+
location3.rootId,
|
|
174777
|
+
location3.path
|
|
174778
|
+
);
|
|
174779
|
+
if (target === null)
|
|
174780
|
+
throw new Error(
|
|
174781
|
+
`Local value ${id2} has no row at its owning path.`
|
|
174782
|
+
);
|
|
174783
|
+
resolvedLocalIds.set(id2, target);
|
|
174784
|
+
return database.valueById(target);
|
|
174785
|
+
}
|
|
174786
|
+
};
|
|
174020
174787
|
}
|
|
174021
|
-
|
|
174022
|
-
|
|
174023
|
-
|
|
174024
|
-
|
|
174025
|
-
|
|
174026
|
-
);
|
|
174027
|
-
|
|
174028
|
-
if (compiledInitializer === void 0) {
|
|
174029
|
-
throw new Error(
|
|
174030
|
-
`CLI initializer materialization did not compile root "${sourceValueId}".`
|
|
174031
|
-
);
|
|
174032
|
-
}
|
|
174033
|
-
const evaluatedChildren = [...evaluated.entries()].flatMap(([id2, row]) => {
|
|
174034
|
-
if (id2 === sourceValueId) return [];
|
|
174035
|
-
if (!isMemberValue(row)) {
|
|
174788
|
+
const document = {
|
|
174789
|
+
...replayDocument,
|
|
174790
|
+
values: batchDocument.values,
|
|
174791
|
+
databaseVM: batchDocument.databaseVM
|
|
174792
|
+
};
|
|
174793
|
+
const rootOwner = rootOwners.get(sourceValueId);
|
|
174794
|
+
if (rootOwner === void 0) {
|
|
174036
174795
|
throw new Error(
|
|
174037
|
-
`CLI initializer materialization for "${sourceValueId}"
|
|
174796
|
+
`CLI initializer materialization cannot resolve the owning member for root "${sourceValueId}".`
|
|
174038
174797
|
);
|
|
174039
174798
|
}
|
|
174040
|
-
|
|
174041
|
-
|
|
174042
|
-
|
|
174043
|
-
|
|
174044
|
-
|
|
174045
|
-
|
|
174046
|
-
|
|
174047
|
-
|
|
174048
|
-
|
|
174049
|
-
|
|
174050
|
-
|
|
174051
|
-
|
|
174052
|
-
|
|
174053
|
-
|
|
174054
|
-
|
|
174055
|
-
|
|
174056
|
-
|
|
174799
|
+
const replayContext = createPulledConstructionReplayContext({
|
|
174800
|
+
document,
|
|
174801
|
+
valuesById: batch.valuesById
|
|
174802
|
+
});
|
|
174803
|
+
const code = initializerCode(records3, sourceValueId);
|
|
174804
|
+
let compiledInitializer;
|
|
174805
|
+
let pinned = {
|
|
174806
|
+
pinnedRootSchemaKeys: /* @__PURE__ */ new Set(),
|
|
174807
|
+
pinnedSchemaKeysByValueId: /* @__PURE__ */ new Map()
|
|
174808
|
+
};
|
|
174809
|
+
const evaluated = replayStoredConstructionV4({
|
|
174810
|
+
records: records3,
|
|
174811
|
+
document,
|
|
174812
|
+
valueId: sourceValueId,
|
|
174813
|
+
code,
|
|
174814
|
+
compilationProject,
|
|
174815
|
+
replayContext,
|
|
174816
|
+
member: rootOwner,
|
|
174817
|
+
compiledInitializer: compiledInitializers.get(sourceValueId),
|
|
174818
|
+
onCompiledInitializer: (init) => {
|
|
174819
|
+
compiledInitializer = init;
|
|
174820
|
+
compiledInitializers.set(sourceValueId, init);
|
|
174821
|
+
},
|
|
174822
|
+
onConstructionPreservation: (keys) => {
|
|
174823
|
+
pinned = keys;
|
|
174824
|
+
}
|
|
174825
|
+
});
|
|
174826
|
+
const evaluatedRoot = evaluated.get(sourceValueId);
|
|
174827
|
+
if (evaluatedRoot === void 0 || !isMemberValue(evaluatedRoot)) {
|
|
174828
|
+
throw new Error(
|
|
174829
|
+
`CLI initializer materialization produced no root row for value "${sourceValueId}".`
|
|
174830
|
+
);
|
|
174831
|
+
}
|
|
174832
|
+
if (compiledInitializer === void 0) {
|
|
174833
|
+
throw new Error(
|
|
174834
|
+
`CLI initializer materialization did not compile root "${sourceValueId}".`
|
|
174835
|
+
);
|
|
174836
|
+
}
|
|
174837
|
+
const evaluatedChildren = [...evaluated.entries()].flatMap(
|
|
174838
|
+
([id2, row]) => {
|
|
174839
|
+
if (id2 === sourceValueId) return [];
|
|
174840
|
+
if (!isMemberValue(row)) {
|
|
174841
|
+
throw new Error(
|
|
174842
|
+
`CLI initializer materialization for "${sourceValueId}" produced an invalid value row.`
|
|
174843
|
+
);
|
|
174844
|
+
}
|
|
174845
|
+
return [row];
|
|
174846
|
+
}
|
|
174057
174847
|
);
|
|
174058
|
-
|
|
174059
|
-
|
|
174060
|
-
|
|
174061
|
-
|
|
174848
|
+
const baseline = replayStoredConstructionV4({
|
|
174849
|
+
records: records3,
|
|
174850
|
+
document,
|
|
174851
|
+
valueId: sourceValueId,
|
|
174852
|
+
code,
|
|
174853
|
+
compilationProject,
|
|
174854
|
+
replayContext,
|
|
174855
|
+
member: rootOwner,
|
|
174856
|
+
compiledInitializer,
|
|
174857
|
+
omitConstructionFields: true
|
|
174858
|
+
});
|
|
174859
|
+
const baselineRoot = baseline.get(sourceValueId);
|
|
174860
|
+
if (baselineRoot === void 0 || !isMemberValue(baselineRoot)) {
|
|
174062
174861
|
throw new Error(
|
|
174063
|
-
`CLI initializer baseline for "${sourceValueId}"
|
|
174862
|
+
`CLI initializer baseline produced no root row for value "${sourceValueId}".`
|
|
174064
174863
|
);
|
|
174065
174864
|
}
|
|
174066
|
-
|
|
174067
|
-
|
|
174068
|
-
|
|
174069
|
-
|
|
174070
|
-
|
|
174071
|
-
|
|
174072
|
-
|
|
174073
|
-
|
|
174074
|
-
createdChildren: evaluatedChildren
|
|
174075
|
-
},
|
|
174076
|
-
baseline: {
|
|
174077
|
-
root: baselineRoot,
|
|
174078
|
-
createdChildren: baselineChildren
|
|
174079
|
-
},
|
|
174080
|
-
// §4: a call-site field is an explicit override even when it equals the
|
|
174081
|
-
// class default, so the evaluated construction's own field list is what
|
|
174082
|
-
// pins rows against collapse. Push preparation pins the same set.
|
|
174083
|
-
snapshot: pinned.snapshot,
|
|
174084
|
-
pinnedRootSchemaKeys: pinned.pinnedRootSchemaKeys,
|
|
174085
|
-
pinnedSchemaKeysByValueId: pinned.pinnedSchemaKeysByValueId,
|
|
174086
|
-
bindingTargets,
|
|
174087
|
-
virtualValueIdForSource: (instanceRootId, sourceIdentity3) => isPendingId(instanceRootId) || hasPendingVirtualSourceIdentity(sourceIdentity3) ? pendingVirtualValueId(instanceRootId, sourceIdentity3) : virtualValueId(instanceRootId, sourceIdentity3)
|
|
174088
|
-
});
|
|
174089
|
-
const evaluatedRows = [sparse2.root, ...sparse2.createdChildren];
|
|
174090
|
-
assertStoredClosuresKeepNoCaptures({
|
|
174091
|
-
sourceValueId,
|
|
174092
|
-
rows: evaluatedRows,
|
|
174093
|
-
constructors: document.constructors ?? []
|
|
174094
|
-
});
|
|
174095
|
-
roots.push({
|
|
174096
|
-
sourceValueId,
|
|
174097
|
-
rows: evaluatedRows.map((row) => ({ ...row }))
|
|
174098
|
-
});
|
|
174099
|
-
for (const row of evaluatedRows) {
|
|
174100
|
-
records3.set(`value:${row.id}`, {
|
|
174101
|
-
recordKind: "value",
|
|
174102
|
-
recordId: row.id,
|
|
174103
|
-
contentHash: "local-materialization",
|
|
174104
|
-
deleted: false,
|
|
174105
|
-
data: row
|
|
174865
|
+
const baselineChildren = [...baseline.entries()].flatMap(([id2, row]) => {
|
|
174866
|
+
if (id2 === sourceValueId) return [];
|
|
174867
|
+
if (!isMemberValue(row)) {
|
|
174868
|
+
throw new Error(
|
|
174869
|
+
`CLI initializer baseline for "${sourceValueId}" produced an invalid value row.`
|
|
174870
|
+
);
|
|
174871
|
+
}
|
|
174872
|
+
return [row];
|
|
174106
174873
|
});
|
|
174107
|
-
|
|
174108
|
-
|
|
174109
|
-
|
|
174110
|
-
|
|
174874
|
+
const sparse2 = sparsifyConstructedInstance({
|
|
174875
|
+
localizedTextIds,
|
|
174876
|
+
document,
|
|
174877
|
+
rootMember: rootOwner,
|
|
174878
|
+
constructed: {
|
|
174879
|
+
root: evaluatedRoot,
|
|
174880
|
+
createdChildren: evaluatedChildren
|
|
174881
|
+
},
|
|
174882
|
+
baseline: {
|
|
174883
|
+
root: baselineRoot,
|
|
174884
|
+
createdChildren: baselineChildren
|
|
174885
|
+
},
|
|
174886
|
+
// §4: a call-site field is an explicit override even when it equals the
|
|
174887
|
+
// class default, so the evaluated construction's own field list is what
|
|
174888
|
+
// pins rows against collapse. Push preparation pins the same set.
|
|
174889
|
+
snapshot: pinned.snapshot,
|
|
174890
|
+
pinnedRootSchemaKeys: pinned.pinnedRootSchemaKeys,
|
|
174891
|
+
pinnedSchemaKeysByValueId: pinned.pinnedSchemaKeysByValueId,
|
|
174892
|
+
bindingTargets,
|
|
174893
|
+
virtualValueIdForSource: (instanceRootId, sourceIdentity3) => isPendingId(instanceRootId) || hasPendingVirtualSourceIdentity(sourceIdentity3) ? pendingVirtualValueId(instanceRootId, sourceIdentity3) : virtualValueId(instanceRootId, sourceIdentity3)
|
|
174894
|
+
});
|
|
174895
|
+
const evaluatedRows = [sparse2.root, ...sparse2.createdChildren];
|
|
174896
|
+
assertStoredClosuresKeepNoCaptures({
|
|
174897
|
+
sourceValueId,
|
|
174898
|
+
rows: evaluatedRows,
|
|
174899
|
+
constructors: document.constructors ?? []
|
|
174900
|
+
});
|
|
174901
|
+
roots.push({
|
|
174902
|
+
sourceValueId,
|
|
174903
|
+
rows: evaluatedRows.map((row) => ({ ...row }))
|
|
174904
|
+
});
|
|
174905
|
+
for (const row of evaluatedRows) {
|
|
174906
|
+
records3.set(`value:${row.id}`, {
|
|
174907
|
+
recordKind: "value",
|
|
174908
|
+
recordId: row.id,
|
|
174909
|
+
contentHash: "local-materialization",
|
|
174910
|
+
deleted: false,
|
|
174911
|
+
data: row
|
|
174912
|
+
});
|
|
174913
|
+
}
|
|
174914
|
+
batch.upsert(evaluatedRows);
|
|
174915
|
+
},
|
|
174916
|
+
onFailure
|
|
174917
|
+
);
|
|
174918
|
+
if (validatesTouched && failures.length === 0) {
|
|
174111
174919
|
assertPulledConstructorsCompiled(pulledDocument);
|
|
174112
174920
|
const batchDocument = batch.document();
|
|
174113
174921
|
const document = {
|
|
@@ -174116,19 +174924,34 @@ function materializeInitializersLocallyV4(args) {
|
|
|
174116
174924
|
values: batchDocument.values,
|
|
174117
174925
|
databaseVM: batchDocument.databaseVM
|
|
174118
174926
|
};
|
|
174119
|
-
|
|
174120
|
-
|
|
174121
|
-
|
|
174122
|
-
|
|
174123
|
-
|
|
174124
|
-
|
|
174125
|
-
|
|
174126
|
-
|
|
174127
|
-
|
|
174128
|
-
|
|
174129
|
-
|
|
174927
|
+
try {
|
|
174928
|
+
assertTouchedInitializersConstruct({
|
|
174929
|
+
document: {
|
|
174930
|
+
...document,
|
|
174931
|
+
initializerCompiler: documentInitializerCompiler(
|
|
174932
|
+
document,
|
|
174933
|
+
compilationProject
|
|
174934
|
+
)
|
|
174935
|
+
},
|
|
174936
|
+
prepared: written,
|
|
174937
|
+
replayedValueIds: replayedRoots
|
|
174938
|
+
});
|
|
174939
|
+
} catch (error) {
|
|
174940
|
+
if (onFailure === void 0) throw error;
|
|
174941
|
+
onFailure([], error);
|
|
174942
|
+
}
|
|
174130
174943
|
}
|
|
174131
|
-
|
|
174944
|
+
for (const [id2, location3] of args.localReferenceLocations ?? []) {
|
|
174945
|
+
if (resolvedLocalIds.has(id2)) continue;
|
|
174946
|
+
if (unavailableRootIds.has(location3.rootId)) continue;
|
|
174947
|
+
const target = storedValueAtPathV4(
|
|
174948
|
+
batch.valuesById,
|
|
174949
|
+
location3.rootId,
|
|
174950
|
+
location3.path
|
|
174951
|
+
);
|
|
174952
|
+
if (target !== null) resolvedLocalIds.set(id2, target);
|
|
174953
|
+
}
|
|
174954
|
+
return { roots, resolvedLocalIds, failures, unavailableRootIds };
|
|
174132
174955
|
}
|
|
174133
174956
|
function prospectiveInitializerRecordsV4(args) {
|
|
174134
174957
|
const records3 = /* @__PURE__ */ new Map();
|
|
@@ -174258,10 +175081,10 @@ var cleanRetainedCode, pulledStateDocuments;
|
|
|
174258
175081
|
var init_local_initializer_materialization = __esm({
|
|
174259
175082
|
"src/project-source/local-initializer-materialization.ts"() {
|
|
174260
175083
|
"use strict";
|
|
175084
|
+
init_stored_value_placements();
|
|
174261
175085
|
init_local_project_file_storage();
|
|
174262
175086
|
init_immutable_json3();
|
|
174263
175087
|
init_lexer();
|
|
174264
|
-
init_init_source();
|
|
174265
175088
|
init_NSGetterRuntimeError();
|
|
174266
175089
|
init_runtime_diagnostic();
|
|
174267
175090
|
init_evaluateInitializer();
|
|
@@ -176955,6 +177778,7 @@ function lowerProjectSchemaV4(base, analysis, options = {}) {
|
|
|
176955
177778
|
);
|
|
176956
177779
|
for (const extension of analysis.schema.extensions ?? [])
|
|
176957
177780
|
lowerExtension(context, extension);
|
|
177781
|
+
retainStoredMemberDependencies(context);
|
|
176958
177782
|
normalizeLookupDeclaredTypes(context);
|
|
176959
177783
|
for (const [memberId, placements] of context.placements) {
|
|
176960
177784
|
const member = context.loweredMembers.get(memberId);
|
|
@@ -176963,9 +177787,6 @@ function lowerProjectSchemaV4(base, analysis, options = {}) {
|
|
|
176963
177787
|
context.loweredMembers.set(memberId, { ...member, owner });
|
|
176964
177788
|
}
|
|
176965
177789
|
const protectedRootMembers = lowerProtectedRootMembers(base, analysis);
|
|
176966
|
-
const structuralMembers = base.members.filter(
|
|
176967
|
-
(member) => (member.owner.kind === "genericArgument" || member.owner.kind === "sharedGenericArgument") && !context.loweredMembers.has(member.id)
|
|
176968
|
-
);
|
|
176969
177790
|
return {
|
|
176970
177791
|
...base,
|
|
176971
177792
|
classes,
|
|
@@ -176974,8 +177795,7 @@ function lowerProjectSchemaV4(base, analysis, options = {}) {
|
|
|
176974
177795
|
...context.loweredMembers.values(),
|
|
176975
177796
|
...protectedRootMembers.filter(
|
|
176976
177797
|
(member) => !context.loweredMembers.has(member.id)
|
|
176977
|
-
)
|
|
176978
|
-
...structuralMembers
|
|
177798
|
+
)
|
|
176979
177799
|
],
|
|
176980
177800
|
interfaces,
|
|
176981
177801
|
enums: analysis.schema.enums.map(
|
|
@@ -176986,6 +177806,43 @@ function lowerProjectSchemaV4(base, analysis, options = {}) {
|
|
|
176986
177806
|
internalRecordRelations: lowerRelations(context, analysis)
|
|
176987
177807
|
};
|
|
176988
177808
|
}
|
|
177809
|
+
function retainStoredMemberDependencies(context) {
|
|
177810
|
+
const retain = (memberId) => {
|
|
177811
|
+
if (context.loweredMembers.has(memberId)) return;
|
|
177812
|
+
const member = context.baseMembers.get(memberId);
|
|
177813
|
+
if (member === void 0)
|
|
177814
|
+
throw new Error(
|
|
177815
|
+
`Stored generic or collection descriptor ${memberId} is missing.`
|
|
177816
|
+
);
|
|
177817
|
+
context.loweredMembers.set(memberId, member);
|
|
177818
|
+
};
|
|
177819
|
+
const retainDependencies = (member) => {
|
|
177820
|
+
switch (member.kind) {
|
|
177821
|
+
case "class":
|
|
177822
|
+
for (const binding of Object.values(member.classArguments))
|
|
177823
|
+
if (binding.kind === "member") retain(binding.memberId);
|
|
177824
|
+
break;
|
|
177825
|
+
case "interface":
|
|
177826
|
+
for (const binding of Object.values(member.interfaceArguments))
|
|
177827
|
+
if (binding.kind === "member") retain(binding.memberId);
|
|
177828
|
+
break;
|
|
177829
|
+
case "list":
|
|
177830
|
+
case "set":
|
|
177831
|
+
case "dictionary":
|
|
177832
|
+
retain(member.entryMemberId);
|
|
177833
|
+
break;
|
|
177834
|
+
case "tuple":
|
|
177835
|
+
for (const element of member.elementMemberIds) retain(element);
|
|
177836
|
+
break;
|
|
177837
|
+
}
|
|
177838
|
+
};
|
|
177839
|
+
for (const member of context.baseMembers.values()) {
|
|
177840
|
+
if (member.owner.kind === "loose" && !context.loweredMembers.has(member.id))
|
|
177841
|
+
retainDependencies(member);
|
|
177842
|
+
}
|
|
177843
|
+
for (const member of context.loweredMembers.values())
|
|
177844
|
+
retainDependencies(member);
|
|
177845
|
+
}
|
|
176989
177846
|
function lowerProtectedRootMembers(base, analysis) {
|
|
176990
177847
|
const candidates = PROJECT_ROOT_SOURCE_SLOTS.map(
|
|
176991
177848
|
(slot) => base.members.filter(
|
|
@@ -180490,48 +181347,60 @@ function recordDeleteChange(base, file) {
|
|
|
180490
181347
|
casBaseHash: base.conflictServerHash ?? base.contentHash
|
|
180491
181348
|
};
|
|
180492
181349
|
}
|
|
180493
|
-
function
|
|
180494
|
-
const
|
|
181350
|
+
function appendOwnedSchemaMemberDeletes(workspace, reconstructed3, changes, baseManifest) {
|
|
181351
|
+
const owners = /* @__PURE__ */ new Set();
|
|
181352
|
+
const deleted = /* @__PURE__ */ new Set();
|
|
180495
181353
|
for (const change of changes) {
|
|
180496
|
-
if (change.
|
|
180497
|
-
if (
|
|
180498
|
-
|
|
180499
|
-
|
|
181354
|
+
if (change.kind === "create") continue;
|
|
181355
|
+
if (!["class", "interface", "member"].includes(change.recordKind)) continue;
|
|
181356
|
+
owners.add(change.recordId);
|
|
181357
|
+
if (change.kind === "delete") deleted.add(change.recordId);
|
|
181358
|
+
const record7 = workspace.state.records[recordStateKey(change.recordKind, change.recordId)];
|
|
181359
|
+
const data = record7 === void 0 ? void 0 : effectiveRecordData(record7);
|
|
181360
|
+
const parameters = isObjectRecord(data) ? data.genericParams : void 0;
|
|
181361
|
+
if (Array.isArray(parameters)) {
|
|
181362
|
+
for (const parameter4 of parameters) {
|
|
181363
|
+
if (isObjectRecord(parameter4) && typeof parameter4.id === "string")
|
|
181364
|
+
owners.add(parameter4.id);
|
|
181365
|
+
}
|
|
180500
181366
|
}
|
|
180501
|
-
const base = workspace.state.records[recordStateKey("member", change.recordId)];
|
|
180502
|
-
if (base === void 0) continue;
|
|
180503
|
-
const data = effectiveRecordData(base);
|
|
180504
|
-
if (isObjectRecord(data) && typeof data.entryMemberId === "string" && data.entryMemberId !== change.nextData?.entryMemberId)
|
|
180505
|
-
releasedOwnerIds.add(change.recordId);
|
|
180506
181367
|
}
|
|
180507
|
-
if (
|
|
180508
|
-
const
|
|
180509
|
-
|
|
180510
|
-
|
|
180511
|
-
|
|
180512
|
-
|
|
180513
|
-
|
|
180514
|
-
|
|
180515
|
-
|
|
180516
|
-
|
|
181368
|
+
if (owners.size === 0) return;
|
|
181369
|
+
const children3 = /* @__PURE__ */ new Map();
|
|
181370
|
+
const add = (parent, child2) => {
|
|
181371
|
+
const entries = children3.get(parent) ?? [];
|
|
181372
|
+
entries.push(child2);
|
|
181373
|
+
children3.set(parent, entries);
|
|
181374
|
+
};
|
|
181375
|
+
for (const member of baseManifest?.members ?? []) {
|
|
181376
|
+
switch (member.owner.kind) {
|
|
181377
|
+
case "genericArgument":
|
|
181378
|
+
add(member.owner.parentRecordId, member.id);
|
|
181379
|
+
break;
|
|
181380
|
+
case "sharedGenericArgument":
|
|
181381
|
+
for (const binding of member.owner.bindings)
|
|
181382
|
+
add(binding.parentRecordId, member.id);
|
|
181383
|
+
break;
|
|
181384
|
+
case "collectionEntry":
|
|
181385
|
+
add(member.owner.parentMemberId, member.id);
|
|
181386
|
+
break;
|
|
181387
|
+
case "sharedCollectionEntry":
|
|
181388
|
+
for (const parent of member.owner.parentMemberIds)
|
|
181389
|
+
add(parent, member.id);
|
|
181390
|
+
break;
|
|
181391
|
+
}
|
|
180517
181392
|
}
|
|
180518
|
-
for (const
|
|
180519
|
-
|
|
180520
|
-
|
|
180521
|
-
|
|
180522
|
-
|
|
180523
|
-
|
|
180524
|
-
|
|
180525
|
-
|
|
180526
|
-
|
|
180527
|
-
|
|
180528
|
-
|
|
180529
|
-
if (releasedOwnerIds.has(id2)) continue;
|
|
180530
|
-
const key = recordStateKey("member", id2);
|
|
180531
|
-
if (reconstructed3.has(key)) continue;
|
|
180532
|
-
const base = workspace.state.records[key];
|
|
180533
|
-
if (base === void 0 || base.conflictServerHash === null) continue;
|
|
180534
|
-
changes.push(recordDeleteChange(base, base.file ?? null));
|
|
181393
|
+
for (const ownerId of owners) {
|
|
181394
|
+
for (const memberId of children3.get(ownerId) ?? []) {
|
|
181395
|
+
const key = recordStateKey("member", memberId);
|
|
181396
|
+
if (reconstructed3.has(key)) continue;
|
|
181397
|
+
owners.add(memberId);
|
|
181398
|
+
if (deleted.has(memberId)) continue;
|
|
181399
|
+
const base = workspace.state.records[key];
|
|
181400
|
+
if (base === void 0 || base.conflictServerHash === null) continue;
|
|
181401
|
+
deleted.add(memberId);
|
|
181402
|
+
changes.push(recordDeleteChange(base, base.file ?? null));
|
|
181403
|
+
}
|
|
180535
181404
|
}
|
|
180536
181405
|
}
|
|
180537
181406
|
function listVirtualProjectSourceFilesV4(files) {
|
|
@@ -180556,10 +181425,16 @@ function compareWorkspacePaths(left, right) {
|
|
|
180556
181425
|
if (left > right) return 1;
|
|
180557
181426
|
return 0;
|
|
180558
181427
|
}
|
|
180559
|
-
function materializeWorkspaceStatusInitializers(workspace, status, forceRecompile) {
|
|
181428
|
+
function materializeWorkspaceStatusInitializers(workspace, status, forceRecompile, collectErrors = false) {
|
|
180560
181429
|
return materializeInitializersLocallyV4({
|
|
180561
181430
|
workspace,
|
|
180562
181431
|
forceRecompile,
|
|
181432
|
+
collectErrors,
|
|
181433
|
+
localReferenceLocations: new Map(
|
|
181434
|
+
[...status.pendingValueIdentitySites ?? []].flatMap(
|
|
181435
|
+
([id2, site]) => site.materializedLocation === void 0 ? [] : [[id2, site.materializedLocation]]
|
|
181436
|
+
)
|
|
181437
|
+
),
|
|
180563
181438
|
changes: status.changes.map((change) => ({
|
|
180564
181439
|
recordKind: change.recordKind,
|
|
180565
181440
|
recordId: change.recordId,
|
|
@@ -181565,12 +182440,19 @@ function computeStatus(workspace, options, conflictedFiles, parseErrors, parseWa
|
|
|
181565
182440
|
}
|
|
181566
182441
|
changes.push(recordDeleteChange(recordState, recordFile));
|
|
181567
182442
|
}
|
|
181568
|
-
|
|
182443
|
+
appendOwnedSchemaMemberDeletes(
|
|
182444
|
+
workspace,
|
|
182445
|
+
reconstructed3,
|
|
182446
|
+
changes,
|
|
182447
|
+
baseManifest
|
|
182448
|
+
);
|
|
182449
|
+
const deferredReferences = [];
|
|
181569
182450
|
const referenceFailures = drainValueReferenceObligationsV4(
|
|
181570
182451
|
prospectiveState,
|
|
181571
182452
|
manifest,
|
|
181572
182453
|
{
|
|
181573
182454
|
registry: valueLowerRegistry,
|
|
182455
|
+
deferredReferences,
|
|
181574
182456
|
analysis: projectAnalysisV4,
|
|
181575
182457
|
deletedValueIds,
|
|
181576
182458
|
unavailableReferenceMemberIds,
|
|
@@ -181621,6 +182503,17 @@ function computeStatus(workspace, options, conflictedFiles, parseErrors, parseWa
|
|
|
181621
182503
|
reconciliations: valueLowerRegistry.initializerReconciliations
|
|
181622
182504
|
});
|
|
181623
182505
|
}
|
|
182506
|
+
const localReferenceTargets = valueLowerRegistry.localValues?.referenceTargets();
|
|
182507
|
+
if (localReferenceTargets !== void 0 && localReferenceTargets.size > 0) {
|
|
182508
|
+
const rewrite = createIdentityRewriter(localReferenceTargets);
|
|
182509
|
+
authoredValueSeeds = settleInitializerKeyCode({
|
|
182510
|
+
settle: rewrite,
|
|
182511
|
+
seeds: authoredValueSeeds,
|
|
182512
|
+
reconstructed: reconstructed3,
|
|
182513
|
+
changes,
|
|
182514
|
+
reconciliations: valueLowerRegistry.initializerReconciliations
|
|
182515
|
+
});
|
|
182516
|
+
}
|
|
181624
182517
|
try {
|
|
181625
182518
|
const listeners = lowerListenerBindings({
|
|
181626
182519
|
statements: projectAnalysisV4?.listenerStatements,
|
|
@@ -181984,16 +182877,143 @@ function computeStatus(workspace, options, conflictedFiles, parseErrors, parseWa
|
|
|
181984
182877
|
)
|
|
181985
182878
|
);
|
|
181986
182879
|
}
|
|
181987
|
-
|
|
181988
|
-
|
|
181989
|
-
|
|
181990
|
-
|
|
181991
|
-
|
|
181992
|
-
|
|
181993
|
-
|
|
181994
|
-
|
|
181995
|
-
|
|
181996
|
-
|
|
182880
|
+
const hasUnresolvedLocalReferences = deferredReferences.length > 0 || [...localReferenceTargets?.values() ?? []].some(
|
|
182881
|
+
(id2) => valueLowerRegistry.pendingValueIdentitySites.get(id2)?.materializedLocation !== void 0
|
|
182882
|
+
);
|
|
182883
|
+
if (hasUnresolvedLocalReferences || options.skipInitializerMaterialization !== true && !parseErrors.some(isBlockingSchemaSourceError)) {
|
|
182884
|
+
if (hasUnresolvedLocalReferences) {
|
|
182885
|
+
try {
|
|
182886
|
+
const materialized = materializeWorkspaceStatusInitializers(
|
|
182887
|
+
workspace,
|
|
182888
|
+
{
|
|
182889
|
+
changes,
|
|
182890
|
+
authoredValueSeeds,
|
|
182891
|
+
pendingValueIdentitySites: valueLowerRegistry.pendingValueIdentitySites
|
|
182892
|
+
},
|
|
182893
|
+
options.forceRecompile,
|
|
182894
|
+
true
|
|
182895
|
+
);
|
|
182896
|
+
for (const error of materialized.failures ?? [])
|
|
182897
|
+
parseErrors.push(
|
|
182898
|
+
initializerRuntimeDiagnostic(
|
|
182899
|
+
error,
|
|
182900
|
+
valueLowerRegistry.initializerSites,
|
|
182901
|
+
sourceTextByUri,
|
|
182902
|
+
projectAnalysisV4
|
|
182903
|
+
)
|
|
182904
|
+
);
|
|
182905
|
+
const unavailableValueIds = new Set(rootValues.unavailableValueIds);
|
|
182906
|
+
for (const id2 of materialized.unavailableRootIds ?? [])
|
|
182907
|
+
unavailableValueIds.add(id2);
|
|
182908
|
+
for (const [id2, site] of valueLowerRegistry.pendingValueIdentitySites) {
|
|
182909
|
+
if (site.materializedLocation !== void 0 && materialized.unavailableRootIds?.has(
|
|
182910
|
+
site.materializedLocation.rootId
|
|
182911
|
+
))
|
|
182912
|
+
unavailableValueIds.add(id2);
|
|
182913
|
+
}
|
|
182914
|
+
for (const [id2, target] of materialized.resolvedLocalIds ?? []) {
|
|
182915
|
+
const site = valueLowerRegistry.pendingValueIdentitySites.get(id2);
|
|
182916
|
+
if (site !== void 0) {
|
|
182917
|
+
valueLowerRegistry.pendingValueIdentitySites.delete(id2);
|
|
182918
|
+
valueLowerRegistry.pendingValueIdentitySites.set(target, {
|
|
182919
|
+
...site,
|
|
182920
|
+
id: target
|
|
182921
|
+
});
|
|
182922
|
+
}
|
|
182923
|
+
}
|
|
182924
|
+
valueLowerRegistry.localValues?.remapTargets(
|
|
182925
|
+
materialized.resolvedLocalIds ?? /* @__PURE__ */ new Map()
|
|
182926
|
+
);
|
|
182927
|
+
const rewrite = createIdentityRewriter(
|
|
182928
|
+
materialized.resolvedLocalIds ?? /* @__PURE__ */ new Map()
|
|
182929
|
+
);
|
|
182930
|
+
authoredValueSeeds = settleInitializerKeyCode({
|
|
182931
|
+
settle: rewrite,
|
|
182932
|
+
references: materialized.resolvedLocalIds,
|
|
182933
|
+
seeds: authoredValueSeeds,
|
|
182934
|
+
reconstructed: reconstructed3,
|
|
182935
|
+
changes,
|
|
182936
|
+
reconciliations: valueLowerRegistry.initializerReconciliations
|
|
182937
|
+
});
|
|
182938
|
+
if (deferredReferences.length > 0) {
|
|
182939
|
+
const materializedState = { ...prospectiveState };
|
|
182940
|
+
const pendingValues = new Map(valueLowerRegistry.pendingValues);
|
|
182941
|
+
for (const root of materialized.roots) {
|
|
182942
|
+
for (const row of root.rows) {
|
|
182943
|
+
if (typeof row.id !== "string") continue;
|
|
182944
|
+
pendingValues.delete(row.id);
|
|
182945
|
+
materializedState[`value:${row.id}`] = {
|
|
182946
|
+
recordKind: "value",
|
|
182947
|
+
recordId: row.id,
|
|
182948
|
+
contentHash: "",
|
|
182949
|
+
data: row
|
|
182950
|
+
};
|
|
182951
|
+
}
|
|
182952
|
+
}
|
|
182953
|
+
const validationRegistry = { ...valueLowerRegistry, pendingValues };
|
|
182954
|
+
const failures = drainValueReferenceObligationsV4(
|
|
182955
|
+
materializedState,
|
|
182956
|
+
manifest,
|
|
182957
|
+
{
|
|
182958
|
+
registry: validationRegistry,
|
|
182959
|
+
analysis: projectAnalysisV4,
|
|
182960
|
+
obligations: deferredReferences,
|
|
182961
|
+
deletedValueIds,
|
|
182962
|
+
unavailableReferenceMemberIds,
|
|
182963
|
+
unavailableValueIds,
|
|
182964
|
+
sourceTextByUri,
|
|
182965
|
+
resolveRootPath: createRootValuePathResolverV4({
|
|
182966
|
+
manifest,
|
|
182967
|
+
state: materializedState,
|
|
182968
|
+
resolveVirtualPath,
|
|
182969
|
+
unavailableSlots: rootValues.unavailableSlots,
|
|
182970
|
+
registry: validationRegistry,
|
|
182971
|
+
initBuiltSlots: "refuse"
|
|
182972
|
+
})
|
|
182973
|
+
}
|
|
182974
|
+
);
|
|
182975
|
+
for (const failure of failures) {
|
|
182976
|
+
parseErrors.push(
|
|
182977
|
+
failure instanceof SchemaSourceError ? failure : new SchemaSourceError(
|
|
182978
|
+
failure.message,
|
|
182979
|
+
failure.file,
|
|
182980
|
+
failure.line,
|
|
182981
|
+
failure.column,
|
|
182982
|
+
failure.code
|
|
182983
|
+
)
|
|
182984
|
+
);
|
|
182985
|
+
}
|
|
182986
|
+
if (failures.length > 0)
|
|
182987
|
+
return refusedStatus(
|
|
182988
|
+
conflictedFiles,
|
|
182989
|
+
uniqueSourceErrors(parseErrors),
|
|
182990
|
+
parseWarnings
|
|
182991
|
+
);
|
|
182992
|
+
}
|
|
182993
|
+
} catch (error) {
|
|
182994
|
+
const diagnostic = initializerRuntimeDiagnostic(
|
|
182995
|
+
error,
|
|
182996
|
+
valueLowerRegistry.initializerSites,
|
|
182997
|
+
sourceTextByUri,
|
|
182998
|
+
projectAnalysisV4
|
|
182999
|
+
);
|
|
183000
|
+
parseErrors.push(diagnostic);
|
|
183001
|
+
}
|
|
183002
|
+
} else {
|
|
183003
|
+
const diagnostic = workspaceStatusInitializerDiagnostic(
|
|
183004
|
+
workspace,
|
|
183005
|
+
{
|
|
183006
|
+
changes,
|
|
183007
|
+
authoredValueSeeds,
|
|
183008
|
+
pendingValueIdentitySites: valueLowerRegistry.pendingValueIdentitySites
|
|
183009
|
+
},
|
|
183010
|
+
valueLowerRegistry.initializerSites,
|
|
183011
|
+
sourceTextByUri,
|
|
183012
|
+
projectAnalysisV4,
|
|
183013
|
+
options.forceRecompile
|
|
183014
|
+
);
|
|
183015
|
+
if (diagnostic !== null) parseErrors.push(diagnostic);
|
|
183016
|
+
}
|
|
181997
183017
|
reportPhase("initializer-materialization");
|
|
181998
183018
|
}
|
|
181999
183019
|
const dialogueBodyErrors = workspaceStatusDialogueBodyErrors(
|
|
@@ -182437,8 +183457,15 @@ function expandProspectiveAnimationInstances(document) {
|
|
|
182437
183457
|
}
|
|
182438
183458
|
function applyConstructionRebuildsV4(args) {
|
|
182439
183459
|
if (args.rebuilds.length === 0) return;
|
|
183460
|
+
const covered = /* @__PURE__ */ new Set();
|
|
183461
|
+
for (const rebuild of args.rebuilds)
|
|
183462
|
+
for (const id2 of rebuild.ownedValueIds)
|
|
183463
|
+
if (id2 !== rebuild.valueId) covered.add(id2);
|
|
183464
|
+
const roots = args.rebuilds.filter(
|
|
183465
|
+
(rebuild) => !covered.has(rebuild.valueId)
|
|
183466
|
+
);
|
|
182440
183467
|
const replanned = /* @__PURE__ */ new Set();
|
|
182441
|
-
for (const rebuild of
|
|
183468
|
+
for (const rebuild of roots) {
|
|
182442
183469
|
for (const id2 of rebuild.ownedValueIds) {
|
|
182443
183470
|
if (id2 === rebuild.valueId) continue;
|
|
182444
183471
|
const key = recordStateKey("value", id2);
|
|
@@ -182463,7 +183490,7 @@ function applyConstructionRebuildsV4(args) {
|
|
|
182463
183490
|
const key = recordStateKey(change.recordKind, change.recordId);
|
|
182464
183491
|
if (!replanned.has(key)) output.set(key, change);
|
|
182465
183492
|
}
|
|
182466
|
-
for (const rebuild of
|
|
183493
|
+
for (const rebuild of roots) {
|
|
182467
183494
|
const key = recordStateKey("value", rebuild.valueId);
|
|
182468
183495
|
const base = args.workspace.state.records[key];
|
|
182469
183496
|
if (base === void 0) {
|
|
@@ -183171,7 +184198,18 @@ function manifestRecordSources(manifest) {
|
|
|
183171
184198
|
return result;
|
|
183172
184199
|
}
|
|
183173
184200
|
function settleInitializerKeyCode(args) {
|
|
184201
|
+
const settleValue = (value) => {
|
|
184202
|
+
if (args.references === void 0) return value;
|
|
184203
|
+
if (typeof value === "string") return args.references.get(value) ?? value;
|
|
184204
|
+
if (Array.isArray(value)) return value.map(settleValue);
|
|
184205
|
+
if (!isObjectRecord(value)) return value;
|
|
184206
|
+
return Object.fromEntries(
|
|
184207
|
+
Object.entries(value).map(([key, entry]) => [key, settleValue(entry)])
|
|
184208
|
+
);
|
|
184209
|
+
};
|
|
183174
184210
|
const settleInit = (data) => {
|
|
184211
|
+
if ("value" in data && args.references !== void 0)
|
|
184212
|
+
data = { ...data, value: settleValue(data.value) };
|
|
183175
184213
|
const init = data.init;
|
|
183176
184214
|
if (!isObjectRecord(init)) return data;
|
|
183177
184215
|
if (typeof init.code !== "string") return data;
|
|
@@ -183189,10 +184227,17 @@ function settleInitializerKeyCode(args) {
|
|
|
183189
184227
|
for (const [valueId, reconciliation] of args.reconciliations) {
|
|
183190
184228
|
args.reconciliations.set(valueId, {
|
|
183191
184229
|
...reconciliation,
|
|
183192
|
-
code: args.settle(reconciliation.code)
|
|
184230
|
+
code: args.settle(reconciliation.code),
|
|
184231
|
+
...reconciliation.kind === "retainedLiteral" ? {} : { constructionCode: args.settle(reconciliation.constructionCode) }
|
|
183193
184232
|
});
|
|
183194
184233
|
}
|
|
183195
|
-
const settleNode = (node) =>
|
|
184234
|
+
const settleNode = (node) => {
|
|
184235
|
+
if (node.nodeType === "initializer")
|
|
184236
|
+
return { ...node, code: args.settle(node.code) };
|
|
184237
|
+
if (node.nodeType === "literal" && args.references !== void 0)
|
|
184238
|
+
return { ...node, value: settleValue(node.value) };
|
|
184239
|
+
return node;
|
|
184240
|
+
};
|
|
183196
184241
|
return new Map(
|
|
183197
184242
|
Array.from(args.seeds, ([memberId, seed]) => [
|
|
183198
184243
|
memberId,
|
|
@@ -183277,6 +184322,7 @@ var sourceSchemaValidation, pulledAnimationValues, animationCompilationProject,
|
|
|
183277
184322
|
var init_workspace_status_core = __esm({
|
|
183278
184323
|
"src/project-source/workspace-status-core.ts"() {
|
|
183279
184324
|
"use strict";
|
|
184325
|
+
init_identity_rewriter();
|
|
183280
184326
|
init_initializer_replay();
|
|
183281
184327
|
init_project_version_whole_graph_validation();
|
|
183282
184328
|
init_record_fields();
|
|
@@ -183349,7 +184395,6 @@ var init_workspace_status_core = __esm({
|
|
|
183349
184395
|
init_materialized_construction_cache();
|
|
183350
184396
|
init_project_version_whole_graph_validation();
|
|
183351
184397
|
init_value_base_desync();
|
|
183352
|
-
init_inheritance();
|
|
183353
184398
|
sourceSchemaValidation = createSchemaDocumentMemo();
|
|
183354
184399
|
pulledAnimationValues = /* @__PURE__ */ new WeakMap();
|
|
183355
184400
|
animationCompilationProject = createNeoScriptProjectMemo();
|
|
@@ -221768,7 +222813,7 @@ import {
|
|
|
221768
222813
|
statSync as statSync7
|
|
221769
222814
|
} from "node:fs";
|
|
221770
222815
|
import { join as join22, relative as relative8, sep as sep9 } from "node:path";
|
|
221771
|
-
function assignPendingIds(changes, authoredValueSeeds, reconstructed3, previousLedger = {}) {
|
|
222816
|
+
function assignPendingIds(changes, authoredValueSeeds, reconstructed3, previousLedger = {}, codePendingIdCandidates = []) {
|
|
221772
222817
|
const assigned = /* @__PURE__ */ new Map();
|
|
221773
222818
|
const minted = /* @__PURE__ */ new Map();
|
|
221774
222819
|
let mint = (pendingId2) => {
|
|
@@ -221779,6 +222824,14 @@ function assignPendingIds(changes, authoredValueSeeds, reconstructed3, previousL
|
|
|
221779
222824
|
const assign = (pendingId2) => {
|
|
221780
222825
|
const existing = assigned.get(pendingId2);
|
|
221781
222826
|
if (existing !== void 0) return existing;
|
|
222827
|
+
const genericArgument = pendingGenericArgumentIdentity(pendingId2);
|
|
222828
|
+
if (genericArgument !== null) {
|
|
222829
|
+
const parent = isPendingId(genericArgument.parentRecordId) ? assign(genericArgument.parentRecordId) : genericArgument.parentRecordId;
|
|
222830
|
+
const parameter4 = isPendingId(genericArgument.genericParamId) ? assign(genericArgument.genericParamId) : genericArgument.genericParamId;
|
|
222831
|
+
const derived = derivedGenericArgumentMemberId(parent, parameter4);
|
|
222832
|
+
assigned.set(pendingId2, derived);
|
|
222833
|
+
return derived;
|
|
222834
|
+
}
|
|
221782
222835
|
const pendingVirtual = pendingVirtualValueIdentity(pendingId2);
|
|
221783
222836
|
if (pendingVirtual !== null) {
|
|
221784
222837
|
const instanceRootId = isPendingId(pendingVirtual.instanceRootId) ? assign(pendingVirtual.instanceRootId) : pendingVirtual.instanceRootId;
|
|
@@ -221880,6 +222933,24 @@ function assignPendingIds(changes, authoredValueSeeds, reconstructed3, previousL
|
|
|
221880
222933
|
collect(record7.fullData);
|
|
221881
222934
|
}
|
|
221882
222935
|
}
|
|
222936
|
+
const codeCandidates = new Set(codePendingIdCandidates);
|
|
222937
|
+
if (codeCandidates.size > 0) {
|
|
222938
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
222939
|
+
const collectCodeIds = (value) => {
|
|
222940
|
+
if (value === null || typeof value !== "object" || seen.has(value))
|
|
222941
|
+
return;
|
|
222942
|
+
seen.add(value);
|
|
222943
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
222944
|
+
if (key === "code" && typeof entry === "string" && entry.includes(PENDING_ID_PREFIX)) {
|
|
222945
|
+
for (const token of lex(entry).tokens)
|
|
222946
|
+
if (token.value !== void 0 && codeCandidates.has(token.value))
|
|
222947
|
+
collect(token.value);
|
|
222948
|
+
} else collectCodeIds(entry);
|
|
222949
|
+
}
|
|
222950
|
+
};
|
|
222951
|
+
for (const change of changes) collectCodeIds(change.nextData);
|
|
222952
|
+
for (const seed of authoredValueSeeds.values()) collectCodeIds(seed);
|
|
222953
|
+
}
|
|
221883
222954
|
for (const root of roots) assign(root);
|
|
221884
222955
|
const keys = identityLedgerKeys(minted.keys());
|
|
221885
222956
|
const ledger = {};
|
|
@@ -222809,7 +223880,10 @@ async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => vo
|
|
|
222809
223880
|
status.changes,
|
|
222810
223881
|
status.authoredValueSeeds,
|
|
222811
223882
|
status.reconstructed,
|
|
222812
|
-
{ ...options.identityLedger, ...latestLedger }
|
|
223883
|
+
{ ...options.identityLedger, ...latestLedger },
|
|
223884
|
+
[...status.pendingValueIdentitySites ?? []].flatMap(
|
|
223885
|
+
([id2, site]) => site.materializedLocation !== void 0 && pendingVirtualValueIdentity(id2) !== null ? [id2] : []
|
|
223886
|
+
)
|
|
222813
223887
|
);
|
|
222814
223888
|
if (!mergeReservedIdentities(workspace.root, pendingAssignment.ledger)) {
|
|
222815
223889
|
throw new Error(
|
|
@@ -222867,6 +223941,18 @@ async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => vo
|
|
|
222867
223941
|
let prepared;
|
|
222868
223942
|
try {
|
|
222869
223943
|
const preparationArgs2 = {
|
|
223944
|
+
initializerReferenceOwners: new Map(
|
|
223945
|
+
[...status.pendingValueIdentitySites ?? []].flatMap(
|
|
223946
|
+
([id2, site]) => site.materializedLocation === void 0 ? [] : [
|
|
223947
|
+
[
|
|
223948
|
+
pendingAssignment.assigned.get(id2) ?? id2,
|
|
223949
|
+
pendingAssignment.assigned.get(
|
|
223950
|
+
site.materializedLocation.rootId
|
|
223951
|
+
) ?? site.materializedLocation.rootId
|
|
223952
|
+
]
|
|
223953
|
+
]
|
|
223954
|
+
)
|
|
223955
|
+
),
|
|
222870
223956
|
scriptSources: new Map(
|
|
222871
223957
|
[...status.scriptSources ?? []].map(([key, sources2]) => {
|
|
222872
223958
|
const colon = key.indexOf(":");
|
|
@@ -224922,6 +226008,7 @@ var init_push = __esm({
|
|
|
224922
226008
|
"src/commands/push.ts"() {
|
|
224923
226009
|
"use strict";
|
|
224924
226010
|
init_local_project_file_storage();
|
|
226011
|
+
init_generic_argument_member_id();
|
|
224925
226012
|
init_extension_source_preservation();
|
|
224926
226013
|
init_workspace_lock();
|
|
224927
226014
|
init_export_state();
|
|
@@ -240407,7 +241494,7 @@ var releaseWorkspaceLock = () => void 0;
|
|
|
240407
241494
|
async function main() {
|
|
240408
241495
|
const args = parseArgs(process.argv.slice(2));
|
|
240409
241496
|
if (args.command === "--version") {
|
|
240410
|
-
console.log("0.89.
|
|
241497
|
+
console.log("0.89.9");
|
|
240411
241498
|
return;
|
|
240412
241499
|
}
|
|
240413
241500
|
if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
|