@neocompose/cli 0.89.4 → 0.89.5
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 +28 -0
- package/dist/neo-runtime.mjs +1410 -216
- package/dist/test-worker.mjs +1035 -134
- package/package.json +1 -1
- package/skills/neocompose-cli/SKILL.md +1 -1
- package/skills/neocompose-cli/references/cli-development.md +32 -1
- package/skills/neocompose-cli/references/declarations/constructors.md +2 -0
- package/skills/neocompose-cli/references/declarations/initializers.md +4 -2
- package/skills/neocompose-cli/references/neoscript/types-and-narrowing.md +6 -0
- package/skills/neocompose-cli/references/values/files.md +5 -1
- package/skills/neocompose-cli/references/values/references.md +4 -0
- package/skills/neocompose-cli/references/world/variants.md +27 -0
package/dist/test-worker.mjs
CHANGED
|
@@ -3090,7 +3090,7 @@ function relativeDebugUri(uri) {
|
|
|
3090
3090
|
}
|
|
3091
3091
|
|
|
3092
3092
|
// ../packages/neoscript-language/src/strict-ir.ts
|
|
3093
|
-
var NEOSCRIPT_COMPILER_REVISION =
|
|
3093
|
+
var NEOSCRIPT_COMPILER_REVISION = 18;
|
|
3094
3094
|
var NeoScriptDialogueOp = /* @__PURE__ */ ((NeoScriptDialogueOp2) => {
|
|
3095
3095
|
NeoScriptDialogueOp2["TryTrigger"] = "TryTrigger";
|
|
3096
3096
|
NeoScriptDialogueOp2["CanTrigger"] = "CanTrigger";
|
|
@@ -4515,6 +4515,8 @@ function isNSWriteTarget(value) {
|
|
|
4515
4515
|
if (!target) return false;
|
|
4516
4516
|
if (!isNSPointer(target.pointer)) return false;
|
|
4517
4517
|
if (!isNSTypeInfo(target.typeInfo)) return false;
|
|
4518
|
+
if (target.structuredLeafKind !== void 0 && !isNeoScriptVectorKind(target.structuredLeafKind))
|
|
4519
|
+
return false;
|
|
4518
4520
|
if (target.writability === void 0) return true;
|
|
4519
4521
|
return Object.values(NSWritability).includes(target.writability);
|
|
4520
4522
|
}
|
|
@@ -10349,6 +10351,9 @@ function resolveMemberWithIndex(member, memberIndex) {
|
|
|
10349
10351
|
chain.reverse();
|
|
10350
10352
|
const merged = {};
|
|
10351
10353
|
for (const link of chain) {
|
|
10354
|
+
if (link.requirement === 1 /* Required */ && link.defaultValue == null && getField(merged.defaultValue, "value") === null) {
|
|
10355
|
+
delete merged.defaultValue;
|
|
10356
|
+
}
|
|
10352
10357
|
if (getField(link, "classId") !== void 0) {
|
|
10353
10358
|
delete merged.interfaceId;
|
|
10354
10359
|
delete merged.interfaceArguments;
|
|
@@ -17711,11 +17716,36 @@ function cloneDefaultValueForMember(args) {
|
|
|
17711
17716
|
throw new Error(
|
|
17712
17717
|
`Cannot clone default value graph: circular reference at value "${args.sourceValueId}".`
|
|
17713
17718
|
);
|
|
17714
|
-
const
|
|
17719
|
+
const member = substituteMember(
|
|
17720
|
+
args.member,
|
|
17721
|
+
args.genericEnv,
|
|
17722
|
+
args.document.members,
|
|
17723
|
+
args.document.resolvedMember?.(args.member)
|
|
17724
|
+
);
|
|
17725
|
+
const resolved = args.document.defaultValueSource?.(
|
|
17726
|
+
args.sourceValueId,
|
|
17727
|
+
member
|
|
17728
|
+
);
|
|
17729
|
+
const source = resolved?.value ?? findValueInDocument(
|
|
17715
17730
|
args.document,
|
|
17716
17731
|
args.sourceValueId,
|
|
17717
17732
|
args.referenceLocation
|
|
17718
17733
|
);
|
|
17734
|
+
if (resolved?.rowsById !== void 0) {
|
|
17735
|
+
const document2 = args.document;
|
|
17736
|
+
const rows = resolved.rowsById;
|
|
17737
|
+
args = {
|
|
17738
|
+
...args,
|
|
17739
|
+
document: {
|
|
17740
|
+
...document2,
|
|
17741
|
+
valueById: (id) => rows.get(id) ?? document2.valueById?.(id) ?? null,
|
|
17742
|
+
defaultValueSource: (id, child) => {
|
|
17743
|
+
const value = rows.get(id);
|
|
17744
|
+
return value === void 0 ? document2.defaultValueSource?.(id, child) ?? null : { value };
|
|
17745
|
+
}
|
|
17746
|
+
}
|
|
17747
|
+
};
|
|
17748
|
+
}
|
|
17719
17749
|
if (capture === void 0)
|
|
17720
17750
|
return cloneDefaultValueForMemberCore(args, source);
|
|
17721
17751
|
const start = source.changeListeners === void 0 ? void 0 : capture.begin();
|
|
@@ -22913,6 +22943,13 @@ var FunctionTypeInference = class {
|
|
|
22913
22943
|
this.bounds[index]?.set(`${kind}:${identity(type2)}`, { type: type2, kind });
|
|
22914
22944
|
return;
|
|
22915
22945
|
}
|
|
22946
|
+
if (pattern.kind === "tuple" && actual.kind === "tuple") {
|
|
22947
|
+
if (actual.elements.length !== pattern.elements.length) return;
|
|
22948
|
+
pattern.elements.forEach((element, index) => {
|
|
22949
|
+
this.add(actual.elements[index].type, element.type, kind);
|
|
22950
|
+
});
|
|
22951
|
+
return;
|
|
22952
|
+
}
|
|
22916
22953
|
if (pattern.kind === "named" && (pattern.typeId === NEO_SEQUENCE_IDS.IEnumerable || pattern.typeId === NEO_SEQUENCE_IDS.IEnumerator)) {
|
|
22917
22954
|
const sourceElement = neoScriptSequenceElementType(actual, "IEnumerable", this.project) ?? (pattern.typeId === NEO_SEQUENCE_IDS.IEnumerator ? neoScriptSequenceElementType(actual, "IEnumerator", this.project) : void 0);
|
|
22918
22955
|
const expectedElement = pattern.typeArguments?.[0];
|
|
@@ -25228,6 +25265,25 @@ function addEvaluatorParentLink(indexes4, childId, parentId, key) {
|
|
|
25228
25265
|
links.push({ parentId, key });
|
|
25229
25266
|
indexes4.parentLinksByChildId.set(childId, links);
|
|
25230
25267
|
}
|
|
25268
|
+
function indexRuntimeCollectionAppend(collection, entry, ctx) {
|
|
25269
|
+
const indexes4 = ctx.__indexes;
|
|
25270
|
+
const row = indexes4?.rowByValueReference.get(collection);
|
|
25271
|
+
if (indexes4 === void 0 || indexes4.invalidated || row === void 0 || ctx.__runtimeSessionValues?.get(row.id) !== row || !indexes4.indexedRowIds.has(row.id))
|
|
25272
|
+
return false;
|
|
25273
|
+
if (typeof entry === "string") {
|
|
25274
|
+
addEvaluatorParentLink(indexes4, entry, row.id, "");
|
|
25275
|
+
indexes4.ownedValueAttachmentsByValueId.delete(entry);
|
|
25276
|
+
indexes4.constructorOwnershipDirtyValueIds.add(entry);
|
|
25277
|
+
indexes4.ownershipRootIdsByRowId.clear();
|
|
25278
|
+
indexes4.ownershipDistancesByRowId.clear();
|
|
25279
|
+
indexes4.memberByRowId.clear();
|
|
25280
|
+
}
|
|
25281
|
+
forgetLocalListIndexes(ctx, collection);
|
|
25282
|
+
markOverlayMutated(ctx, collection);
|
|
25283
|
+
if (ctx.__valueOverlay instanceof LazyValueOverlay)
|
|
25284
|
+
indexes4.overlayRevision = ctx.__valueOverlay.revision;
|
|
25285
|
+
return true;
|
|
25286
|
+
}
|
|
25231
25287
|
function evaluatorParentLinks(indexes4, childId) {
|
|
25232
25288
|
const unfilteredBase = indexes4.baseParentLinksByChildId?.get(childId) ?? [];
|
|
25233
25289
|
const base = indexes4.shadowedBaseRowIds.size === 0 ? unfilteredBase : unfilteredBase.filter(
|
|
@@ -25552,11 +25608,15 @@ function evaluatorDefaultValueDocument(ctx) {
|
|
|
25552
25608
|
project: ctx.vm.project,
|
|
25553
25609
|
members: ctx.vm.members,
|
|
25554
25610
|
classes: ctx.vm.classes,
|
|
25611
|
+
constructors: ctx.vm.constructors,
|
|
25555
25612
|
interfaces: ctx.vm.interfaces ?? NO_INTERFACES,
|
|
25556
25613
|
enums: ctx.vm.enums,
|
|
25557
25614
|
values: ctx.vm.values,
|
|
25558
25615
|
memberById: ctx.vm.databaseVM?.memberById,
|
|
25559
|
-
|
|
25616
|
+
defaultValueSource: ctx.vm.databaseVM?.defaultValueSource?.bind(
|
|
25617
|
+
ctx.vm.databaseVM
|
|
25618
|
+
),
|
|
25619
|
+
valueById: ctx.vm.databaseVM?.valueById,
|
|
25560
25620
|
unorderedListEntryIds: ctx.vm.databaseVM?.unorderedListEntryIds?.bind(
|
|
25561
25621
|
ctx.vm.databaseVM
|
|
25562
25622
|
),
|
|
@@ -27700,6 +27760,12 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
27700
27760
|
destination
|
|
27701
27761
|
);
|
|
27702
27762
|
}
|
|
27763
|
+
if (target.structuredLeafKind !== void 0 && destination !== void 0)
|
|
27764
|
+
validateStructuredFieldAssignment(
|
|
27765
|
+
target.structuredLeafKind,
|
|
27766
|
+
String(destination.key),
|
|
27767
|
+
value
|
|
27768
|
+
);
|
|
27703
27769
|
assertStoredClosureCaptures(
|
|
27704
27770
|
member,
|
|
27705
27771
|
target.pointer,
|
|
@@ -27719,7 +27785,7 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
27719
27785
|
const selection = encodeLookupInitializerSelection(
|
|
27720
27786
|
lookupMember,
|
|
27721
27787
|
value,
|
|
27722
|
-
|
|
27788
|
+
/* @__PURE__ */ new Set(),
|
|
27723
27789
|
ctx,
|
|
27724
27790
|
lookupTarget
|
|
27725
27791
|
);
|
|
@@ -27732,7 +27798,7 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
27732
27798
|
);
|
|
27733
27799
|
value = selection;
|
|
27734
27800
|
}
|
|
27735
|
-
let targetTypeInfo = target.typeInfo;
|
|
27801
|
+
let targetTypeInfo = runtimeConcreteTypeInfo(target.typeInfo, ctx);
|
|
27736
27802
|
if (lookupMember !== null && targetTypeInfo.type !== 9 /* Lookup */ && targetTypeInfo.type !== 18 /* DialogueLookup */) {
|
|
27737
27803
|
const entryTypeInfo = targetTypeInfo.type === 29 /* Reference */ ? targetTypeInfo.targetTypeInfo : targetTypeInfo;
|
|
27738
27804
|
targetTypeInfo = lookupMember.collectionMemberId === void 0 ? {
|
|
@@ -28412,6 +28478,23 @@ function evalActionListenerInstruction(ins, scope, ctx, options) {
|
|
|
28412
28478
|
...resolvedDestinationFieldsForAssign(target, scope, ctx, destination)
|
|
28413
28479
|
});
|
|
28414
28480
|
}
|
|
28481
|
+
function validateStructuredFieldAssignment(kind, field, value) {
|
|
28482
|
+
const subject = kind === "Color" ? `Colour channel '${field}'` : `Vector field '${field}'`;
|
|
28483
|
+
if (typeof value !== "number")
|
|
28484
|
+
throw new NSGetterRuntimeError(`${subject} must be numeric.`);
|
|
28485
|
+
const numeric = value;
|
|
28486
|
+
if (!Number.isFinite(numeric))
|
|
28487
|
+
throw new NSGetterRuntimeError(`${subject} must be a finite number.`);
|
|
28488
|
+
if (kind === "Color" && (numeric < 0 || numeric > 1))
|
|
28489
|
+
throw new NSGetterRuntimeError(
|
|
28490
|
+
`${subject} must be within [0, 1]; found ${numeric}.`
|
|
28491
|
+
);
|
|
28492
|
+
if ((kind === "Vector2Int" || kind === "Vector3Int") && !Number.isInteger(numeric))
|
|
28493
|
+
throw new NSGetterRuntimeError(
|
|
28494
|
+
`${subject} must be an integer on an integer vector; found ${numeric}.`,
|
|
28495
|
+
{ errorClassId: NEO_ERROR_CLASS_IDS.NeoArgumentError }
|
|
28496
|
+
);
|
|
28497
|
+
}
|
|
28415
28498
|
function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, destination) {
|
|
28416
28499
|
if (target.type === "staticMember" /* staticMember */) {
|
|
28417
28500
|
if (ctx.storedConstructionReplay === true) {
|
|
@@ -28429,7 +28512,6 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
28429
28512
|
}
|
|
28430
28513
|
const receiver = destination === void 0 ? evalPointer(target.keyOf.pointer, scope, ctx) : destination.receiver;
|
|
28431
28514
|
const key = destination === void 0 ? evalPointer(target.keyOf.key, scope, ctx) : destination.key;
|
|
28432
|
-
assertStoredReplayMutableValue(receiver, ctx, "assignment target", key);
|
|
28433
28515
|
if (findKnownRowIdByValueReference(receiver, ctx) !== null)
|
|
28434
28516
|
assertInterfaceValueKind(
|
|
28435
28517
|
targetTypeInfo,
|
|
@@ -28438,6 +28520,13 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
28438
28520
|
ctx
|
|
28439
28521
|
);
|
|
28440
28522
|
const referenceValueId = targetTypeInfo.type === 7 /* Class */ || targetTypeInfo.type === 22 /* Interface */ || targetTypeInfo.type === 6 /* List */ || targetTypeInfo.type === 28 /* Set */ || targetTypeInfo.type === 5 /* Dictionary */ ? findKnownRowIdByValueReference(value, ctx) : null;
|
|
28523
|
+
const reattachesReplaySlot = ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRootId !== void 0 && target.memberId !== void 0 && referenceValueId !== null && receiver !== null && typeof receiver === "object" && Reflect.get(receiver, String(key)) === referenceValueId && findKnownRowIdByValueReference(receiver, ctx) === ctx.__storedConstructionReplayRootId;
|
|
28524
|
+
assertStoredReplayMutableValue(
|
|
28525
|
+
receiver,
|
|
28526
|
+
ctx,
|
|
28527
|
+
"assignment target",
|
|
28528
|
+
reattachesReplaySlot ? void 0 : key
|
|
28529
|
+
);
|
|
28441
28530
|
if (Array.isArray(receiver)) {
|
|
28442
28531
|
const index = numberArg(key, "List assignment index");
|
|
28443
28532
|
if (referenceValueId !== null) {
|
|
@@ -28482,6 +28571,14 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
28482
28571
|
const object = objectArg(receiver, "Assignment target");
|
|
28483
28572
|
const stringKey = String(key);
|
|
28484
28573
|
const field = target.memberId !== void 0;
|
|
28574
|
+
if (field && isTypeInfoWithEntries(targetTypeInfo)) {
|
|
28575
|
+
const slot = collectionSlotRow(target, { receiver, key }, ctx);
|
|
28576
|
+
if (slot !== null && slot.id !== referenceValueId) {
|
|
28577
|
+
object[stringKey] = slot.id;
|
|
28578
|
+
if (replaceEntryRowValue(receiver, slot.id, value, targetTypeInfo, ctx))
|
|
28579
|
+
return;
|
|
28580
|
+
}
|
|
28581
|
+
}
|
|
28485
28582
|
if (referenceValueId !== null) {
|
|
28486
28583
|
const parentId = findKnownRowIdByValueReference(receiver, ctx);
|
|
28487
28584
|
if (parentId !== null) {
|
|
@@ -28548,6 +28645,9 @@ function collectionSlotRow(target, destination, ctx) {
|
|
|
28548
28645
|
if (!isReferenceEntry(collectionReferences(receiver, ctx), entryKey))
|
|
28549
28646
|
return null;
|
|
28550
28647
|
slotId = Reflect.get(receiver, entryKey);
|
|
28648
|
+
if (typeof slotId !== "string" && target.type === "keyOf" /* keyOf */ && target.memberId !== void 0 && !Array.isArray(receiver)) {
|
|
28649
|
+
slotId = slotTargetId(receiver, String(key), target.memberId, ctx);
|
|
28650
|
+
}
|
|
28551
28651
|
}
|
|
28552
28652
|
if (typeof slotId !== "string") return null;
|
|
28553
28653
|
return evalValueById(
|
|
@@ -28619,20 +28719,196 @@ function replaceEntryRowValue(receiver, existing, value, targetTypeInfo, ctx) {
|
|
|
28619
28719
|
`collection entry '${existing}'`,
|
|
28620
28720
|
ctx
|
|
28621
28721
|
);
|
|
28622
|
-
keepAssignedCollectionValues(value, targetTypeInfo, ctx);
|
|
28722
|
+
keepAssignedCollectionValues(value, targetTypeInfo, row, ctx);
|
|
28723
|
+
if (isTypeInfoWithEntries(targetTypeInfo))
|
|
28724
|
+
retainCollectionEntryReferences(row.value, ctx);
|
|
28623
28725
|
replaceRowValue(row, value, receiver, ctx);
|
|
28624
28726
|
updateUnorderedListProjectionAfterAssignment(row, value, ctx);
|
|
28625
28727
|
return true;
|
|
28626
28728
|
}
|
|
28627
|
-
function keepAssignedCollectionValues(value, targetTypeInfo, ctx) {
|
|
28729
|
+
function keepAssignedCollectionValues(value, targetTypeInfo, row, ctx) {
|
|
28730
|
+
if (!isTypeInfoWithEntries(targetTypeInfo)) return;
|
|
28731
|
+
let collection;
|
|
28628
28732
|
const cache = unorderedListProjectionCache(ctx);
|
|
28629
|
-
if (Array.isArray(value)
|
|
28733
|
+
if (Array.isArray(value)) {
|
|
28734
|
+
collection = value;
|
|
28630
28735
|
if (!cache.referenceEntryIndexesByArray.has(value))
|
|
28631
28736
|
cache.referenceEntryIndexesByArray.set(value, /* @__PURE__ */ new Set());
|
|
28737
|
+
} else if (targetTypeInfo.type === 5 /* Dictionary */ && typeof value === "object" && value !== null) {
|
|
28738
|
+
collection = objectArg(value, "Dictionary assignment");
|
|
28739
|
+
if (!cache.referenceEntryKeysByRecord.has(collection))
|
|
28740
|
+
cache.referenceEntryKeysByRecord.set(collection, /* @__PURE__ */ new Set());
|
|
28741
|
+
} else {
|
|
28632
28742
|
return;
|
|
28633
28743
|
}
|
|
28634
|
-
|
|
28635
|
-
|
|
28744
|
+
const entryType = targetTypeInfo.entryTypeInfo;
|
|
28745
|
+
if (entryType.type !== 7 /* Class */ && entryType.type !== 22 /* Interface */)
|
|
28746
|
+
return;
|
|
28747
|
+
const member = memberForValueRow(row, ctx);
|
|
28748
|
+
if (member !== null && isMemberEntryCollectionBase(member) && listKindOf(member) === 1 /* Unordered */)
|
|
28749
|
+
return;
|
|
28750
|
+
preflightAssignedCollection(collection, member, row, ctx);
|
|
28751
|
+
forEachRawCollectionEntry(collection, ctx, ({ raw, key, valueId }) => {
|
|
28752
|
+
if (valueId !== null) return 0 /* Continue */;
|
|
28753
|
+
const rowId = findKnownRowIdByValueReference(raw, ctx);
|
|
28754
|
+
if (rowId !== null) {
|
|
28755
|
+
Reflect.set(collection, key, rowId);
|
|
28756
|
+
recordWrittenEntry(collection, key, true, ctx);
|
|
28757
|
+
}
|
|
28758
|
+
return 0 /* Continue */;
|
|
28759
|
+
});
|
|
28760
|
+
}
|
|
28761
|
+
function pendingConstructorRootsForRow(valueId, ctx) {
|
|
28762
|
+
const roots = /* @__PURE__ */ new Set();
|
|
28763
|
+
const open = ctx.__executionState?.openConstructions;
|
|
28764
|
+
if (open === void 0 || open.size === 0) return roots;
|
|
28765
|
+
const visited = /* @__PURE__ */ new Set();
|
|
28766
|
+
const pending = [valueId];
|
|
28767
|
+
const parentEntries = /* @__PURE__ */ new Map();
|
|
28768
|
+
const placingMembers = /* @__PURE__ */ new Map();
|
|
28769
|
+
while (pending.length > 0) {
|
|
28770
|
+
const id = pending.pop();
|
|
28771
|
+
if (id === void 0 || visited.has(id)) continue;
|
|
28772
|
+
visited.add(id);
|
|
28773
|
+
const row = evalValueById(
|
|
28774
|
+
ctx,
|
|
28775
|
+
id,
|
|
28776
|
+
ctx.__runtimeSessionValues,
|
|
28777
|
+
ctx.__valueOverlay
|
|
28778
|
+
);
|
|
28779
|
+
if (row === null) continue;
|
|
28780
|
+
if (typeof row.value === "object" && row.value !== null && open.has(row.value))
|
|
28781
|
+
roots.add(id);
|
|
28782
|
+
for (const owner of currentOwnedValueAttachments(
|
|
28783
|
+
id,
|
|
28784
|
+
ctx,
|
|
28785
|
+
parentEntries,
|
|
28786
|
+
placingMembers
|
|
28787
|
+
)) {
|
|
28788
|
+
if (!owner.identity.startsWith("value:")) continue;
|
|
28789
|
+
const parent = evalValueById(
|
|
28790
|
+
ctx,
|
|
28791
|
+
owner.label,
|
|
28792
|
+
ctx.__runtimeSessionValues,
|
|
28793
|
+
ctx.__valueOverlay
|
|
28794
|
+
);
|
|
28795
|
+
if (parent === null) continue;
|
|
28796
|
+
if (parent.classId === void 0 || parent.classId === null) {
|
|
28797
|
+
const raw = placingMember(
|
|
28798
|
+
parent,
|
|
28799
|
+
ctx,
|
|
28800
|
+
void 0,
|
|
28801
|
+
0,
|
|
28802
|
+
placingMembers,
|
|
28803
|
+
parentEntries
|
|
28804
|
+
);
|
|
28805
|
+
if (raw === null) continue;
|
|
28806
|
+
const member = raw.kind === 21 /* Generic */ ? substituteMember(raw, rowGenericEnv(parent, ctx), ctx.vm.members) : resolveMember(raw, ctx.vm.members);
|
|
28807
|
+
if (isMemberWithEntries(member)) {
|
|
28808
|
+
const rawEntry = evalMemberById(ctx.vm, member.entryMemberId);
|
|
28809
|
+
if (rawEntry === null) continue;
|
|
28810
|
+
const entry = rawEntry.kind === 21 /* Generic */ ? substituteMember(
|
|
28811
|
+
rawEntry,
|
|
28812
|
+
rowGenericEnv(parent, ctx),
|
|
28813
|
+
ctx.vm.members
|
|
28814
|
+
) : resolveMember(rawEntry, ctx.vm.members);
|
|
28815
|
+
if (entry.kind === 21 /* Generic */ || isMemberLookupBase(entry))
|
|
28816
|
+
continue;
|
|
28817
|
+
}
|
|
28818
|
+
}
|
|
28819
|
+
pending.push(owner.label);
|
|
28820
|
+
}
|
|
28821
|
+
for (const link of evaluatorParentLinks(evaluatorIndexes(ctx), id)) {
|
|
28822
|
+
const parent = evalValueById(
|
|
28823
|
+
ctx,
|
|
28824
|
+
link.parentId,
|
|
28825
|
+
ctx.__runtimeSessionValues,
|
|
28826
|
+
ctx.__valueOverlay
|
|
28827
|
+
);
|
|
28828
|
+
if (parent === null || !Array.isArray(parent.value)) continue;
|
|
28829
|
+
const member = placingMember(
|
|
28830
|
+
parent,
|
|
28831
|
+
ctx,
|
|
28832
|
+
void 0,
|
|
28833
|
+
0,
|
|
28834
|
+
placingMembers,
|
|
28835
|
+
parentEntries
|
|
28836
|
+
);
|
|
28837
|
+
if (member === null || !isMemberTupleBase(member)) continue;
|
|
28838
|
+
const positions = ownershipParentEntryKeys(
|
|
28839
|
+
parent.value,
|
|
28840
|
+
id,
|
|
28841
|
+
parentEntries
|
|
28842
|
+
);
|
|
28843
|
+
for (const position of positions ?? []) {
|
|
28844
|
+
if (typeof position !== "number") continue;
|
|
28845
|
+
const entryId = member.elementMemberIds[position];
|
|
28846
|
+
const rawEntry = entryId === void 0 ? null : evalMemberById(ctx.vm, entryId);
|
|
28847
|
+
if (rawEntry === null) continue;
|
|
28848
|
+
const entry = rawEntry.kind === 21 /* Generic */ ? substituteMember(
|
|
28849
|
+
rawEntry,
|
|
28850
|
+
rowGenericEnv(parent, ctx),
|
|
28851
|
+
ctx.vm.members
|
|
28852
|
+
) : resolveMember(rawEntry, ctx.vm.members);
|
|
28853
|
+
if (entry.kind === 21 /* Generic */ || isMemberLookupBase(entry))
|
|
28854
|
+
continue;
|
|
28855
|
+
pending.push(parent.id);
|
|
28856
|
+
break;
|
|
28857
|
+
}
|
|
28858
|
+
}
|
|
28859
|
+
}
|
|
28860
|
+
return roots;
|
|
28861
|
+
}
|
|
28862
|
+
function preflightAssignedCollection(collection, member, row, ctx) {
|
|
28863
|
+
if (member === null) return;
|
|
28864
|
+
const env = rowGenericEnv(row, ctx);
|
|
28865
|
+
const resolved = substituteMember(member, env, ctx.vm.members);
|
|
28866
|
+
if (!isMemberWithEntries(resolved)) return;
|
|
28867
|
+
const rawEntry = evalMemberById(ctx.vm, resolved.entryMemberId);
|
|
28868
|
+
if (rawEntry === null) return;
|
|
28869
|
+
const entry = substituteMember(rawEntry, env, ctx.vm.members);
|
|
28870
|
+
if (!isClassSlotMember(entry)) return;
|
|
28871
|
+
const attached = /* @__PURE__ */ new Set();
|
|
28872
|
+
const preflight = {
|
|
28873
|
+
parentEntries: /* @__PURE__ */ new Map(),
|
|
28874
|
+
constructorRootIds: pendingConstructorRootsForRow(row.id, ctx),
|
|
28875
|
+
constructorArgumentTransfers: /* @__PURE__ */ new Map(),
|
|
28876
|
+
dependencies: /* @__PURE__ */ new Map()
|
|
28877
|
+
};
|
|
28878
|
+
forEachRawCollectionEntry(collection, ctx, ({ raw, key, valueId }) => {
|
|
28879
|
+
const id = valueId ?? findKnownRowIdByValueReference(raw, ctx);
|
|
28880
|
+
if (id === null) return 0 /* Continue */;
|
|
28881
|
+
if (attached.has(id))
|
|
28882
|
+
throw new NSGetterRuntimeError(
|
|
28883
|
+
`Aggregate value '${id}' is already owned by another entry of '${row.id}'. Call Clone() explicitly.`
|
|
28884
|
+
);
|
|
28885
|
+
attached.add(id);
|
|
28886
|
+
const placement = Array.isArray(collection) ? "index" : "slot";
|
|
28887
|
+
assertOwnedValueAttachable(
|
|
28888
|
+
id,
|
|
28889
|
+
{ identity: `value:${row.id}:${placement}:${key}`, label: row.id },
|
|
28890
|
+
`${row.id}[${key}]`,
|
|
28891
|
+
ctx,
|
|
28892
|
+
false,
|
|
28893
|
+
"assign",
|
|
28894
|
+
preflight
|
|
28895
|
+
);
|
|
28896
|
+
return 0 /* Continue */;
|
|
28897
|
+
});
|
|
28898
|
+
for (const [id, destination] of preflight.constructorArgumentTransfers)
|
|
28899
|
+
ctx.__executionState?.ownedValueAttachments.set(id, destination);
|
|
28900
|
+
for (const [id, destination] of preflight.dependencies)
|
|
28901
|
+
recordConstructorGroupDependency(id, destination, ctx);
|
|
28902
|
+
}
|
|
28903
|
+
function retainCollectionEntryReferences(value, ctx) {
|
|
28904
|
+
if (collectionReferences(value, ctx) !== 0 /* RowIds */) return;
|
|
28905
|
+
if (Array.isArray(value)) {
|
|
28906
|
+
referenceEntryList(value, ctx);
|
|
28907
|
+
} else if (typeof value === "object" && value !== null) {
|
|
28908
|
+
unorderedListProjectionCache(ctx).referenceEntryKeysByRecord.set(
|
|
28909
|
+
value,
|
|
28910
|
+
new Set(Object.keys(value))
|
|
28911
|
+
);
|
|
28636
28912
|
}
|
|
28637
28913
|
}
|
|
28638
28914
|
function replaceRowValue(row, value, receiver, ctx) {
|
|
@@ -28719,7 +28995,7 @@ function applyOverlayStaticAssignment(memberId, targetTypeInfo, value, ctx) {
|
|
|
28719
28995
|
);
|
|
28720
28996
|
}
|
|
28721
28997
|
observeValueWrite(ctx, row);
|
|
28722
|
-
keepAssignedCollectionValues(value, targetTypeInfo, ctx);
|
|
28998
|
+
keepAssignedCollectionValues(value, targetTypeInfo, row, ctx);
|
|
28723
28999
|
row.value = value ?? null;
|
|
28724
29000
|
row.updatedAt = Date.now();
|
|
28725
29001
|
updateUnorderedListProjectionAfterAssignment(row, value, ctx);
|
|
@@ -29064,7 +29340,7 @@ function materializeSlotRow(place, targetId, ctx) {
|
|
|
29064
29340
|
const value = member === null ? read : encodeLookupInitializerSelection(
|
|
29065
29341
|
member,
|
|
29066
29342
|
read,
|
|
29067
|
-
|
|
29343
|
+
/* @__PURE__ */ new Set(),
|
|
29068
29344
|
ctx,
|
|
29069
29345
|
lookupTargetTypeInfo(member, owner, ctx)
|
|
29070
29346
|
);
|
|
@@ -29515,8 +29791,12 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29515
29791
|
);
|
|
29516
29792
|
}
|
|
29517
29793
|
const setMatch = setEntryMember !== null && Array.isArray(targetValue) && (ins.mutation === "Add" /* Add */ || ins.mutation === "Remove" /* Remove */) ? findStoredSetEntry(targetValue, args[0], setEntryMember, ctx) : null;
|
|
29518
|
-
if (ins.mutation === "Add" /* Add */
|
|
29519
|
-
|
|
29794
|
+
if (ins.mutation === "Add" /* Add */) {
|
|
29795
|
+
if (setMatch !== null) return;
|
|
29796
|
+
if (targetValue instanceof RuntimeSet && targetValue.has(runtimeSetKey(args[0], targetValue, ctx)))
|
|
29797
|
+
return;
|
|
29798
|
+
}
|
|
29799
|
+
if (ins.mutation === "Remove" /* Remove */ && setEntryMember !== null && Array.isArray(targetValue) && setMatch === null) {
|
|
29520
29800
|
return;
|
|
29521
29801
|
}
|
|
29522
29802
|
if (mutatesLocalVariable && variablePointer !== null) {
|
|
@@ -29544,6 +29824,13 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29544
29824
|
return;
|
|
29545
29825
|
}
|
|
29546
29826
|
validateCollectionMutation(targetValue, ins.mutation, args);
|
|
29827
|
+
if (!isLookupSet && entryArgumentIndex !== null && (ins.mutation === "Add" /* Add */ || ins.mutation === "Insert" /* Insert */) && findKnownRowIdByValueReference(targetValue, ctx) !== null)
|
|
29828
|
+
trackInsertedCollection(
|
|
29829
|
+
args[entryArgumentIndex],
|
|
29830
|
+
collectionEntryWriteType(ins.target.typeInfo, targetValue, ctx),
|
|
29831
|
+
targetValue,
|
|
29832
|
+
ctx
|
|
29833
|
+
);
|
|
29547
29834
|
const overlayArgs = [...args];
|
|
29548
29835
|
if ((ins.mutation === "Add" /* Add */ || ins.mutation === "Remove" /* Remove */) && isArrayCollection(targetValue)) {
|
|
29549
29836
|
if (setMatch !== null) overlayArgs[0] = setMatch.entry;
|
|
@@ -29602,6 +29889,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29602
29889
|
);
|
|
29603
29890
|
}
|
|
29604
29891
|
const removableRowIds = isLookupSet || ins.reference === true ? null : removableEntryRowIds(targetValue, ins.mutation, overlayArgs, ctx);
|
|
29892
|
+
const previousSetSize = targetValue instanceof RuntimeSet ? targetValue.size : null;
|
|
29605
29893
|
const removedIndex = applyLocalCollectionMutation(
|
|
29606
29894
|
targetValue,
|
|
29607
29895
|
ins.mutation,
|
|
@@ -29673,7 +29961,28 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29673
29961
|
cache
|
|
29674
29962
|
);
|
|
29675
29963
|
}
|
|
29676
|
-
|
|
29964
|
+
let indexedAppend = false;
|
|
29965
|
+
if (targetValue instanceof RuntimeSet) {
|
|
29966
|
+
if (ins.mutation === "Add" /* Add */) {
|
|
29967
|
+
if (targetValue.size !== previousSetSize) {
|
|
29968
|
+
targetValue.source.push(overlayArgs[0]);
|
|
29969
|
+
recordWrittenEntry(
|
|
29970
|
+
targetValue.source,
|
|
29971
|
+
targetValue.source.length - 1,
|
|
29972
|
+
targetValue.reference,
|
|
29973
|
+
ctx
|
|
29974
|
+
);
|
|
29975
|
+
indexedAppend = indexRuntimeCollectionAppend(
|
|
29976
|
+
targetValue.source,
|
|
29977
|
+
overlayArgs[0],
|
|
29978
|
+
ctx
|
|
29979
|
+
);
|
|
29980
|
+
}
|
|
29981
|
+
} else {
|
|
29982
|
+
exportRuntimeSetValue(targetValue, ctx);
|
|
29983
|
+
}
|
|
29984
|
+
}
|
|
29985
|
+
if (!indexedAppend) invalidateEvaluatorIndexes(ctx, targetValue);
|
|
29677
29986
|
switch (ins.mutation) {
|
|
29678
29987
|
case "Insert" /* Insert */:
|
|
29679
29988
|
options.writes.push({
|
|
@@ -29819,6 +30128,90 @@ function sortCollectionInPlace(ins, value, scope, ctx, options) {
|
|
|
29819
30128
|
...resolvedDestinationFieldsForContainer(list, ctx)
|
|
29820
30129
|
});
|
|
29821
30130
|
}
|
|
30131
|
+
function trackInsertedCollection(value, type2, parentValue, ctx) {
|
|
30132
|
+
if (!isTypeInfoWithEntries(type2) && type2.type !== 9 /* Lookup */ || value === null || typeof value !== "object" || findKnownRowIdByValueReference(value, ctx) !== null)
|
|
30133
|
+
return;
|
|
30134
|
+
const parent = trackedRowForValueReference(parentValue, ctx);
|
|
30135
|
+
const placement = parent === null ? null : memberForValueRow(parent, ctx);
|
|
30136
|
+
if (parent === null || placement === null) return;
|
|
30137
|
+
const genericEnv = rowGenericEnv(parent, ctx);
|
|
30138
|
+
const parentMember = substituteMember(placement, genericEnv, ctx.vm.members);
|
|
30139
|
+
if (!isMemberWithEntries(parentMember)) return;
|
|
30140
|
+
const entry = evalMemberById(ctx.vm, parentMember.entryMemberId);
|
|
30141
|
+
if (entry === null) return;
|
|
30142
|
+
const member = substituteMember(entry, genericEnv, ctx.vm.members);
|
|
30143
|
+
const createdValues = [];
|
|
30144
|
+
const collectionAliases = /* @__PURE__ */ new Map();
|
|
30145
|
+
const reservations = /* @__PURE__ */ new Map();
|
|
30146
|
+
try {
|
|
30147
|
+
const row = materializeConstructorArgumentValue({
|
|
30148
|
+
member,
|
|
30149
|
+
value,
|
|
30150
|
+
genericEnv,
|
|
30151
|
+
ctx,
|
|
30152
|
+
createdValues,
|
|
30153
|
+
createdById: /* @__PURE__ */ new Map(),
|
|
30154
|
+
storageKeyDeclarations: /* @__PURE__ */ new Map(),
|
|
30155
|
+
collectionEntriesAreReferences: false,
|
|
30156
|
+
collectionAliases,
|
|
30157
|
+
attachmentReservations: reservations
|
|
30158
|
+
});
|
|
30159
|
+
row.genericBindings = computeGenericBindingsStamp(
|
|
30160
|
+
entry,
|
|
30161
|
+
genericEnv,
|
|
30162
|
+
ctx.vm.members
|
|
30163
|
+
);
|
|
30164
|
+
for (const [encoded, alias] of collectionAliases) {
|
|
30165
|
+
retainEncodedCollectionAlias(encoded, alias, ctx);
|
|
30166
|
+
}
|
|
30167
|
+
for (const created of createdValues)
|
|
30168
|
+
registerRuntimeSessionValue(ctx, created);
|
|
30169
|
+
if (ctx.__indexes !== void 0)
|
|
30170
|
+
indexEvaluatorRows(ctx.__indexes, createdValues);
|
|
30171
|
+
} catch (error) {
|
|
30172
|
+
for (const created of createdValues)
|
|
30173
|
+
ctx.__executionState?.constructorGroupDependencies.delete(created.id);
|
|
30174
|
+
throw error;
|
|
30175
|
+
} finally {
|
|
30176
|
+
const attachments = ctx.__executionState?.ownedValueAttachments;
|
|
30177
|
+
for (const [id, previous] of reservations) {
|
|
30178
|
+
if (previous === void 0) attachments?.delete(id);
|
|
30179
|
+
else attachments?.set(id, previous);
|
|
30180
|
+
}
|
|
30181
|
+
}
|
|
30182
|
+
}
|
|
30183
|
+
function retainEncodedCollectionAlias(row, alias, ctx) {
|
|
30184
|
+
const stored = alias instanceof RuntimeSet ? alias.source : alias;
|
|
30185
|
+
if (Array.isArray(stored) && Array.isArray(row.value)) {
|
|
30186
|
+
const keys = alias instanceof RuntimeSet ? collectionEntries(alias, ctx).map(
|
|
30187
|
+
(item) => runtimeSetKey(item, alias, ctx)
|
|
30188
|
+
) : null;
|
|
30189
|
+
const encoded = row.value;
|
|
30190
|
+
stored.length = encoded.length;
|
|
30191
|
+
const references = /* @__PURE__ */ new Set();
|
|
30192
|
+
for (let index = 0; index < encoded.length; index++) {
|
|
30193
|
+
stored[index] = encoded[index];
|
|
30194
|
+
references.add(index);
|
|
30195
|
+
}
|
|
30196
|
+
unorderedListProjectionCache(ctx).referenceEntryIndexesByArray.set(
|
|
30197
|
+
stored,
|
|
30198
|
+
references
|
|
30199
|
+
);
|
|
30200
|
+
if (alias instanceof RuntimeSet && keys !== null) {
|
|
30201
|
+
alias.clear();
|
|
30202
|
+
for (let index = 0; index < stored.length; index++)
|
|
30203
|
+
alias.add(keys[index], stored[index], true);
|
|
30204
|
+
}
|
|
30205
|
+
} else if (isPlainRecord(stored) && isPlainRecord(row.value)) {
|
|
30206
|
+
for (const [key, encoded] of Object.entries(row.value))
|
|
30207
|
+
setOwnField(stored, key, encoded);
|
|
30208
|
+
unorderedListProjectionCache(ctx).referenceEntryKeysByRecord.set(
|
|
30209
|
+
stored,
|
|
30210
|
+
new Set(Object.keys(stored))
|
|
30211
|
+
);
|
|
30212
|
+
}
|
|
30213
|
+
row.value = stored;
|
|
30214
|
+
}
|
|
29822
30215
|
function storedSetEntryMember(collection, ctx) {
|
|
29823
30216
|
const containerId = findKnownRowIdByValueReference(collection, ctx);
|
|
29824
30217
|
if (containerId === null) return null;
|
|
@@ -30564,6 +30957,39 @@ function slotTargetId(owner, key, memberId, ctx) {
|
|
|
30564
30957
|
if (typeof virtual === "string") return virtual;
|
|
30565
30958
|
return virtualValueId(ownerId, memberId);
|
|
30566
30959
|
}
|
|
30960
|
+
function readDispatchedGetterValue(value, member, receiver, ctx) {
|
|
30961
|
+
if (!(value instanceof NSSlotReference) || member === null) return value;
|
|
30962
|
+
const declared = nsPropertyReturnTypeInfo(cachedResolvedMember(member, ctx));
|
|
30963
|
+
if (declared === null) return value;
|
|
30964
|
+
let expected = declared;
|
|
30965
|
+
if (typeInfoContainsGeneric2(declared)) {
|
|
30966
|
+
const row = trackedRowForValueReference(receiver, ctx);
|
|
30967
|
+
if (row === null)
|
|
30968
|
+
throw new NSGetterRuntimeError(
|
|
30969
|
+
"Cannot resolve a generic getter contract without a tracked receiver."
|
|
30970
|
+
);
|
|
30971
|
+
expected = substituteRuntimeTypeInfo(
|
|
30972
|
+
declared,
|
|
30973
|
+
runtimeGenericEnvForValueRow(row, ctx),
|
|
30974
|
+
ctx
|
|
30975
|
+
);
|
|
30976
|
+
}
|
|
30977
|
+
let readLayers = 1;
|
|
30978
|
+
let actualTarget = value.target;
|
|
30979
|
+
while (actualTarget?.type === 29 /* Reference */) {
|
|
30980
|
+
readLayers += 1;
|
|
30981
|
+
actualTarget = actualTarget.targetTypeInfo;
|
|
30982
|
+
}
|
|
30983
|
+
let target = expected;
|
|
30984
|
+
while (target.type === 29 /* Reference */) {
|
|
30985
|
+
readLayers -= 1;
|
|
30986
|
+
target = target.targetTypeInfo;
|
|
30987
|
+
}
|
|
30988
|
+
while (readLayers-- > 0 && value instanceof NSSlotReference) {
|
|
30989
|
+
value = readThroughReference(value, ctx);
|
|
30990
|
+
}
|
|
30991
|
+
return value;
|
|
30992
|
+
}
|
|
30567
30993
|
function readThroughReference(reference, ctx) {
|
|
30568
30994
|
if (!(reference instanceof NSSlotReference)) return reference;
|
|
30569
30995
|
if (reference.place !== null) {
|
|
@@ -30815,7 +31241,13 @@ function evalPointerCore(pointer, scope, ctx, resultUsage = "value") {
|
|
|
30815
31241
|
const schemaKey = pointer.memberId === NEO_SEQUENCE_IDS.Current ? "Current" : cachedSchemaKeyForMember(pointer.memberId, ctx);
|
|
30816
31242
|
if (schemaKey !== null) {
|
|
30817
31243
|
const dispatched = dispatchSchemaMember(innerThis, schemaKey, ctx);
|
|
30818
|
-
if (dispatched.kind === "ok")
|
|
31244
|
+
if (dispatched.kind === "ok")
|
|
31245
|
+
return readDispatchedGetterValue(
|
|
31246
|
+
dispatched.value,
|
|
31247
|
+
extension,
|
|
31248
|
+
innerThis,
|
|
31249
|
+
ctx
|
|
31250
|
+
);
|
|
30819
31251
|
}
|
|
30820
31252
|
return dispatchNSGetterById(pointer.memberId, innerThis, ctx);
|
|
30821
31253
|
}
|
|
@@ -33466,7 +33898,21 @@ function placingMemberBinding(row, ctx) {
|
|
|
33466
33898
|
const syntheticMemberId = memberIdFromSyntheticDefaultValueId(row.id);
|
|
33467
33899
|
return syntheticMemberId === null ? null : evalMemberById(ctx.vm, syntheticMemberId);
|
|
33468
33900
|
}
|
|
33469
|
-
function placingMember(row, ctx, ownerEdge, depth = 0) {
|
|
33901
|
+
function placingMember(row, ctx, ownerEdge, depth = 0, resolved, positions) {
|
|
33902
|
+
const known = resolved?.get(row.id);
|
|
33903
|
+
if (known !== void 0) return known;
|
|
33904
|
+
const member = resolvePlacingMember(
|
|
33905
|
+
row,
|
|
33906
|
+
ctx,
|
|
33907
|
+
ownerEdge,
|
|
33908
|
+
depth,
|
|
33909
|
+
resolved,
|
|
33910
|
+
positions
|
|
33911
|
+
);
|
|
33912
|
+
if (member !== null) resolved?.set(row.id, member);
|
|
33913
|
+
return member;
|
|
33914
|
+
}
|
|
33915
|
+
function resolvePlacingMember(row, ctx, ownerEdge, depth = 0, resolved, positions) {
|
|
33470
33916
|
const bound = placingMemberBinding(row, ctx);
|
|
33471
33917
|
if (bound !== null) return bound;
|
|
33472
33918
|
const edge = ownerEdge ?? firstOwnerEdge(row, ctx);
|
|
@@ -33475,10 +33921,26 @@ function placingMember(row, ctx, ownerEdge, depth = 0) {
|
|
|
33475
33921
|
if (depth >= MAX_AREA_DEPTH) return null;
|
|
33476
33922
|
const parent = untrackedValueById(edge.parentId, ctx);
|
|
33477
33923
|
if (parent === null) return null;
|
|
33478
|
-
const parentMember = parent.classId === void 0 ? placingMember(parent, ctx, void 0, depth + 1) : null;
|
|
33924
|
+
const parentMember = parent.classId === void 0 ? placingMember(parent, ctx, void 0, depth + 1, resolved, positions) : null;
|
|
33479
33925
|
if (parentMember !== null && isMemberTupleBase(parentMember)) {
|
|
33480
|
-
|
|
33481
|
-
|
|
33926
|
+
if (!Array.isArray(parent.value)) return null;
|
|
33927
|
+
const keys = ownershipParentEntryKeys(parent.value, row.id, positions);
|
|
33928
|
+
let selected = null;
|
|
33929
|
+
for (const key of keys ?? parent.value.keys()) {
|
|
33930
|
+
if (typeof key !== "number" || parent.value[key] !== row.id) continue;
|
|
33931
|
+
const memberId = parentMember.elementMemberIds[key];
|
|
33932
|
+
const candidate = memberId === void 0 ? null : evalMemberById(ctx.vm, memberId);
|
|
33933
|
+
if (candidate === null) continue;
|
|
33934
|
+
const contract = candidate.kind === 21 /* Generic */ ? substituteMember(
|
|
33935
|
+
candidate,
|
|
33936
|
+
rowGenericEnv(parent, ctx),
|
|
33937
|
+
ctx.vm.members
|
|
33938
|
+
) : resolveMember(candidate, ctx.vm.members);
|
|
33939
|
+
if (contract.kind !== 21 /* Generic */ && !isMemberLookupBase(contract))
|
|
33940
|
+
return candidate;
|
|
33941
|
+
selected ??= candidate;
|
|
33942
|
+
}
|
|
33943
|
+
return selected;
|
|
33482
33944
|
}
|
|
33483
33945
|
if (parentMember !== null && isMemberWithEntries(parentMember)) {
|
|
33484
33946
|
return evalMemberById(ctx.vm, parentMember.entryMemberId);
|
|
@@ -36069,7 +36531,7 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
|
|
|
36069
36531
|
members: ctx.vm.members,
|
|
36070
36532
|
constructors: ctx.vm.constructors ?? [],
|
|
36071
36533
|
values: ctx.vm.values,
|
|
36072
|
-
valueById: ctx.vm.databaseVM?.
|
|
36534
|
+
valueById: ctx.vm.databaseVM?.valueById,
|
|
36073
36535
|
memberById: evaluatorDefaultValueDocument(ctx).memberById
|
|
36074
36536
|
};
|
|
36075
36537
|
const classArguments = slotArguments ?? resolveConstructionTypeArguments(typeArguments, constructionDocument);
|
|
@@ -36390,7 +36852,7 @@ function applyConstructorFields(args) {
|
|
|
36390
36852
|
continue;
|
|
36391
36853
|
}
|
|
36392
36854
|
const { schemaKey, member } = validated;
|
|
36393
|
-
const value = isMemberLookupBase(member) ? encodeLookupInitializerSelection(member, supplied,
|
|
36855
|
+
const value = isMemberLookupBase(member) ? encodeLookupInitializerSelection(member, supplied, createdById, ctx) : supplied;
|
|
36394
36856
|
const trackedValueId = findKnownRowIdByValueReference(value, ctx);
|
|
36395
36857
|
if (trackedValueId !== null && isClassSlotMember(member)) {
|
|
36396
36858
|
const source = evalValueById(
|
|
@@ -36718,11 +37180,15 @@ function constructorDefaultValueDocument(ctx, syntheticMember2) {
|
|
|
36718
37180
|
// the entire project for every constructor replay.
|
|
36719
37181
|
values: ctx.vm.values,
|
|
36720
37182
|
memberById: database?.memberById,
|
|
37183
|
+
defaultValueSource: database?.defaultValueSource === void 0 ? void 0 : (id, member) => {
|
|
37184
|
+
ctx.valueDependencies?.add(id);
|
|
37185
|
+
return database.defaultValueSource(id, member);
|
|
37186
|
+
},
|
|
36721
37187
|
// The declaration rows a default clones are reads of this evaluation.
|
|
36722
37188
|
...database === void 0 ? {} : {
|
|
36723
37189
|
valueById: (id) => {
|
|
36724
37190
|
ctx.valueDependencies?.add(id);
|
|
36725
|
-
return database.
|
|
37191
|
+
return database.valueById(id);
|
|
36726
37192
|
}
|
|
36727
37193
|
},
|
|
36728
37194
|
...entryIdsOf === void 0 ? {} : {
|
|
@@ -37402,9 +37868,12 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
|
|
|
37402
37868
|
}
|
|
37403
37869
|
);
|
|
37404
37870
|
} catch (error) {
|
|
37405
|
-
|
|
37406
|
-
|
|
37407
|
-
|
|
37871
|
+
if (error instanceof NSGetterRuntimeError) {
|
|
37872
|
+
error.initializerValueId ??= sourceValueId ?? void 0;
|
|
37873
|
+
const ownerId = compileMemberId ?? Reflect.get(member, "id");
|
|
37874
|
+
if (sourceValueId === null && typeof ownerId === "string")
|
|
37875
|
+
error.sourceOwnerId ??= ownerId;
|
|
37876
|
+
}
|
|
37408
37877
|
throw error;
|
|
37409
37878
|
} finally {
|
|
37410
37879
|
initializerCtx.__initializerGenericEnv = previousGenericEnv;
|
|
@@ -37412,7 +37881,19 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
|
|
|
37412
37881
|
}
|
|
37413
37882
|
const created = result.createdSessionValues ?? [];
|
|
37414
37883
|
if (isMemberLookupBase(member)) {
|
|
37415
|
-
|
|
37884
|
+
const declaredTarget = lookupTargetTypeInfo(member, null, ctx);
|
|
37885
|
+
const target = typeInfoContainsGeneric2(declaredTarget) ? substituteRuntimeTypeInfo(
|
|
37886
|
+
declaredTarget,
|
|
37887
|
+
genericEnv,
|
|
37888
|
+
ctx
|
|
37889
|
+
) : declaredTarget;
|
|
37890
|
+
return encodeLookupInitializerResult(
|
|
37891
|
+
member,
|
|
37892
|
+
result.value,
|
|
37893
|
+
created,
|
|
37894
|
+
ctx,
|
|
37895
|
+
target
|
|
37896
|
+
);
|
|
37416
37897
|
}
|
|
37417
37898
|
let rootRow = initializerRootRow(result.value, created);
|
|
37418
37899
|
for (const row of created) {
|
|
@@ -37502,12 +37983,13 @@ function ensureInitializerCompiled(args) {
|
|
|
37502
37983
|
}
|
|
37503
37984
|
return compiled;
|
|
37504
37985
|
}
|
|
37505
|
-
function encodeLookupInitializerResult(member, value, created, ctx) {
|
|
37986
|
+
function encodeLookupInitializerResult(member, value, created, ctx, target = lookupTargetTypeInfo(member, null, ctx)) {
|
|
37506
37987
|
const selection = encodeLookupInitializerSelection(
|
|
37507
37988
|
member,
|
|
37508
37989
|
value,
|
|
37509
|
-
created,
|
|
37510
|
-
ctx
|
|
37990
|
+
new Set(created.map((row) => row.id)),
|
|
37991
|
+
ctx,
|
|
37992
|
+
target
|
|
37511
37993
|
);
|
|
37512
37994
|
if (created.length > 0) {
|
|
37513
37995
|
for (const row of created) {
|
|
@@ -37517,11 +37999,11 @@ function encodeLookupInitializerResult(member, value, created, ctx) {
|
|
|
37517
37999
|
}
|
|
37518
38000
|
return { value: selection, classId: null };
|
|
37519
38001
|
}
|
|
37520
|
-
function encodeLookupInitializerSelection(member, value,
|
|
38002
|
+
function encodeLookupInitializerSelection(member, value, createdIds, ctx, target = lookupTargetTypeInfo(member, null, ctx)) {
|
|
37521
38003
|
if (value === null) return null;
|
|
37522
38004
|
if (value === void 0) return null;
|
|
37523
38005
|
if (isMultiSelectionMember(member) !== true && isCollectionTypeInfo(target))
|
|
37524
|
-
return [lookupInitializerSelectionId(member, value,
|
|
38006
|
+
return [lookupInitializerSelectionId(member, value, createdIds, ctx)];
|
|
37525
38007
|
if (value instanceof RuntimeSet) value = value.toArray();
|
|
37526
38008
|
if (Array.isArray(value)) {
|
|
37527
38009
|
if (isMultiSelectionMember(member) !== true && value.length > 1) {
|
|
@@ -37530,7 +38012,7 @@ function encodeLookupInitializerSelection(member, value, created, ctx, target =
|
|
|
37530
38012
|
);
|
|
37531
38013
|
}
|
|
37532
38014
|
return value.map(
|
|
37533
|
-
(entry) => lookupInitializerSelectionId(member, entry,
|
|
38015
|
+
(entry) => lookupInitializerSelectionId(member, entry, createdIds, ctx)
|
|
37534
38016
|
);
|
|
37535
38017
|
}
|
|
37536
38018
|
if (isMultiSelectionMember(member) === true) {
|
|
@@ -37538,9 +38020,9 @@ function encodeLookupInitializerSelection(member, value, created, ctx, target =
|
|
|
37538
38020
|
`Lookup member '${member.name}' is multiselect, but its initializer produced a single value instead of a selection set.`
|
|
37539
38021
|
);
|
|
37540
38022
|
}
|
|
37541
|
-
return [lookupInitializerSelectionId(member, value,
|
|
38023
|
+
return [lookupInitializerSelectionId(member, value, createdIds, ctx)];
|
|
37542
38024
|
}
|
|
37543
|
-
function lookupInitializerSelectionId(member, entry,
|
|
38025
|
+
function lookupInitializerSelectionId(member, entry, createdIds, ctx) {
|
|
37544
38026
|
if (typeof entry === "string") return entry;
|
|
37545
38027
|
if (entry instanceof NSSlotReference) return entry.targetId;
|
|
37546
38028
|
if (typeof entry !== "object" || entry === null) {
|
|
@@ -37552,7 +38034,7 @@ function lookupInitializerSelectionId(member, entry, created, ctx) {
|
|
|
37552
38034
|
if (typeof cloneSourceRowId === "string") return cloneSourceRowId;
|
|
37553
38035
|
const row = trackedRowForValueReference(entry, ctx);
|
|
37554
38036
|
if (row !== null) {
|
|
37555
|
-
if (
|
|
38037
|
+
if (createdIds.has(row.id)) {
|
|
37556
38038
|
throw new NSGetterRuntimeError(
|
|
37557
38039
|
`Lookup member '${member.name}' initializer constructed a new value; a lookup selection must reference an existing collection entry.`
|
|
37558
38040
|
);
|
|
@@ -37731,7 +38213,11 @@ function encodeRequiredConstructorArgument(args) {
|
|
|
37731
38213
|
}
|
|
37732
38214
|
const row2 = registerCollectionRow([]);
|
|
37733
38215
|
row2.value = args.value.map(
|
|
37734
|
-
(entry, index) => encodeEntry(
|
|
38216
|
+
(entry, index) => encodeEntry(
|
|
38217
|
+
resolveCollectionEntry(args.value, entry, index, args.ctx),
|
|
38218
|
+
collectionType.entryTypeInfo,
|
|
38219
|
+
`index:${index}`
|
|
38220
|
+
)
|
|
37735
38221
|
);
|
|
37736
38222
|
return row2.id;
|
|
37737
38223
|
}
|
|
@@ -37744,7 +38230,11 @@ function encodeRequiredConstructorArgument(args) {
|
|
|
37744
38230
|
row.value = Object.fromEntries(
|
|
37745
38231
|
Object.entries(args.value).map(([key, entry]) => [
|
|
37746
38232
|
key,
|
|
37747
|
-
encodeEntry(
|
|
38233
|
+
encodeEntry(
|
|
38234
|
+
resolveCollectionEntry(args.value, entry, key, args.ctx),
|
|
38235
|
+
collectionType.entryTypeInfo,
|
|
38236
|
+
`key:${key}`
|
|
38237
|
+
)
|
|
37748
38238
|
])
|
|
37749
38239
|
);
|
|
37750
38240
|
return row.id;
|
|
@@ -38561,6 +39051,7 @@ function constructDeclaredClassValue(info, scope, ctx) {
|
|
|
38561
39051
|
const descriptor = validateClassConstructorDescriptor(info, ctx, false);
|
|
38562
39052
|
const schemaClass2 = descriptor.schemaClass;
|
|
38563
39053
|
const record4 = resolveDeclaredConstructorRecord(info, schemaClass2, ctx);
|
|
39054
|
+
const replayCheckpoint = ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === schemaClass2.id && ctx.__executionState?.constructionStack.length === 0 ? sessionCreationCheckpoint(ctx) : void 0;
|
|
38564
39055
|
const closeFrame = pushConstructionFrame(ctx, schemaClass2.name);
|
|
38565
39056
|
try {
|
|
38566
39057
|
return constructDeclaredClassValueWithinFrame(
|
|
@@ -38570,6 +39061,13 @@ function constructDeclaredClassValue(info, scope, ctx) {
|
|
|
38570
39061
|
scope,
|
|
38571
39062
|
ctx
|
|
38572
39063
|
);
|
|
39064
|
+
} catch (error) {
|
|
39065
|
+
if (replayCheckpoint !== void 0) {
|
|
39066
|
+
for (const row of createdSessionValuesSince(ctx, replayCheckpoint)) {
|
|
39067
|
+
deleteRuntimeSessionValue(ctx, row.id);
|
|
39068
|
+
}
|
|
39069
|
+
}
|
|
39070
|
+
throw error;
|
|
38573
39071
|
} finally {
|
|
38574
39072
|
closeFrame();
|
|
38575
39073
|
}
|
|
@@ -38641,6 +39139,9 @@ function constructDeclaredClassValueWithinFrame(descriptor, record4, info, scope
|
|
|
38641
39139
|
`Declared constructor for '${schemaClass2.name}' produced a non-record root.`
|
|
38642
39140
|
);
|
|
38643
39141
|
}
|
|
39142
|
+
if (ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === classId && ctx.__executionState?.constructionStack.length === 1) {
|
|
39143
|
+
ctx = { ...ctx, __storedConstructionReplayRootId: root.id };
|
|
39144
|
+
}
|
|
38644
39145
|
const rootRecord = root.value;
|
|
38645
39146
|
recordConstructedFieldSchemaKeys(ctx, rootRecord, descriptor);
|
|
38646
39147
|
if (record4 !== null) {
|
|
@@ -38778,7 +39279,14 @@ function constructDeclaredClassValueWithinFrame(descriptor, record4, info, scope
|
|
|
38778
39279
|
});
|
|
38779
39280
|
return root.value;
|
|
38780
39281
|
}
|
|
38781
|
-
function
|
|
39282
|
+
function ownedAttachmentIdentity(attachment, ctx) {
|
|
39283
|
+
const rootId = ctx.__storedConstructionReplayRootId;
|
|
39284
|
+
const rowId = ctx.__storedConstructionReplayRowId;
|
|
39285
|
+
if (rootId === void 0 || rowId === void 0) return attachment.identity;
|
|
39286
|
+
const prefix = `value:${rootId}:slot:`;
|
|
39287
|
+
return attachment.identity.startsWith(prefix) ? `value:${rowId}:slot:${attachment.identity.slice(prefix.length)}` : attachment.identity;
|
|
39288
|
+
}
|
|
39289
|
+
function assertOwnedValueAttachable(valueId, destination, destinationName, ctx, reserveUntilPublished = false, mode = "assign", preflight) {
|
|
38782
39290
|
const row = evalValueById(
|
|
38783
39291
|
ctx,
|
|
38784
39292
|
valueId,
|
|
@@ -38790,8 +39298,13 @@ function assertOwnedValueAttachable(valueId, destination, destinationName, ctx,
|
|
|
38790
39298
|
`Aggregate assignment to '${destinationName}' references missing value '${valueId}'.`
|
|
38791
39299
|
);
|
|
38792
39300
|
}
|
|
38793
|
-
for (const owner of currentOwnedValueAttachments(
|
|
38794
|
-
|
|
39301
|
+
for (const owner of currentOwnedValueAttachments(
|
|
39302
|
+
valueId,
|
|
39303
|
+
ctx,
|
|
39304
|
+
preflight?.parentEntries
|
|
39305
|
+
)) {
|
|
39306
|
+
if (mode === "assign" && ownedAttachmentIdentity(owner, ctx) === ownedAttachmentIdentity(destination, ctx))
|
|
39307
|
+
continue;
|
|
38795
39308
|
const error = new NSGetterRuntimeError(
|
|
38796
39309
|
`Aggregate value '${valueId}' is already owned by parent value '${owner.label}' and cannot be attached to '${destinationName}'. Call Clone() explicitly.`
|
|
38797
39310
|
);
|
|
@@ -38807,9 +39320,14 @@ function assertOwnedValueAttachable(valueId, destination, destinationName, ctx,
|
|
|
38807
39320
|
destination.label,
|
|
38808
39321
|
ctx
|
|
38809
39322
|
);
|
|
38810
|
-
if (constructorArgumentReservation && (destination.label === reserved.label || destinationConstructorGroup === reserved.label)) {
|
|
38811
|
-
|
|
38812
|
-
|
|
39323
|
+
if (constructorArgumentReservation && (destination.label === reserved.label || destinationConstructorGroup === reserved.label || preflight?.constructorRootIds.has(reserved.label) === true)) {
|
|
39324
|
+
if (preflight === void 0) {
|
|
39325
|
+
ctx.__executionState?.ownedValueAttachments.set(valueId, destination);
|
|
39326
|
+
recordConstructorGroupDependency(valueId, destination, ctx);
|
|
39327
|
+
} else {
|
|
39328
|
+
preflight.constructorArgumentTransfers.set(valueId, destination);
|
|
39329
|
+
preflight.dependencies.set(valueId, destination);
|
|
39330
|
+
}
|
|
38813
39331
|
return;
|
|
38814
39332
|
}
|
|
38815
39333
|
throw new NSGetterRuntimeError(
|
|
@@ -38819,7 +39337,9 @@ function assertOwnedValueAttachable(valueId, destination, destinationName, ctx,
|
|
|
38819
39337
|
if (reserveUntilPublished) {
|
|
38820
39338
|
ctx.__executionState?.ownedValueAttachments.set(valueId, destination);
|
|
38821
39339
|
}
|
|
38822
|
-
|
|
39340
|
+
if (preflight === void 0)
|
|
39341
|
+
recordConstructorGroupDependency(valueId, destination, ctx);
|
|
39342
|
+
else preflight.dependencies.set(valueId, destination);
|
|
38823
39343
|
}
|
|
38824
39344
|
function assertInitializerPlacement(valueId, member, ctx) {
|
|
38825
39345
|
const replayRowId = ctx.__storedConstructionReplayRowId;
|
|
@@ -38840,7 +39360,25 @@ function directlyBoundMembersOf(valueId, ctx) {
|
|
|
38840
39360
|
return NO_BOUND_MEMBERS;
|
|
38841
39361
|
return ctx.vm.members.filter((member) => member.valueId === valueId);
|
|
38842
39362
|
}
|
|
38843
|
-
function
|
|
39363
|
+
function ownershipParentEntryKeys(value, valueId, cache) {
|
|
39364
|
+
if (cache === void 0) return void 0;
|
|
39365
|
+
let entries = cache.get(value);
|
|
39366
|
+
if (entries === void 0) {
|
|
39367
|
+
const indexed = /* @__PURE__ */ new Map();
|
|
39368
|
+
const add = (child, key) => {
|
|
39369
|
+
if (typeof child !== "string") return;
|
|
39370
|
+
const keys = indexed.get(child);
|
|
39371
|
+
if (keys === void 0) indexed.set(child, [key]);
|
|
39372
|
+
else keys.push(key);
|
|
39373
|
+
};
|
|
39374
|
+
if (Array.isArray(value)) value.forEach(add);
|
|
39375
|
+
else for (const [key, child] of Object.entries(value)) add(child, key);
|
|
39376
|
+
entries = indexed;
|
|
39377
|
+
cache.set(value, entries);
|
|
39378
|
+
}
|
|
39379
|
+
return entries.get(valueId) ?? [];
|
|
39380
|
+
}
|
|
39381
|
+
function currentOwnedValueAttachments(valueId, ctx, parentEntries, placingMembers) {
|
|
38844
39382
|
const indexes4 = evaluatorIndexes(ctx);
|
|
38845
39383
|
const cached = indexes4.ownedValueAttachmentsByValueId.get(valueId);
|
|
38846
39384
|
if (cached !== void 0) return [...cached];
|
|
@@ -38903,7 +39441,14 @@ function currentOwnedValueAttachments(valueId, ctx) {
|
|
|
38903
39441
|
let member = null;
|
|
38904
39442
|
let classId = parent.classId;
|
|
38905
39443
|
if (classId === void 0 || classId === null) {
|
|
38906
|
-
member = activeStaticBindingRoot(parent.id, ctx)?.member ?? memberForValueRow(parent, ctx)
|
|
39444
|
+
member = activeStaticBindingRoot(parent.id, ctx)?.member ?? (placingMembers === void 0 ? memberForValueRow(parent, ctx) : placingMember(
|
|
39445
|
+
parent,
|
|
39446
|
+
ctx,
|
|
39447
|
+
void 0,
|
|
39448
|
+
0,
|
|
39449
|
+
placingMembers,
|
|
39450
|
+
parentEntries
|
|
39451
|
+
));
|
|
38907
39452
|
if (member !== null) {
|
|
38908
39453
|
try {
|
|
38909
39454
|
member = resolveMember(member, ctx.vm.members);
|
|
@@ -38920,7 +39465,14 @@ function currentOwnedValueAttachments(valueId, ctx) {
|
|
|
38920
39465
|
classId = member !== null && isClassTypedMember(member) ? member.classId : void 0;
|
|
38921
39466
|
}
|
|
38922
39467
|
if (classId !== void 0 && typeof parent.value === "object" && parent.value !== null && !Array.isArray(parent.value)) {
|
|
38923
|
-
|
|
39468
|
+
const keys = ownershipParentEntryKeys(
|
|
39469
|
+
parent.value,
|
|
39470
|
+
valueId,
|
|
39471
|
+
parentEntries
|
|
39472
|
+
);
|
|
39473
|
+
for (const rawKey of keys ?? Object.keys(parent.value)) {
|
|
39474
|
+
const key = String(rawKey);
|
|
39475
|
+
const childId = Reflect.get(parent.value, key);
|
|
38924
39476
|
if (childId !== valueId) continue;
|
|
38925
39477
|
add({
|
|
38926
39478
|
identity: `value:${parent.id}:slot:${key}`,
|
|
@@ -38930,8 +39482,17 @@ function currentOwnedValueAttachments(valueId, ctx) {
|
|
|
38930
39482
|
continue;
|
|
38931
39483
|
}
|
|
38932
39484
|
if (member !== null && isMemberEntryCollectionBase(member) && Array.isArray(parent.value)) {
|
|
38933
|
-
|
|
38934
|
-
|
|
39485
|
+
const references = collectionReferences(parent.value, ctx);
|
|
39486
|
+
const keys = ownershipParentEntryKeys(
|
|
39487
|
+
parent.value,
|
|
39488
|
+
valueId,
|
|
39489
|
+
parentEntries
|
|
39490
|
+
);
|
|
39491
|
+
for (const rawKey of keys ?? parent.value.keys()) {
|
|
39492
|
+
const index = Number(rawKey);
|
|
39493
|
+
const childId = parent.value[index];
|
|
39494
|
+
if (childId !== valueId || !isReferenceEntry(references, index))
|
|
39495
|
+
continue;
|
|
38935
39496
|
add({
|
|
38936
39497
|
identity: `value:${parent.id}:index:${index}`,
|
|
38937
39498
|
label: parent.id
|
|
@@ -38940,8 +39501,16 @@ function currentOwnedValueAttachments(valueId, ctx) {
|
|
|
38940
39501
|
continue;
|
|
38941
39502
|
}
|
|
38942
39503
|
if (member !== null && isMemberDictionaryBase(member) && typeof parent.value === "object" && parent.value !== null && !Array.isArray(parent.value)) {
|
|
38943
|
-
|
|
38944
|
-
|
|
39504
|
+
const references = collectionReferences(parent.value, ctx);
|
|
39505
|
+
const keys = ownershipParentEntryKeys(
|
|
39506
|
+
parent.value,
|
|
39507
|
+
valueId,
|
|
39508
|
+
parentEntries
|
|
39509
|
+
);
|
|
39510
|
+
for (const rawKey of keys ?? Object.keys(parent.value)) {
|
|
39511
|
+
const key = String(rawKey);
|
|
39512
|
+
const childId = Reflect.get(parent.value, key);
|
|
39513
|
+
if (childId !== valueId || !isReferenceEntry(references, key)) continue;
|
|
38945
39514
|
add({
|
|
38946
39515
|
identity: `value:${parent.id}:slot:${key}`,
|
|
38947
39516
|
label: parent.id
|
|
@@ -39268,8 +39837,12 @@ function materializeConstructorArgumentValue(args) {
|
|
|
39268
39837
|
args.destinationName ?? args.member.name,
|
|
39269
39838
|
args.ctx
|
|
39270
39839
|
);
|
|
39840
|
+
const collectionAlias = args.value;
|
|
39271
39841
|
if (args.value instanceof RuntimeSet)
|
|
39272
|
-
args = {
|
|
39842
|
+
args = {
|
|
39843
|
+
...args,
|
|
39844
|
+
value: args.collectionAliases === void 0 ? args.value.toArray() : exportRuntimeSetValue(args.value, args.ctx)
|
|
39845
|
+
};
|
|
39273
39846
|
const trackedValueId = findKnownRowIdByValueReference(args.value, args.ctx);
|
|
39274
39847
|
if (args.value === null && !isRequiredMember(args.member) && isMemberWithEntries(args.member)) {
|
|
39275
39848
|
return registerConstructorArgumentRow(args, null);
|
|
@@ -39305,15 +39878,18 @@ function materializeConstructorArgumentValue(args) {
|
|
|
39305
39878
|
return row;
|
|
39306
39879
|
}
|
|
39307
39880
|
if (isMemberLookupBase(args.member)) {
|
|
39308
|
-
|
|
39881
|
+
const row = registerConstructorArgumentRow(
|
|
39309
39882
|
args,
|
|
39310
39883
|
encodeLookupInitializerSelection(
|
|
39311
39884
|
args.member,
|
|
39312
39885
|
args.value,
|
|
39313
|
-
args.
|
|
39886
|
+
args.createdById,
|
|
39314
39887
|
args.ctx
|
|
39315
39888
|
)
|
|
39316
39889
|
);
|
|
39890
|
+
if (collectionAlias instanceof RuntimeSet)
|
|
39891
|
+
args.collectionAliases?.set(row, collectionAlias);
|
|
39892
|
+
return row;
|
|
39317
39893
|
}
|
|
39318
39894
|
if (isClassSlotMember(args.member)) {
|
|
39319
39895
|
if (args.value === null || args.value === void 0) {
|
|
@@ -39356,6 +39932,14 @@ function materializeConstructorArgumentValue(args) {
|
|
|
39356
39932
|
`Constructor Class field '${args.member.name}' has no owned destination.`
|
|
39357
39933
|
);
|
|
39358
39934
|
}
|
|
39935
|
+
if (args.attachmentReservations !== void 0 && !args.attachmentReservations.has(trackedValueId)) {
|
|
39936
|
+
args.attachmentReservations.set(
|
|
39937
|
+
trackedValueId,
|
|
39938
|
+
args.ctx.__executionState?.ownedValueAttachments.get(
|
|
39939
|
+
trackedValueId
|
|
39940
|
+
)
|
|
39941
|
+
);
|
|
39942
|
+
}
|
|
39359
39943
|
assertOwnedValueAttachable(
|
|
39360
39944
|
trackedValueId,
|
|
39361
39945
|
args.owner,
|
|
@@ -39440,6 +40024,7 @@ function materializeConstructorArgumentValue(args) {
|
|
|
39440
40024
|
}
|
|
39441
40025
|
}
|
|
39442
40026
|
row.value = ids;
|
|
40027
|
+
args.collectionAliases?.set(row, collectionAlias);
|
|
39443
40028
|
return row;
|
|
39444
40029
|
}
|
|
39445
40030
|
if (isMemberDictionaryBase(args.member)) {
|
|
@@ -39494,6 +40079,7 @@ function materializeConstructorArgumentValue(args) {
|
|
|
39494
40079
|
}).id;
|
|
39495
40080
|
}
|
|
39496
40081
|
row.value = record4;
|
|
40082
|
+
args.collectionAliases?.set(row, collectionAlias);
|
|
39497
40083
|
return row;
|
|
39498
40084
|
}
|
|
39499
40085
|
return registerConstructorArgumentRow(args, args.value);
|
|
@@ -44096,7 +44682,11 @@ function materializeMemberDefaultValue(args) {
|
|
|
44096
44682
|
valueById: (id) => {
|
|
44097
44683
|
args.readTracking?.valueIds.add(id);
|
|
44098
44684
|
const database2 = evaluatorLookups();
|
|
44099
|
-
return database2.
|
|
44685
|
+
return database2.valueById(id);
|
|
44686
|
+
},
|
|
44687
|
+
defaultValueSource: (id, member) => {
|
|
44688
|
+
args.readTracking?.valueIds.add(id);
|
|
44689
|
+
return evaluatorLookups().defaultValueSource?.(id, member) ?? null;
|
|
44100
44690
|
},
|
|
44101
44691
|
unorderedListEntryIds: (containerId) => {
|
|
44102
44692
|
args.readTracking?.containerIds.add(containerId);
|
|
@@ -44178,9 +44768,14 @@ function materializeMemberDefaultValue(args) {
|
|
|
44178
44768
|
|
|
44179
44769
|
// ../packages/neoscript-runtime/src/declaration-default-source.ts
|
|
44180
44770
|
function declarationDefaultSource(id, stored, resolveGraph) {
|
|
44181
|
-
if (stored !== null && !isCollapseStampedInstanceRoot(stored))
|
|
44771
|
+
if (stored !== null && !isCollapseStampedInstanceRoot(stored))
|
|
44772
|
+
return { value: stored };
|
|
44182
44773
|
const graph = resolveGraph(id);
|
|
44183
|
-
|
|
44774
|
+
const value = defaultSourceWithListeners(
|
|
44775
|
+
graph?.rowsById.get(id) ?? stored,
|
|
44776
|
+
graph
|
|
44777
|
+
);
|
|
44778
|
+
return value === null ? null : { value, rowsById: graph?.rowsById };
|
|
44184
44779
|
}
|
|
44185
44780
|
|
|
44186
44781
|
// ../packages/models/src/members/stored-value-placement-index.ts
|
|
@@ -46592,6 +47187,9 @@ function prepareStoredClassValueResolution(args) {
|
|
|
46592
47187
|
readRecorder: args.readRecorder
|
|
46593
47188
|
};
|
|
46594
47189
|
}
|
|
47190
|
+
function resolveStoredClassValue(args) {
|
|
47191
|
+
return resolveVirtualInstanceGraph(prepareStoredClassValueResolution(args));
|
|
47192
|
+
}
|
|
46595
47193
|
function expandStoredClassValue(args) {
|
|
46596
47194
|
const placement = resolveMember(args.rootMember, args.document.members);
|
|
46597
47195
|
if (isClassSlotMember(placement) && placement.payload === 1 /* Partial */) {
|
|
@@ -49296,6 +49894,21 @@ function createHeadlessVirtualInstanceResolver(args) {
|
|
|
49296
49894
|
return inherited === void 0 ? authored : { ...inherited, ...authored };
|
|
49297
49895
|
};
|
|
49298
49896
|
return {
|
|
49897
|
+
declarationDefaultGraph: (rootId, member) => {
|
|
49898
|
+
recorder.recordValueRead(rootId);
|
|
49899
|
+
const root = rawById.get(rootId);
|
|
49900
|
+
if (root === void 0) return null;
|
|
49901
|
+
return resolveStoredClassValue({
|
|
49902
|
+
evaluateInitializer: args.evaluateInitializer,
|
|
49903
|
+
materializeInitializerValue: args.materializeInitializerValue,
|
|
49904
|
+
materializeMemberDefaultValue: args.materializeMemberDefaultValue,
|
|
49905
|
+
document: resolverDocumentOnce(),
|
|
49906
|
+
instanceRoot: root,
|
|
49907
|
+
rootMember: member,
|
|
49908
|
+
materializedIndex: materializedIndexOnce(),
|
|
49909
|
+
readRecorder: recorder
|
|
49910
|
+
});
|
|
49911
|
+
},
|
|
49299
49912
|
storedClassGraph: (rootId, member) => {
|
|
49300
49913
|
expandRoot(rootId, member);
|
|
49301
49914
|
const graph = graphByValueId.get(rootId);
|
|
@@ -49442,7 +50055,7 @@ function initializerEvaluatorLookups(document2, readTracking) {
|
|
|
49442
50055
|
},
|
|
49443
50056
|
memberById: (id) => databaseVM.memberById(id),
|
|
49444
50057
|
valueById: (id) => databaseVM.valueById(id),
|
|
49445
|
-
|
|
50058
|
+
defaultValueSource: databaseVM.defaultValueSource?.bind(databaseVM),
|
|
49446
50059
|
onInitializerRead: databaseVM.onInitializerRead,
|
|
49447
50060
|
localizedTextById: (id) => databaseVM.localizedTextById?.(id) ?? null,
|
|
49448
50061
|
...databaseVM.hasStoredValueId === void 0 ? {} : {
|
|
@@ -49513,10 +50126,10 @@ function initializerEvaluatorLookups(document2, readTracking) {
|
|
|
49513
50126
|
const lookups = {
|
|
49514
50127
|
...indexedLookups,
|
|
49515
50128
|
changeListenerDefaultsForOwner: headlessVirtualResolver.changeListenerDefaultsForOwner,
|
|
49516
|
-
|
|
50129
|
+
defaultValueSource: (id, member) => declarationDefaultSource(
|
|
49517
50130
|
id,
|
|
49518
50131
|
indexedLookups.valueById(id),
|
|
49519
|
-
headlessVirtualResolver.
|
|
50132
|
+
(id2) => headlessVirtualResolver.declarationDefaultGraph(id2, member)
|
|
49520
50133
|
),
|
|
49521
50134
|
valueById: (id) => indexedLookups.valueById(id) ?? headlessVirtualResolver.valueById(id),
|
|
49522
50135
|
rowForValueReference: (value) => indexedLookups.rowForValueReference?.(value) ?? headlessVirtualResolver.rowForValueReference(value),
|
|
@@ -49572,7 +50185,8 @@ function defaultValuePlans(document2) {
|
|
|
49572
50185
|
projectFiles: document2.projectFiles,
|
|
49573
50186
|
textureTemplates: document2.textureTemplates,
|
|
49574
50187
|
memberById: lookups.memberById,
|
|
49575
|
-
valueById: lookups.
|
|
50188
|
+
valueById: lookups.valueById,
|
|
50189
|
+
defaultValueSource: lookups.defaultValueSource,
|
|
49576
50190
|
// A host database without list membership falls back to `values`.
|
|
49577
50191
|
unorderedListEntryIds: document2.databaseVM?.unorderedListEntryIds === void 0 && document2.databaseVM !== void 0 ? void 0 : lookups.unorderedListEntryIds
|
|
49578
50192
|
});
|
|
@@ -49912,10 +50526,10 @@ function headlessVirtualInstanceLookups(document2, options = {}) {
|
|
|
49912
50526
|
const lookups = {
|
|
49913
50527
|
...indexed,
|
|
49914
50528
|
changeListenerDefaultsForOwner: virtual.changeListenerDefaultsForOwner,
|
|
49915
|
-
|
|
50529
|
+
defaultValueSource: (id, member) => declarationDefaultSource(
|
|
49916
50530
|
id,
|
|
49917
50531
|
indexed.valueById(id),
|
|
49918
|
-
virtual.
|
|
50532
|
+
(id2) => virtual.declarationDefaultGraph(id2, member)
|
|
49919
50533
|
),
|
|
49920
50534
|
// Raw first, then virtual: a materialized row always wins over the
|
|
49921
50535
|
// expansion that would otherwise answer for it.
|
|
@@ -52606,6 +53220,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
52606
53220
|
* compiling. Only one compile of each lambda argument reaches the program.
|
|
52607
53221
|
*/
|
|
52608
53222
|
lambdaFrame;
|
|
53223
|
+
/** The current call's inferred callbacks, including tuple elements. */
|
|
53224
|
+
argumentLambdas;
|
|
52609
53225
|
/** P118. Calls compiled in a lambda frame, with what their names bound to. */
|
|
52610
53226
|
frameCalls = /* @__PURE__ */ new Map();
|
|
52611
53227
|
frameCallsGroup;
|
|
@@ -54819,7 +55435,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
54819
55435
|
);
|
|
54820
55436
|
}
|
|
54821
55437
|
const bindings = [];
|
|
54822
|
-
const capturedTarget = statement.op !== "=" && (vectorTypeName(target.type) !== null || isBitwiseBinaryOperator(statement.op.slice(0, -1))) ? {
|
|
55438
|
+
const capturedTarget = statement.op !== "=" && (target.structuredLeafKind !== void 0 || vectorTypeName(target.type) !== null || isBitwiseBinaryOperator(statement.op.slice(0, -1))) ? {
|
|
54823
55439
|
...target,
|
|
54824
55440
|
pointer: this.captureAssignmentTarget(target.pointer, bindings)
|
|
54825
55441
|
} : target;
|
|
@@ -54901,6 +55517,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
54901
55517
|
...bindings.length > 0 ? { bindings } : {},
|
|
54902
55518
|
target: {
|
|
54903
55519
|
pointer: capturedTarget.pointer,
|
|
55520
|
+
...target.structuredLeafKind === void 0 ? {} : { structuredLeafKind: target.structuredLeafKind },
|
|
54904
55521
|
typeInfo: target.wireType ?? toWireType(target.type, this.project),
|
|
54905
55522
|
writability
|
|
54906
55523
|
},
|
|
@@ -55967,8 +56584,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
55967
56584
|
frameCallNames(expression, scope) {
|
|
55968
56585
|
if (this.lambdaFrame === void 0) return void 0;
|
|
55969
56586
|
if (expression.kind !== "call") return void 0;
|
|
55970
|
-
if (!expression.args.some(
|
|
55971
|
-
return void 0;
|
|
56587
|
+
if (!expression.args.some(hasTupleLambda)) return void 0;
|
|
55972
56588
|
if (this.overloadArgumentKind(expression, scope) !== "typed")
|
|
55973
56589
|
return void 0;
|
|
55974
56590
|
let names2 = this.callNames.get(expression);
|
|
@@ -56031,7 +56647,11 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
56031
56647
|
resolveExpressionCore(expression, scope, expected, convertSequence = true) {
|
|
56032
56648
|
if (expected?.kind === "delegate") {
|
|
56033
56649
|
if (expression.kind === "lambda") {
|
|
56034
|
-
|
|
56650
|
+
const lambdas = this.argumentLambdas;
|
|
56651
|
+
const cached = weighedLambda(lambdas?.get(expression), expected);
|
|
56652
|
+
if (cached !== void 0) return cached;
|
|
56653
|
+
const compile = () => this.resolveDelegateLambda(expression, expected, scope);
|
|
56654
|
+
return lambdas?.has(expression) ? this.inLambdaFrame(lambdas, expression, compile) : compile();
|
|
56035
56655
|
}
|
|
56036
56656
|
const methodGroup = this.resolveDelegateMethodGroup(
|
|
56037
56657
|
expression,
|
|
@@ -58800,6 +59420,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
58800
59420
|
}
|
|
58801
59421
|
const primitiveMember = resolvePrimitiveMember(receiver.type, name);
|
|
58802
59422
|
if (primitiveMember) {
|
|
59423
|
+
const structuredLeafKind = receiver.type.kind === "primitive" && isNeoScriptVectorKind(receiver.type.name) ? receiver.type.name : void 0;
|
|
58803
59424
|
if (isPrimitive(receiver.type, "NeoDialogueReference")) {
|
|
58804
59425
|
return {
|
|
58805
59426
|
pointer: {
|
|
@@ -58821,7 +59442,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
58821
59442
|
primitiveMember.type,
|
|
58822
59443
|
nullPropagating
|
|
58823
59444
|
);
|
|
58824
|
-
if (!primitiveMember.derived)
|
|
59445
|
+
if (!primitiveMember.derived)
|
|
59446
|
+
return structuredLeafKind === void 0 ? resolved : { ...resolved, structuredLeafKind };
|
|
58825
59447
|
return {
|
|
58826
59448
|
...resolved,
|
|
58827
59449
|
derivedMember: { owner: this.describe(receiver.type), name }
|
|
@@ -61934,10 +62556,13 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
61934
62556
|
else if (cached && (sameCompilationType(cached.type, expected) || cached.pointer.type === "callFunction" /* CallFunction */)) {
|
|
61935
62557
|
resolved = cached;
|
|
61936
62558
|
} else {
|
|
61937
|
-
const
|
|
61938
|
-
|
|
61939
|
-
|
|
61940
|
-
|
|
62559
|
+
const previous = this.argumentLambdas;
|
|
62560
|
+
this.argumentLambdas = choice?.lambdas ?? inferred?.lambdas;
|
|
62561
|
+
try {
|
|
62562
|
+
resolved = this.resolveExpression(argument2, scope, target);
|
|
62563
|
+
} finally {
|
|
62564
|
+
this.argumentLambdas = previous;
|
|
62565
|
+
}
|
|
61941
62566
|
}
|
|
61942
62567
|
resolved = this.contextualReference(argument2, resolved, scope, target);
|
|
61943
62568
|
resolved = this.convertSequence(resolved, target);
|
|
@@ -61998,9 +62623,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
61998
62623
|
const callbacks = [];
|
|
61999
62624
|
const probe = new Scope(scope);
|
|
62000
62625
|
const resolvedArguments = /* @__PURE__ */ new Map();
|
|
62001
|
-
|
|
62002
|
-
const pattern = parameters[index];
|
|
62003
|
-
if (pattern === void 0) return;
|
|
62626
|
+
const inferArgument = (argument2, pattern, prior) => {
|
|
62004
62627
|
if (inference.unresolved(pattern).size === 0) return;
|
|
62005
62628
|
if (argument2.kind === "lambda" && pattern.kind === "delegate") {
|
|
62006
62629
|
argument2.params.forEach((parameter3, parameterIndex) => {
|
|
@@ -62011,8 +62634,14 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
62011
62634
|
callbacks.push({ ast: argument2, type: pattern });
|
|
62012
62635
|
return;
|
|
62013
62636
|
}
|
|
62637
|
+
if (argument2.kind === "tuple" && pattern.kind === "tuple") {
|
|
62638
|
+
if (argument2.elements.length !== pattern.elements.length) return;
|
|
62639
|
+
argument2.elements.forEach((element, index) => {
|
|
62640
|
+
inferArgument(element.value, pattern.elements[index].type);
|
|
62641
|
+
});
|
|
62642
|
+
return;
|
|
62643
|
+
}
|
|
62014
62644
|
if (!hasIndependentTypeEvidence(argument2)) return;
|
|
62015
|
-
const prior = weighed?.typed[index];
|
|
62016
62645
|
if (prior !== void 0) {
|
|
62017
62646
|
inference.add(
|
|
62018
62647
|
this.referenceInferenceType(argument2, prior, pattern),
|
|
@@ -62036,9 +62665,17 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
62036
62665
|
pattern
|
|
62037
62666
|
);
|
|
62038
62667
|
}
|
|
62668
|
+
};
|
|
62669
|
+
argumentsList2.forEach((argument2, index) => {
|
|
62670
|
+
const pattern = parameters[index];
|
|
62671
|
+
if (pattern === void 0) return;
|
|
62672
|
+
if (weighed === void 0 && argument2.kind === "tuple" && pattern.kind === "tuple")
|
|
62673
|
+
this.typeOverloadEntries(argument2, probe);
|
|
62674
|
+
inferArgument(argument2, pattern, weighed?.typed[index]);
|
|
62039
62675
|
});
|
|
62676
|
+
const lambdas = weighed?.lambdas ?? /* @__PURE__ */ new Map();
|
|
62040
62677
|
const error = inference.solve(callbacks, (callback, inputs) => {
|
|
62041
|
-
const probes =
|
|
62678
|
+
const probes = lambdas.get(callback.ast) ?? [];
|
|
62042
62679
|
let resolved = probes.find(
|
|
62043
62680
|
(candidate) => sameInputs(candidate.type, inputs)
|
|
62044
62681
|
);
|
|
@@ -62053,8 +62690,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
62053
62690
|
probe,
|
|
62054
62691
|
true
|
|
62055
62692
|
);
|
|
62056
|
-
resolved =
|
|
62057
|
-
|
|
62693
|
+
resolved = this.inLambdaFrame(lambdas, callback.ast, compile);
|
|
62694
|
+
lambdas.set(callback.ast, [...probes, resolved]);
|
|
62058
62695
|
}
|
|
62059
62696
|
if (!resolved.needsReturnContext)
|
|
62060
62697
|
resolvedArguments.set(callback.ast, resolved);
|
|
@@ -62072,7 +62709,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
62072
62709
|
}
|
|
62073
62710
|
return {
|
|
62074
62711
|
typeArguments: inference.arguments(),
|
|
62075
|
-
resolved: resolvedArguments
|
|
62712
|
+
resolved: resolvedArguments,
|
|
62713
|
+
lambdas
|
|
62076
62714
|
};
|
|
62077
62715
|
}
|
|
62078
62716
|
callableSignatureForReceiver(symbol, receiver, typeArguments, pos, inferred) {
|
|
@@ -65592,7 +66230,7 @@ function variable(id, type2, pointer, project) {
|
|
|
65592
66230
|
};
|
|
65593
66231
|
}
|
|
65594
66232
|
function isGeneratedPositionalCall(target, expression) {
|
|
65595
|
-
return
|
|
66233
|
+
return (target.declaredConstructors?.length ?? 0) === 0 && target.constructorSignature !== void 0 && expression.argumentNames === void 0 && callHasPositionalArguments(expression);
|
|
65596
66234
|
}
|
|
65597
66235
|
function closedConstructorParameters(parameters, targetType, schemaClass2, project) {
|
|
65598
66236
|
return parameters.map((parameter3) => {
|
|
@@ -65636,7 +66274,7 @@ function bindConstructorArgumentNames(className, declared, argumentNames, pos) {
|
|
|
65636
66274
|
if (positionalIndex < 0) {
|
|
65637
66275
|
return argumentNames.filter((name) => name !== null);
|
|
65638
66276
|
}
|
|
65639
|
-
const sole = declared.
|
|
66277
|
+
const sole = declared.length === 1 ? declared[0] : void 0;
|
|
65640
66278
|
if (sole === void 0) {
|
|
65641
66279
|
throw new CompileError(
|
|
65642
66280
|
`Class '${className}' declares constructors, so argument ${positionalIndex + 1} must be passed by name \u2014 candidates: ${describeNeoScriptDeclaredConstructors(className, declared)}.`,
|
|
@@ -67204,7 +67842,7 @@ function switchValueKey(value) {
|
|
|
67204
67842
|
const enumId = value.typeInfo.type === 8 /* Enum */ ? value.typeInfo.enumId : null;
|
|
67205
67843
|
return JSON.stringify([value.typeInfo.type, enumId, value.value]);
|
|
67206
67844
|
}
|
|
67207
|
-
function resolveNeoScriptType(type2, context, project) {
|
|
67845
|
+
function resolveNeoScriptType(type2, context, project, referenceMode = "read") {
|
|
67208
67846
|
let resolved;
|
|
67209
67847
|
switch (type2.kind) {
|
|
67210
67848
|
case "primitive":
|
|
@@ -67257,7 +67895,7 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67257
67895
|
);
|
|
67258
67896
|
const ineligible = neoScriptReferenceTargetError(targetType, project);
|
|
67259
67897
|
if (ineligible !== null) throw new CompileError(ineligible, type2.pos);
|
|
67260
|
-
resolved = neoScriptReferenceType(
|
|
67898
|
+
resolved = referenceMode === "stored" ? { kind: "reference", target: targetType } : neoScriptReferenceType(
|
|
67261
67899
|
targetType,
|
|
67262
67900
|
false,
|
|
67263
67901
|
(named2) => isNeoScriptValueNamedType(named2, project)
|
|
@@ -67297,7 +67935,7 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67297
67935
|
typeId: named.id,
|
|
67298
67936
|
...type2.typeArguments ? {
|
|
67299
67937
|
typeArguments: type2.typeArguments.map(
|
|
67300
|
-
(argument2) => resolveNeoScriptType(argument2, context, project)
|
|
67938
|
+
(argument2) => resolveNeoScriptType(argument2, context, project, "stored")
|
|
67301
67939
|
)
|
|
67302
67940
|
} : {}
|
|
67303
67941
|
};
|
|
@@ -67309,7 +67947,12 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67309
67947
|
kind: "tuple",
|
|
67310
67948
|
nullable: !type2.required,
|
|
67311
67949
|
elements: type2.elements.map((element) => ({
|
|
67312
|
-
type: resolveNeoScriptType(
|
|
67950
|
+
type: resolveNeoScriptType(
|
|
67951
|
+
element.type,
|
|
67952
|
+
context,
|
|
67953
|
+
project,
|
|
67954
|
+
referenceMode
|
|
67955
|
+
),
|
|
67313
67956
|
...element.name ? { name: element.name } : {},
|
|
67314
67957
|
...element.nameRange && context.sourceUri ? {
|
|
67315
67958
|
labelLocation: {
|
|
@@ -67322,11 +67965,21 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67322
67965
|
case "list":
|
|
67323
67966
|
resolved = {
|
|
67324
67967
|
kind: "list",
|
|
67325
|
-
elementType: resolveNeoScriptType(
|
|
67968
|
+
elementType: resolveNeoScriptType(
|
|
67969
|
+
type2.element,
|
|
67970
|
+
context,
|
|
67971
|
+
project,
|
|
67972
|
+
referenceMode
|
|
67973
|
+
)
|
|
67326
67974
|
};
|
|
67327
67975
|
break;
|
|
67328
67976
|
case "set": {
|
|
67329
|
-
const element = resolveNeoScriptType(
|
|
67977
|
+
const element = resolveNeoScriptType(
|
|
67978
|
+
type2.element,
|
|
67979
|
+
context,
|
|
67980
|
+
project,
|
|
67981
|
+
referenceMode
|
|
67982
|
+
);
|
|
67330
67983
|
resolved = {
|
|
67331
67984
|
kind: "set",
|
|
67332
67985
|
// P105 §2.2. Multiselect dialogue elements are bare dialogue ids.
|
|
@@ -67345,7 +67998,12 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67345
67998
|
resolved = {
|
|
67346
67999
|
kind: "dictionary",
|
|
67347
68000
|
keyType: key,
|
|
67348
|
-
valueType: resolveNeoScriptType(
|
|
68001
|
+
valueType: resolveNeoScriptType(
|
|
68002
|
+
type2.value,
|
|
68003
|
+
context,
|
|
68004
|
+
project,
|
|
68005
|
+
referenceMode
|
|
68006
|
+
)
|
|
67349
68007
|
};
|
|
67350
68008
|
break;
|
|
67351
68009
|
}
|
|
@@ -67353,12 +68011,7 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67353
68011
|
return { ...resolved, nullable: !type2.required };
|
|
67354
68012
|
}
|
|
67355
68013
|
function resolveStoredReferenceTarget(type2, context, project) {
|
|
67356
|
-
|
|
67357
|
-
if (inner === void 0) return resolveNeoScriptType(type2, context, project);
|
|
67358
|
-
const target = resolveStoredReferenceTarget(inner, context, project);
|
|
67359
|
-
const ineligible = neoScriptReferenceTargetError(target, project);
|
|
67360
|
-
if (ineligible !== null) throw new CompileError(ineligible, type2.pos);
|
|
67361
|
-
return { kind: "reference", target, nullable: !type2.required };
|
|
68014
|
+
return resolveNeoScriptType(type2, context, project, "stored");
|
|
67362
68015
|
}
|
|
67363
68016
|
function resultKind(kinds) {
|
|
67364
68017
|
if (kinds.includes("targetTyped")) return "targetTyped";
|
|
@@ -67373,6 +68026,9 @@ function compilesAlike(kind, target) {
|
|
|
67373
68026
|
);
|
|
67374
68027
|
return !isPrimitive(target, "decimal");
|
|
67375
68028
|
}
|
|
68029
|
+
function hasTupleLambda(expression) {
|
|
68030
|
+
return expression.kind === "lambda" || expression.kind === "tuple" && expression.elements.some((element) => hasTupleLambda(element.value));
|
|
68031
|
+
}
|
|
67376
68032
|
function sameInputs(type2, inputs) {
|
|
67377
68033
|
return type2.kind === "delegate" && type2.parameterTypes.length === inputs.length && type2.parameterTypes.every(
|
|
67378
68034
|
(input, index) => sameCompilationType(input, inputs[index])
|
|
@@ -76894,6 +77550,15 @@ function isCallableMemberForCodegen(value) {
|
|
|
76894
77550
|
var DEFAULT_NAMESPACE = "Assets.Scripts.Neo";
|
|
76895
77551
|
function createGenerationContext(exportData, diagnostics, docs = EMPTY_UNITY_CODEGEN_DOCS) {
|
|
76896
77552
|
const classes = Object.values(exportData.classes);
|
|
77553
|
+
const genericDeclarations = /* @__PURE__ */ new Map();
|
|
77554
|
+
for (const schemaClass2 of classes) {
|
|
77555
|
+
for (const param of schemaClass2.genericParams ?? []) {
|
|
77556
|
+
genericDeclarations.set(param.id, {
|
|
77557
|
+
param,
|
|
77558
|
+
declaringClassId: schemaClass2.id
|
|
77559
|
+
});
|
|
77560
|
+
}
|
|
77561
|
+
}
|
|
76897
77562
|
const members2 = Object.values(exportData.members);
|
|
76898
77563
|
const dialogueGroups = Object.values(exportData.dialogueGroups ?? {});
|
|
76899
77564
|
const dialogueGroupsByParent = /* @__PURE__ */ new Map();
|
|
@@ -76987,6 +77652,7 @@ function createGenerationContext(exportData, diagnostics, docs = EMPTY_UNITY_COD
|
|
|
76987
77652
|
declarationSignatures: /* @__PURE__ */ new Map(),
|
|
76988
77653
|
worldKinds: indexWorldSystemClassKinds(classes),
|
|
76989
77654
|
resolvedMembers: /* @__PURE__ */ new Map(),
|
|
77655
|
+
genericDeclarations,
|
|
76990
77656
|
genericScopes: /* @__PURE__ */ new Map(),
|
|
76991
77657
|
genericEnvironments: /* @__PURE__ */ new Map(),
|
|
76992
77658
|
functionGenericParams: indexFunctionGenericParams(
|
|
@@ -77205,12 +77871,25 @@ function inheritedGeneratedMemberContract(ctx, ownerClassId, schemaKey, memberId
|
|
|
77205
77871
|
}
|
|
77206
77872
|
return null;
|
|
77207
77873
|
}
|
|
77874
|
+
function declaredGeneratedPropertyValueType(ctx, member, memberSaved, saved, genericEnv) {
|
|
77875
|
+
const declared = lookupDeclaredTypeInfo2(member);
|
|
77876
|
+
if (declared?.type !== 21 /* Generic */ || isMultiSelectionMember(member))
|
|
77877
|
+
return csharpPropertyValueType(ctx, member, memberSaved, genericEnv, saved);
|
|
77878
|
+
const target = csharpTypeInfoValueType(ctx, declared, saved, genericEnv);
|
|
77879
|
+
if (target === null) return null;
|
|
77880
|
+
return lookupProjection(ctx, member) === "slot" /* Slot */ ? `NeoReference<${target}>${isRequiredMember(member) ? "" : "?"}` : target;
|
|
77881
|
+
}
|
|
77208
77882
|
function emittedGeneratedMemberContract(ctx, ownerClassId, schemaKey, memberId, saved, genericEnv) {
|
|
77209
|
-
const member = ctx
|
|
77210
|
-
if (member ===
|
|
77883
|
+
const member = resolveMemberById(ctx, memberId, `members.${memberId}`);
|
|
77884
|
+
if (member === null) return null;
|
|
77211
77885
|
const memberSaved = memberSavedForStorage(ctx, memberId, saved, ownerClassId);
|
|
77212
|
-
const
|
|
77213
|
-
|
|
77886
|
+
const valueType = declaredGeneratedPropertyValueType(
|
|
77887
|
+
ctx,
|
|
77888
|
+
member,
|
|
77889
|
+
memberSaved,
|
|
77890
|
+
saved,
|
|
77891
|
+
genericEnv
|
|
77892
|
+
);
|
|
77214
77893
|
if (valueType === null) return null;
|
|
77215
77894
|
const inherited = inheritedGeneratedMemberContract(
|
|
77216
77895
|
ctx,
|
|
@@ -77221,11 +77900,38 @@ function emittedGeneratedMemberContract(ctx, ownerClassId, schemaKey, memberId,
|
|
|
77221
77900
|
genericEnv
|
|
77222
77901
|
);
|
|
77223
77902
|
const hasSetter = emitsGeneratedSetter(member, memberSaved) && !suppressesInheritedSetter(inherited);
|
|
77903
|
+
const declaredValueTypeInfo = generatedValueTypeInfo(ctx, member);
|
|
77904
|
+
const readsReferenceValue = referenceImplementsValueContract(
|
|
77905
|
+
ctx,
|
|
77906
|
+
member,
|
|
77907
|
+
valueType,
|
|
77908
|
+
inherited
|
|
77909
|
+
);
|
|
77910
|
+
let valueTypeInfo = declaredValueTypeInfo;
|
|
77911
|
+
if (readsReferenceValue && inherited !== null) {
|
|
77912
|
+
valueTypeInfo = inherited.valueTypeInfo;
|
|
77913
|
+
} else if (isMemberLookupBase(member) && !isMultiSelectionMember(member) && lookupProjection(ctx, member) === "slot" /* Slot */ && declaredValueTypeInfo !== null) {
|
|
77914
|
+
valueTypeInfo = {
|
|
77915
|
+
type: 29 /* Reference */,
|
|
77916
|
+
required: isRequiredMember(member),
|
|
77917
|
+
targetTypeInfo: declaredValueTypeInfo
|
|
77918
|
+
};
|
|
77919
|
+
}
|
|
77920
|
+
const emittedValueType = narrowedMemberValueType(
|
|
77921
|
+
ctx,
|
|
77922
|
+
member,
|
|
77923
|
+
valueType,
|
|
77924
|
+
inherited
|
|
77925
|
+
);
|
|
77926
|
+
if (inherited?.valueTypeInfo?.type === 29 /* Reference */ && emittedValueType === inherited.valueType) {
|
|
77927
|
+
valueTypeInfo = inherited.valueTypeInfo;
|
|
77928
|
+
}
|
|
77224
77929
|
return {
|
|
77225
|
-
valueType:
|
|
77930
|
+
valueType: emittedValueType,
|
|
77226
77931
|
hasSetter,
|
|
77227
77932
|
getOnlyContract: (inherited?.getOnlyContract ?? false) || isAbstractMember(member) === true && !hasSetter,
|
|
77228
|
-
valueTypeInfo
|
|
77933
|
+
valueTypeInfo,
|
|
77934
|
+
genericEnv,
|
|
77229
77935
|
closesGenericType: (inherited?.closesGenericType ?? false) || lookupNarrowsThroughGenericParam(member) || isMemberGenericBase(member)
|
|
77230
77936
|
};
|
|
77231
77937
|
}
|
|
@@ -77234,7 +77940,8 @@ function suppressesInheritedSetter(contract) {
|
|
|
77234
77940
|
}
|
|
77235
77941
|
function generatedValueTypeInfo(ctx, member) {
|
|
77236
77942
|
const required = isRequiredMember(member);
|
|
77237
|
-
if (isMemberTupleBase(member)
|
|
77943
|
+
if (isMemberTupleBase(member) || isMemberVariantBase(member))
|
|
77944
|
+
return memberTypeInfoForCodegen(ctx, member);
|
|
77238
77945
|
const slotType = classSlotTypeInfo(ctx, member, required);
|
|
77239
77946
|
if (slotType !== null) return slotType;
|
|
77240
77947
|
const returnType = nsPropertyReturnTypeInfo(member);
|
|
@@ -77249,8 +77956,8 @@ function generatedValueTypeInfo(ctx, member) {
|
|
|
77249
77956
|
return null;
|
|
77250
77957
|
}
|
|
77251
77958
|
function genericParamTypeInfo2(ctx, genericParamId, required) {
|
|
77252
|
-
const declaration =
|
|
77253
|
-
if (declaration ===
|
|
77959
|
+
const declaration = ctx.genericDeclarations.get(genericParamId);
|
|
77960
|
+
if (declaration === void 0) {
|
|
77254
77961
|
ctx.diagnostics.push({
|
|
77255
77962
|
severity: "error",
|
|
77256
77963
|
message: `Generic param "${genericParamId}" is not declared by any type in the export.`,
|
|
@@ -77261,7 +77968,7 @@ function genericParamTypeInfo2(ctx, genericParamId, required) {
|
|
|
77261
77968
|
return {
|
|
77262
77969
|
type: 21 /* Generic */,
|
|
77263
77970
|
required,
|
|
77264
|
-
ownerClassId: declaration.
|
|
77971
|
+
ownerClassId: declaration.declaringClassId,
|
|
77265
77972
|
genericParamId
|
|
77266
77973
|
};
|
|
77267
77974
|
}
|
|
@@ -77282,7 +77989,7 @@ function classSlotTypeInfo(ctx, member, required) {
|
|
|
77282
77989
|
"classArguments"
|
|
77283
77990
|
);
|
|
77284
77991
|
if (argument2 === null) return null;
|
|
77285
|
-
const typeInfo =
|
|
77992
|
+
const typeInfo = storedMemberTypeInfoForCodegen(ctx, argument2);
|
|
77286
77993
|
if (typeInfo === null) return null;
|
|
77287
77994
|
typeArguments[parameterId] = typeInfo;
|
|
77288
77995
|
}
|
|
@@ -77310,9 +78017,63 @@ function generatedValueClassId(ctx, member) {
|
|
|
77310
78017
|
const typeInfo = generatedValueTypeInfo(ctx, member);
|
|
77311
78018
|
return typeInfo?.type === 7 /* Class */ ? typeInfo.classId : null;
|
|
77312
78019
|
}
|
|
78020
|
+
function referenceDepth(ctx, type2, env) {
|
|
78021
|
+
let depth = 0;
|
|
78022
|
+
let current = type2;
|
|
78023
|
+
let seen;
|
|
78024
|
+
while (current !== null) {
|
|
78025
|
+
if (current.type === 29 /* Reference */) {
|
|
78026
|
+
depth++;
|
|
78027
|
+
current = current.targetTypeInfo;
|
|
78028
|
+
continue;
|
|
78029
|
+
}
|
|
78030
|
+
if (current.type !== 21 /* Generic */) return depth;
|
|
78031
|
+
if (!isClassGenericParamTypeInfo(current)) return depth;
|
|
78032
|
+
const entry = env?.get(current.genericParamId);
|
|
78033
|
+
if (entry === void 0 || entry.kind === "unbound") return depth;
|
|
78034
|
+
seen ??= /* @__PURE__ */ new Set();
|
|
78035
|
+
if (seen.has(entry.memberId)) return null;
|
|
78036
|
+
seen.add(entry.memberId);
|
|
78037
|
+
const binding = resolveMemberById(ctx, entry.memberId, "genericBinding");
|
|
78038
|
+
if (binding === null) return null;
|
|
78039
|
+
if (isMemberGenericBase(binding)) {
|
|
78040
|
+
current = genericParamTypeInfo2(ctx, binding.genericParamId, true);
|
|
78041
|
+
} else if (isMemberLookupBase(binding) && !isMultiSelectionMember(binding)) {
|
|
78042
|
+
current = slotTypeInfo(binding, ctx);
|
|
78043
|
+
} else {
|
|
78044
|
+
return depth;
|
|
78045
|
+
}
|
|
78046
|
+
}
|
|
78047
|
+
return null;
|
|
78048
|
+
}
|
|
78049
|
+
function referenceImplementsValueContract(ctx, member, rawValueType, contract) {
|
|
78050
|
+
if (contract?.getOnlyContract !== true || !isMemberLookupBase(member) || isMultiSelectionMember(member))
|
|
78051
|
+
return false;
|
|
78052
|
+
const projection = lookupProjection(ctx, member);
|
|
78053
|
+
if (contract.valueTypeInfo?.type === 21 /* Generic */ && (lookupDeclaredTypeInfo2(member)?.type === 21 /* Generic */ || projection === "collection" /* Collection */))
|
|
78054
|
+
return true;
|
|
78055
|
+
if (projection !== "slot" /* Slot */) return false;
|
|
78056
|
+
const target = lookupDeclaredTypeInfo2(member);
|
|
78057
|
+
const inherited = contract.valueTypeInfo;
|
|
78058
|
+
if (target?.type === 29 /* Reference */ && inherited?.type === 29 /* Reference */) {
|
|
78059
|
+
const targetDepth = referenceDepth(ctx, target, contract.genericEnv);
|
|
78060
|
+
return targetDepth !== null && targetDepth === referenceDepth(ctx, inherited, contract.genericEnv);
|
|
78061
|
+
}
|
|
78062
|
+
const wrapper = `NeoReference<${contract.valueType}>`;
|
|
78063
|
+
if (rawValueType === wrapper || rawValueType === `${wrapper}?`) return true;
|
|
78064
|
+
if (contract.valueType.endsWith("?")) {
|
|
78065
|
+
const requiredTarget = `NeoReference<${contract.valueType.slice(0, -1)}>`;
|
|
78066
|
+
return rawValueType === requiredTarget || rawValueType === `${requiredTarget}?`;
|
|
78067
|
+
}
|
|
78068
|
+
return false;
|
|
78069
|
+
}
|
|
77313
78070
|
function narrowedMemberValueType(ctx, member, rawValueType, contract) {
|
|
77314
78071
|
if (contract === null) return rawValueType;
|
|
77315
78072
|
if (contract.valueType === rawValueType) return rawValueType;
|
|
78073
|
+
if (referenceImplementsValueContract(ctx, member, rawValueType, contract))
|
|
78074
|
+
return contract.valueType;
|
|
78075
|
+
if (contract.valueTypeInfo?.type === 29 /* Reference */ && isMemberLookupBase(member) && !isMultiSelectionMember(member))
|
|
78076
|
+
return contract.valueType;
|
|
77316
78077
|
if (contract.closesGenericType && !isMemberGenericBase(member) && !lookupNarrowsThroughGenericParam(member)) {
|
|
77317
78078
|
return contract.valueType;
|
|
77318
78079
|
}
|
|
@@ -77331,6 +78092,13 @@ function narrowedMemberValueType(ctx, member, rawValueType, contract) {
|
|
|
77331
78092
|
return rawValueType;
|
|
77332
78093
|
const valueType = generatedValueTypeInfo(ctx, member);
|
|
77333
78094
|
if (valueType === null) return rawValueType;
|
|
78095
|
+
if (isMemberVariantBase(member) && member.valueTypeInfo == null && inheritedType.type === 7 /* Class */ && valueType.type === 7 /* Class */ && inheritedType.classId === valueType.classId) {
|
|
78096
|
+
const declaration = ctx.exportData.classes[inheritedType.classId];
|
|
78097
|
+
const targetParamId = declaration?.genericParams?.[0]?.id;
|
|
78098
|
+
const target = targetParamId === void 0 ? void 0 : inheritedType.typeArguments?.[targetParamId];
|
|
78099
|
+
if (declaration?.system?.worldKind === NeoWorldSystemClassKind.Variant && target !== void 0 && isTypeInfoAssignable(member.targetTypeInfo, target, ctx))
|
|
78100
|
+
return contract.valueType;
|
|
78101
|
+
}
|
|
77334
78102
|
const sourceType = valueType.type === 7 /* Class */ && inheritedType.type === 7 /* Class */ && valueType.required === false && inheritedType.required === true ? { ...valueType, required: true } : valueType;
|
|
77335
78103
|
try {
|
|
77336
78104
|
return isTypeInfoAssignable(sourceType, inheritedType, ctx) ? contract.valueType : rawValueType;
|
|
@@ -77433,8 +78201,13 @@ function calculateDeclarationSignature(ctx, projectionClassId, schemaKey, declar
|
|
|
77433
78201
|
true,
|
|
77434
78202
|
declaration.classDef.id
|
|
77435
78203
|
);
|
|
77436
|
-
const
|
|
77437
|
-
|
|
78204
|
+
const valueType = declaredGeneratedPropertyValueType(
|
|
78205
|
+
ctx,
|
|
78206
|
+
member,
|
|
78207
|
+
memberSaved,
|
|
78208
|
+
true,
|
|
78209
|
+
genericEnv
|
|
78210
|
+
);
|
|
77438
78211
|
if (valueType === null) return null;
|
|
77439
78212
|
const contract = inheritedGeneratedMemberContract(
|
|
77440
78213
|
ctx,
|
|
@@ -77791,11 +78564,11 @@ function csharpGenericParamType(ctx, genericParamId, saved, env, path) {
|
|
|
77791
78564
|
if (entry !== void 0 && entry.kind === "member") {
|
|
77792
78565
|
const bindingMember = resolveMemberById(ctx, entry.memberId, path);
|
|
77793
78566
|
if (bindingMember === null) return null;
|
|
77794
|
-
return
|
|
78567
|
+
return csharpGenericArgumentMemberType(ctx, bindingMember, env, saved);
|
|
77795
78568
|
}
|
|
77796
78569
|
const terminalParamId = entry !== void 0 && entry.kind === "unbound" ? entry.paramId : genericParamId;
|
|
77797
|
-
const declaration =
|
|
77798
|
-
if (declaration ===
|
|
78570
|
+
const declaration = ctx.genericDeclarations.get(terminalParamId);
|
|
78571
|
+
if (declaration === void 0) {
|
|
77799
78572
|
ctx.diagnostics.push({
|
|
77800
78573
|
severity: "error",
|
|
77801
78574
|
message: `Generic param "${terminalParamId}" is not declared by any type in the export.`,
|
|
@@ -77843,7 +78616,7 @@ function constructedTypeArgumentsSuffix(ctx, member, saved, env, genericBindingS
|
|
|
77843
78616
|
}
|
|
77844
78617
|
const bindingMember = resolveMemberById(ctx, arg.memberId, path);
|
|
77845
78618
|
if (bindingMember === null) return null;
|
|
77846
|
-
const argType =
|
|
78619
|
+
const argType = csharpGenericArgumentMemberType(ctx, bindingMember, env);
|
|
77847
78620
|
if (argType === null) {
|
|
77848
78621
|
ctx.diagnostics.push({
|
|
77849
78622
|
severity: "error",
|
|
@@ -77983,7 +78756,7 @@ var InterfaceConstructionEnv = class extends Map {
|
|
|
77983
78756
|
function bindingMemberValueType(ctx, memberId, env, path) {
|
|
77984
78757
|
const bindingMember = resolveMemberById(ctx, memberId, path);
|
|
77985
78758
|
if (bindingMember === null) return null;
|
|
77986
|
-
return
|
|
78759
|
+
return csharpGenericArgumentMemberType(ctx, bindingMember, env);
|
|
77987
78760
|
}
|
|
77988
78761
|
function typeInfoInterfaceArgumentsSuffix(ctx, typeInfo, genericEnv, genericBindingSaved) {
|
|
77989
78762
|
const params = ctx.exportData.interfaces[typeInfo.interfaceId]?.genericParams;
|
|
@@ -78003,10 +78776,16 @@ function typeInfoInterfaceArgumentsSuffix(ctx, typeInfo, genericEnv, genericBind
|
|
|
78003
78776
|
});
|
|
78004
78777
|
return null;
|
|
78005
78778
|
}
|
|
78006
|
-
const argType = csharpTypeInfoValueType(
|
|
78779
|
+
const argType = sequenceParameters.has(param.id) ? csharpTypeInfoValueType(
|
|
78007
78780
|
ctx,
|
|
78008
78781
|
argInfo,
|
|
78009
|
-
|
|
78782
|
+
false,
|
|
78783
|
+
genericEnv,
|
|
78784
|
+
genericBindingSaved
|
|
78785
|
+
) : csharpGenericArgumentType(
|
|
78786
|
+
ctx,
|
|
78787
|
+
argInfo,
|
|
78788
|
+
true,
|
|
78010
78789
|
genericEnv,
|
|
78011
78790
|
genericBindingSaved
|
|
78012
78791
|
);
|
|
@@ -78508,6 +79287,120 @@ function animationClipTargetType(ctx, member, env, ownerClassId) {
|
|
|
78508
79287
|
}
|
|
78509
79288
|
return constructedTarget;
|
|
78510
79289
|
}
|
|
79290
|
+
function storedMemberTypeInfoForCodegen(ctx, member) {
|
|
79291
|
+
if (isMemberTupleBase(member)) return tupleMemberTypeInfo(ctx, member);
|
|
79292
|
+
if (isMemberLookupBase(member) || isMemberEnumBase(member))
|
|
79293
|
+
return slotTypeInfo(member, ctx);
|
|
79294
|
+
if (isMemberWithEntries(member)) {
|
|
79295
|
+
const entry = resolveMemberById(ctx, member.entryMemberId, "entryMemberId");
|
|
79296
|
+
if (entry === null) return null;
|
|
79297
|
+
const entryTypeInfo = storedMemberTypeInfoForCodegen(ctx, entry);
|
|
79298
|
+
if (entryTypeInfo === null) return null;
|
|
79299
|
+
return {
|
|
79300
|
+
type: member.kind,
|
|
79301
|
+
required: isRequiredMember(member),
|
|
79302
|
+
entryTypeInfo,
|
|
79303
|
+
...isMemberDictionaryBase(member) && member.keyEnumId ? { keyEnumId: member.keyEnumId } : {}
|
|
79304
|
+
};
|
|
79305
|
+
}
|
|
79306
|
+
return memberTypeInfoForCodegen(ctx, member);
|
|
79307
|
+
}
|
|
79308
|
+
function csharpGenericArgumentMemberType(ctx, member, env, saved = true) {
|
|
79309
|
+
const type2 = storedMemberTypeInfoForCodegen(ctx, member);
|
|
79310
|
+
return type2 === null ? csharpValueType(ctx, member, saved, env) : csharpGenericArgumentType(ctx, type2, saved, env);
|
|
79311
|
+
}
|
|
79312
|
+
function csharpGenericArgumentType(ctx, type2, saved, env, genericBindingSaved = saved) {
|
|
79313
|
+
const optional2 = type2.required ? "" : "?";
|
|
79314
|
+
const family = saved ? "Neo" : "NeoReadOnly";
|
|
79315
|
+
switch (type2.type) {
|
|
79316
|
+
case 14 /* Vector2 */:
|
|
79317
|
+
case 15 /* Vector2Int */:
|
|
79318
|
+
case 16 /* Vector3 */:
|
|
79319
|
+
case 17 /* Vector3Int */:
|
|
79320
|
+
return `${vectorWrapperType(type2.type, saved)}${optional2}`;
|
|
79321
|
+
case 19 /* Color */:
|
|
79322
|
+
return `${family}Color${optional2}`;
|
|
79323
|
+
case 6 /* List */:
|
|
79324
|
+
case 5 /* Dictionary */:
|
|
79325
|
+
case 28 /* Set */:
|
|
79326
|
+
case 9 /* Lookup */: {
|
|
79327
|
+
const entry = type2.entryTypeInfo;
|
|
79328
|
+
const set = type2.type === 28 /* Set */ || type2.type === 9 /* Lookup */;
|
|
79329
|
+
let wrapper = type2.type === 6 /* List */ ? "List" : "Dictionary";
|
|
79330
|
+
let entryType;
|
|
79331
|
+
if (set && entry.type === 29 /* Reference */) {
|
|
79332
|
+
wrapper = "LookupSet";
|
|
79333
|
+
entryType = csharpGenericArgumentType(
|
|
79334
|
+
ctx,
|
|
79335
|
+
entry,
|
|
79336
|
+
false,
|
|
79337
|
+
env,
|
|
79338
|
+
genericBindingSaved
|
|
79339
|
+
);
|
|
79340
|
+
} else if (set && entry.type === 8 /* Enum */) {
|
|
79341
|
+
wrapper = "EnumSet";
|
|
79342
|
+
entryType = csharpTypeInfoValueType(
|
|
79343
|
+
ctx,
|
|
79344
|
+
entry,
|
|
79345
|
+
false,
|
|
79346
|
+
env,
|
|
79347
|
+
genericBindingSaved
|
|
79348
|
+
);
|
|
79349
|
+
} else if (set && entry.type === 18 /* DialogueLookup */) {
|
|
79350
|
+
return `${family}DialogueReferenceSet${optional2}`;
|
|
79351
|
+
} else {
|
|
79352
|
+
if (set) wrapper = "Set";
|
|
79353
|
+
const entrySaved = saved && (!set || entry.type === 7 /* Class */ || entry.type === 22 /* Interface */ || entry.type === 21 /* Generic */);
|
|
79354
|
+
entryType = csharpGenericArgumentType(
|
|
79355
|
+
ctx,
|
|
79356
|
+
entry,
|
|
79357
|
+
entrySaved,
|
|
79358
|
+
env,
|
|
79359
|
+
genericBindingSaved
|
|
79360
|
+
);
|
|
79361
|
+
}
|
|
79362
|
+
if (entryType === null) return null;
|
|
79363
|
+
if (type2.type === 5 /* Dictionary */ && type2.keyEnumId !== void 0) {
|
|
79364
|
+
const key = ctx.enumNames.get(type2.keyEnumId);
|
|
79365
|
+
if (key === void 0) return null;
|
|
79366
|
+
entryType = `${key}, ${entryType}`;
|
|
79367
|
+
}
|
|
79368
|
+
return `${family}${wrapper}<${entryType}>${optional2}`;
|
|
79369
|
+
}
|
|
79370
|
+
case 29 /* Reference */: {
|
|
79371
|
+
const collection = referencedCollectionView(
|
|
79372
|
+
ctx,
|
|
79373
|
+
type2.targetTypeInfo,
|
|
79374
|
+
env
|
|
79375
|
+
);
|
|
79376
|
+
if (collection !== null) return `${collection.view}${optional2}`;
|
|
79377
|
+
const handle = referenceHandleTypeInfo(ctx, type2);
|
|
79378
|
+
if (handle !== null)
|
|
79379
|
+
return csharpTypeInfoValueType(
|
|
79380
|
+
ctx,
|
|
79381
|
+
handle,
|
|
79382
|
+
false,
|
|
79383
|
+
env,
|
|
79384
|
+
genericBindingSaved
|
|
79385
|
+
);
|
|
79386
|
+
return csharpTypeInfoValueType(
|
|
79387
|
+
ctx,
|
|
79388
|
+
type2,
|
|
79389
|
+
false,
|
|
79390
|
+
env,
|
|
79391
|
+
genericBindingSaved
|
|
79392
|
+
);
|
|
79393
|
+
}
|
|
79394
|
+
default:
|
|
79395
|
+
return csharpTypeInfoValueType(
|
|
79396
|
+
ctx,
|
|
79397
|
+
type2,
|
|
79398
|
+
saved,
|
|
79399
|
+
env,
|
|
79400
|
+
genericBindingSaved
|
|
79401
|
+
);
|
|
79402
|
+
}
|
|
79403
|
+
}
|
|
78511
79404
|
function csharpTypeInfoValueType(ctx, typeInfo, saved, genericEnv, genericBindingSaved = saved) {
|
|
78512
79405
|
const optional2 = !typeInfo.required;
|
|
78513
79406
|
switch (typeInfo.type) {
|
|
@@ -78693,7 +79586,7 @@ function typeInfoConstructedSuffix(ctx, typeInfo, saved, genericEnv, genericBind
|
|
|
78693
79586
|
});
|
|
78694
79587
|
return null;
|
|
78695
79588
|
}
|
|
78696
|
-
const argType =
|
|
79589
|
+
const argType = csharpGenericArgumentType(
|
|
78697
79590
|
ctx,
|
|
78698
79591
|
argInfo,
|
|
78699
79592
|
true,
|
|
@@ -79429,24 +80322,29 @@ function pointerOwnershipForStorage(storage) {
|
|
|
79429
80322
|
return "asset";
|
|
79430
80323
|
}
|
|
79431
80324
|
}
|
|
80325
|
+
function tupleMemberTypeInfo(ctx, member) {
|
|
80326
|
+
const elements = [];
|
|
80327
|
+
for (const [index, id] of member.elementMemberIds.entries()) {
|
|
80328
|
+
const descriptor = resolveMemberById(ctx, id, "elementMemberIds");
|
|
80329
|
+
if (descriptor === null) return null;
|
|
80330
|
+
const typeInfo = storedMemberTypeInfoForCodegen(ctx, descriptor);
|
|
80331
|
+
if (typeInfo === null) return null;
|
|
80332
|
+
elements.push({
|
|
80333
|
+
typeInfo,
|
|
80334
|
+
...descriptor.name === `Item${index + 1}` ? {} : { name: descriptor.name }
|
|
80335
|
+
});
|
|
80336
|
+
}
|
|
80337
|
+
return {
|
|
80338
|
+
type: 30 /* Tuple */,
|
|
80339
|
+
required: isRequiredMember(member),
|
|
80340
|
+
elements
|
|
80341
|
+
};
|
|
80342
|
+
}
|
|
79432
80343
|
function memberTypeInfoForCodegen(ctx, member) {
|
|
79433
80344
|
const required = isRequiredMember(member);
|
|
79434
80345
|
if (isMemberGenericBase(member))
|
|
79435
80346
|
return genericParamTypeInfo2(ctx, member.genericParamId, required);
|
|
79436
|
-
if (isMemberTupleBase(member))
|
|
79437
|
-
const elements = [];
|
|
79438
|
-
for (const [index, id] of member.elementMemberIds.entries()) {
|
|
79439
|
-
const descriptor = resolveMemberById(ctx, id, "elementMemberIds");
|
|
79440
|
-
if (descriptor === null) return null;
|
|
79441
|
-
const typeInfo = memberTypeInfoForCodegen(ctx, descriptor);
|
|
79442
|
-
if (typeInfo === null) return null;
|
|
79443
|
-
elements.push({
|
|
79444
|
-
typeInfo,
|
|
79445
|
-
...descriptor.name === `Item${index + 1}` ? {} : { name: descriptor.name }
|
|
79446
|
-
});
|
|
79447
|
-
}
|
|
79448
|
-
return { type: 30 /* Tuple */, required, elements };
|
|
79449
|
-
}
|
|
80347
|
+
if (isMemberTupleBase(member)) return tupleMemberTypeInfo(ctx, member);
|
|
79450
80348
|
const slotType = classSlotTypeInfo(ctx, member, required);
|
|
79451
80349
|
if (slotType !== null) return slotType;
|
|
79452
80350
|
if (isMemberLookupBase(member)) {
|
|
@@ -79491,9 +80389,12 @@ function memberTypeInfoForCodegen(ctx, member) {
|
|
|
79491
80389
|
}
|
|
79492
80390
|
if (isMemberNSPropertyBase(member)) return member.returnTypeInfo;
|
|
79493
80391
|
if (isMemberVariantBase(member)) {
|
|
80392
|
+
const lookup = member.valueTypeInfo != null;
|
|
80393
|
+
const kind = lookup ? NeoWorldSystemClassKind.LookupVariant : NeoWorldSystemClassKind.Variant;
|
|
80394
|
+
const declaration = ctx.exportData.classes[requireWorldSystemClassDefinition(kind).classId];
|
|
79494
80395
|
const systemClass = neoVariantSystemClass(
|
|
79495
|
-
|
|
79496
|
-
|
|
80396
|
+
declaration === void 0 ? [] : [declaration],
|
|
80397
|
+
lookup
|
|
79497
80398
|
);
|
|
79498
80399
|
return variantMemberDeclaredTypeInfo(member, systemClass);
|
|
79499
80400
|
}
|