@neocompose/cli 0.89.4 → 0.89.6
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 +34 -0
- package/dist/neo-runtime.mjs +1411 -216
- package/dist/test-worker.mjs +1036 -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/sync/sync.md +3 -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
|
|
@@ -45353,6 +45948,7 @@ function rowGenericEnvironment(document2, row, contextualRootMember) {
|
|
|
45353
45948
|
for (const [paramId, binding] of envFromStamp(row.genericBindings)) {
|
|
45354
45949
|
env.set(paramId, binding);
|
|
45355
45950
|
}
|
|
45951
|
+
closeForwardedGenericParams(env);
|
|
45356
45952
|
return env;
|
|
45357
45953
|
}
|
|
45358
45954
|
function tryResolveTypeInfo(document2, rawTypeInfo, env) {
|
|
@@ -46592,6 +47188,9 @@ function prepareStoredClassValueResolution(args) {
|
|
|
46592
47188
|
readRecorder: args.readRecorder
|
|
46593
47189
|
};
|
|
46594
47190
|
}
|
|
47191
|
+
function resolveStoredClassValue(args) {
|
|
47192
|
+
return resolveVirtualInstanceGraph(prepareStoredClassValueResolution(args));
|
|
47193
|
+
}
|
|
46595
47194
|
function expandStoredClassValue(args) {
|
|
46596
47195
|
const placement = resolveMember(args.rootMember, args.document.members);
|
|
46597
47196
|
if (isClassSlotMember(placement) && placement.payload === 1 /* Partial */) {
|
|
@@ -49296,6 +49895,21 @@ function createHeadlessVirtualInstanceResolver(args) {
|
|
|
49296
49895
|
return inherited === void 0 ? authored : { ...inherited, ...authored };
|
|
49297
49896
|
};
|
|
49298
49897
|
return {
|
|
49898
|
+
declarationDefaultGraph: (rootId, member) => {
|
|
49899
|
+
recorder.recordValueRead(rootId);
|
|
49900
|
+
const root = rawById.get(rootId);
|
|
49901
|
+
if (root === void 0) return null;
|
|
49902
|
+
return resolveStoredClassValue({
|
|
49903
|
+
evaluateInitializer: args.evaluateInitializer,
|
|
49904
|
+
materializeInitializerValue: args.materializeInitializerValue,
|
|
49905
|
+
materializeMemberDefaultValue: args.materializeMemberDefaultValue,
|
|
49906
|
+
document: resolverDocumentOnce(),
|
|
49907
|
+
instanceRoot: root,
|
|
49908
|
+
rootMember: member,
|
|
49909
|
+
materializedIndex: materializedIndexOnce(),
|
|
49910
|
+
readRecorder: recorder
|
|
49911
|
+
});
|
|
49912
|
+
},
|
|
49299
49913
|
storedClassGraph: (rootId, member) => {
|
|
49300
49914
|
expandRoot(rootId, member);
|
|
49301
49915
|
const graph = graphByValueId.get(rootId);
|
|
@@ -49442,7 +50056,7 @@ function initializerEvaluatorLookups(document2, readTracking) {
|
|
|
49442
50056
|
},
|
|
49443
50057
|
memberById: (id) => databaseVM.memberById(id),
|
|
49444
50058
|
valueById: (id) => databaseVM.valueById(id),
|
|
49445
|
-
|
|
50059
|
+
defaultValueSource: databaseVM.defaultValueSource?.bind(databaseVM),
|
|
49446
50060
|
onInitializerRead: databaseVM.onInitializerRead,
|
|
49447
50061
|
localizedTextById: (id) => databaseVM.localizedTextById?.(id) ?? null,
|
|
49448
50062
|
...databaseVM.hasStoredValueId === void 0 ? {} : {
|
|
@@ -49513,10 +50127,10 @@ function initializerEvaluatorLookups(document2, readTracking) {
|
|
|
49513
50127
|
const lookups = {
|
|
49514
50128
|
...indexedLookups,
|
|
49515
50129
|
changeListenerDefaultsForOwner: headlessVirtualResolver.changeListenerDefaultsForOwner,
|
|
49516
|
-
|
|
50130
|
+
defaultValueSource: (id, member) => declarationDefaultSource(
|
|
49517
50131
|
id,
|
|
49518
50132
|
indexedLookups.valueById(id),
|
|
49519
|
-
headlessVirtualResolver.
|
|
50133
|
+
(id2) => headlessVirtualResolver.declarationDefaultGraph(id2, member)
|
|
49520
50134
|
),
|
|
49521
50135
|
valueById: (id) => indexedLookups.valueById(id) ?? headlessVirtualResolver.valueById(id),
|
|
49522
50136
|
rowForValueReference: (value) => indexedLookups.rowForValueReference?.(value) ?? headlessVirtualResolver.rowForValueReference(value),
|
|
@@ -49572,7 +50186,8 @@ function defaultValuePlans(document2) {
|
|
|
49572
50186
|
projectFiles: document2.projectFiles,
|
|
49573
50187
|
textureTemplates: document2.textureTemplates,
|
|
49574
50188
|
memberById: lookups.memberById,
|
|
49575
|
-
valueById: lookups.
|
|
50189
|
+
valueById: lookups.valueById,
|
|
50190
|
+
defaultValueSource: lookups.defaultValueSource,
|
|
49576
50191
|
// A host database without list membership falls back to `values`.
|
|
49577
50192
|
unorderedListEntryIds: document2.databaseVM?.unorderedListEntryIds === void 0 && document2.databaseVM !== void 0 ? void 0 : lookups.unorderedListEntryIds
|
|
49578
50193
|
});
|
|
@@ -49912,10 +50527,10 @@ function headlessVirtualInstanceLookups(document2, options = {}) {
|
|
|
49912
50527
|
const lookups = {
|
|
49913
50528
|
...indexed,
|
|
49914
50529
|
changeListenerDefaultsForOwner: virtual.changeListenerDefaultsForOwner,
|
|
49915
|
-
|
|
50530
|
+
defaultValueSource: (id, member) => declarationDefaultSource(
|
|
49916
50531
|
id,
|
|
49917
50532
|
indexed.valueById(id),
|
|
49918
|
-
virtual.
|
|
50533
|
+
(id2) => virtual.declarationDefaultGraph(id2, member)
|
|
49919
50534
|
),
|
|
49920
50535
|
// Raw first, then virtual: a materialized row always wins over the
|
|
49921
50536
|
// expansion that would otherwise answer for it.
|
|
@@ -52606,6 +53221,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
52606
53221
|
* compiling. Only one compile of each lambda argument reaches the program.
|
|
52607
53222
|
*/
|
|
52608
53223
|
lambdaFrame;
|
|
53224
|
+
/** The current call's inferred callbacks, including tuple elements. */
|
|
53225
|
+
argumentLambdas;
|
|
52609
53226
|
/** P118. Calls compiled in a lambda frame, with what their names bound to. */
|
|
52610
53227
|
frameCalls = /* @__PURE__ */ new Map();
|
|
52611
53228
|
frameCallsGroup;
|
|
@@ -54819,7 +55436,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
54819
55436
|
);
|
|
54820
55437
|
}
|
|
54821
55438
|
const bindings = [];
|
|
54822
|
-
const capturedTarget = statement.op !== "=" && (vectorTypeName(target.type) !== null || isBitwiseBinaryOperator(statement.op.slice(0, -1))) ? {
|
|
55439
|
+
const capturedTarget = statement.op !== "=" && (target.structuredLeafKind !== void 0 || vectorTypeName(target.type) !== null || isBitwiseBinaryOperator(statement.op.slice(0, -1))) ? {
|
|
54823
55440
|
...target,
|
|
54824
55441
|
pointer: this.captureAssignmentTarget(target.pointer, bindings)
|
|
54825
55442
|
} : target;
|
|
@@ -54901,6 +55518,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
54901
55518
|
...bindings.length > 0 ? { bindings } : {},
|
|
54902
55519
|
target: {
|
|
54903
55520
|
pointer: capturedTarget.pointer,
|
|
55521
|
+
...target.structuredLeafKind === void 0 ? {} : { structuredLeafKind: target.structuredLeafKind },
|
|
54904
55522
|
typeInfo: target.wireType ?? toWireType(target.type, this.project),
|
|
54905
55523
|
writability
|
|
54906
55524
|
},
|
|
@@ -55967,8 +56585,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
55967
56585
|
frameCallNames(expression, scope) {
|
|
55968
56586
|
if (this.lambdaFrame === void 0) return void 0;
|
|
55969
56587
|
if (expression.kind !== "call") return void 0;
|
|
55970
|
-
if (!expression.args.some(
|
|
55971
|
-
return void 0;
|
|
56588
|
+
if (!expression.args.some(hasTupleLambda)) return void 0;
|
|
55972
56589
|
if (this.overloadArgumentKind(expression, scope) !== "typed")
|
|
55973
56590
|
return void 0;
|
|
55974
56591
|
let names2 = this.callNames.get(expression);
|
|
@@ -56031,7 +56648,11 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
56031
56648
|
resolveExpressionCore(expression, scope, expected, convertSequence = true) {
|
|
56032
56649
|
if (expected?.kind === "delegate") {
|
|
56033
56650
|
if (expression.kind === "lambda") {
|
|
56034
|
-
|
|
56651
|
+
const lambdas = this.argumentLambdas;
|
|
56652
|
+
const cached = weighedLambda(lambdas?.get(expression), expected);
|
|
56653
|
+
if (cached !== void 0) return cached;
|
|
56654
|
+
const compile = () => this.resolveDelegateLambda(expression, expected, scope);
|
|
56655
|
+
return lambdas?.has(expression) ? this.inLambdaFrame(lambdas, expression, compile) : compile();
|
|
56035
56656
|
}
|
|
56036
56657
|
const methodGroup = this.resolveDelegateMethodGroup(
|
|
56037
56658
|
expression,
|
|
@@ -58800,6 +59421,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
58800
59421
|
}
|
|
58801
59422
|
const primitiveMember = resolvePrimitiveMember(receiver.type, name);
|
|
58802
59423
|
if (primitiveMember) {
|
|
59424
|
+
const structuredLeafKind = receiver.type.kind === "primitive" && isNeoScriptVectorKind(receiver.type.name) ? receiver.type.name : void 0;
|
|
58803
59425
|
if (isPrimitive(receiver.type, "NeoDialogueReference")) {
|
|
58804
59426
|
return {
|
|
58805
59427
|
pointer: {
|
|
@@ -58821,7 +59443,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
58821
59443
|
primitiveMember.type,
|
|
58822
59444
|
nullPropagating
|
|
58823
59445
|
);
|
|
58824
|
-
if (!primitiveMember.derived)
|
|
59446
|
+
if (!primitiveMember.derived)
|
|
59447
|
+
return structuredLeafKind === void 0 ? resolved : { ...resolved, structuredLeafKind };
|
|
58825
59448
|
return {
|
|
58826
59449
|
...resolved,
|
|
58827
59450
|
derivedMember: { owner: this.describe(receiver.type), name }
|
|
@@ -61934,10 +62557,13 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
61934
62557
|
else if (cached && (sameCompilationType(cached.type, expected) || cached.pointer.type === "callFunction" /* CallFunction */)) {
|
|
61935
62558
|
resolved = cached;
|
|
61936
62559
|
} else {
|
|
61937
|
-
const
|
|
61938
|
-
|
|
61939
|
-
|
|
61940
|
-
|
|
62560
|
+
const previous = this.argumentLambdas;
|
|
62561
|
+
this.argumentLambdas = choice?.lambdas ?? inferred?.lambdas;
|
|
62562
|
+
try {
|
|
62563
|
+
resolved = this.resolveExpression(argument2, scope, target);
|
|
62564
|
+
} finally {
|
|
62565
|
+
this.argumentLambdas = previous;
|
|
62566
|
+
}
|
|
61941
62567
|
}
|
|
61942
62568
|
resolved = this.contextualReference(argument2, resolved, scope, target);
|
|
61943
62569
|
resolved = this.convertSequence(resolved, target);
|
|
@@ -61998,9 +62624,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
61998
62624
|
const callbacks = [];
|
|
61999
62625
|
const probe = new Scope(scope);
|
|
62000
62626
|
const resolvedArguments = /* @__PURE__ */ new Map();
|
|
62001
|
-
|
|
62002
|
-
const pattern = parameters[index];
|
|
62003
|
-
if (pattern === void 0) return;
|
|
62627
|
+
const inferArgument = (argument2, pattern, prior) => {
|
|
62004
62628
|
if (inference.unresolved(pattern).size === 0) return;
|
|
62005
62629
|
if (argument2.kind === "lambda" && pattern.kind === "delegate") {
|
|
62006
62630
|
argument2.params.forEach((parameter3, parameterIndex) => {
|
|
@@ -62011,8 +62635,14 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
62011
62635
|
callbacks.push({ ast: argument2, type: pattern });
|
|
62012
62636
|
return;
|
|
62013
62637
|
}
|
|
62638
|
+
if (argument2.kind === "tuple" && pattern.kind === "tuple") {
|
|
62639
|
+
if (argument2.elements.length !== pattern.elements.length) return;
|
|
62640
|
+
argument2.elements.forEach((element, index) => {
|
|
62641
|
+
inferArgument(element.value, pattern.elements[index].type);
|
|
62642
|
+
});
|
|
62643
|
+
return;
|
|
62644
|
+
}
|
|
62014
62645
|
if (!hasIndependentTypeEvidence(argument2)) return;
|
|
62015
|
-
const prior = weighed?.typed[index];
|
|
62016
62646
|
if (prior !== void 0) {
|
|
62017
62647
|
inference.add(
|
|
62018
62648
|
this.referenceInferenceType(argument2, prior, pattern),
|
|
@@ -62036,9 +62666,17 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
62036
62666
|
pattern
|
|
62037
62667
|
);
|
|
62038
62668
|
}
|
|
62669
|
+
};
|
|
62670
|
+
argumentsList2.forEach((argument2, index) => {
|
|
62671
|
+
const pattern = parameters[index];
|
|
62672
|
+
if (pattern === void 0) return;
|
|
62673
|
+
if (weighed === void 0 && argument2.kind === "tuple" && pattern.kind === "tuple")
|
|
62674
|
+
this.typeOverloadEntries(argument2, probe);
|
|
62675
|
+
inferArgument(argument2, pattern, weighed?.typed[index]);
|
|
62039
62676
|
});
|
|
62677
|
+
const lambdas = weighed?.lambdas ?? /* @__PURE__ */ new Map();
|
|
62040
62678
|
const error = inference.solve(callbacks, (callback, inputs) => {
|
|
62041
|
-
const probes =
|
|
62679
|
+
const probes = lambdas.get(callback.ast) ?? [];
|
|
62042
62680
|
let resolved = probes.find(
|
|
62043
62681
|
(candidate) => sameInputs(candidate.type, inputs)
|
|
62044
62682
|
);
|
|
@@ -62053,8 +62691,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
62053
62691
|
probe,
|
|
62054
62692
|
true
|
|
62055
62693
|
);
|
|
62056
|
-
resolved =
|
|
62057
|
-
|
|
62694
|
+
resolved = this.inLambdaFrame(lambdas, callback.ast, compile);
|
|
62695
|
+
lambdas.set(callback.ast, [...probes, resolved]);
|
|
62058
62696
|
}
|
|
62059
62697
|
if (!resolved.needsReturnContext)
|
|
62060
62698
|
resolvedArguments.set(callback.ast, resolved);
|
|
@@ -62072,7 +62710,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
62072
62710
|
}
|
|
62073
62711
|
return {
|
|
62074
62712
|
typeArguments: inference.arguments(),
|
|
62075
|
-
resolved: resolvedArguments
|
|
62713
|
+
resolved: resolvedArguments,
|
|
62714
|
+
lambdas
|
|
62076
62715
|
};
|
|
62077
62716
|
}
|
|
62078
62717
|
callableSignatureForReceiver(symbol, receiver, typeArguments, pos, inferred) {
|
|
@@ -65592,7 +66231,7 @@ function variable(id, type2, pointer, project) {
|
|
|
65592
66231
|
};
|
|
65593
66232
|
}
|
|
65594
66233
|
function isGeneratedPositionalCall(target, expression) {
|
|
65595
|
-
return
|
|
66234
|
+
return (target.declaredConstructors?.length ?? 0) === 0 && target.constructorSignature !== void 0 && expression.argumentNames === void 0 && callHasPositionalArguments(expression);
|
|
65596
66235
|
}
|
|
65597
66236
|
function closedConstructorParameters(parameters, targetType, schemaClass2, project) {
|
|
65598
66237
|
return parameters.map((parameter3) => {
|
|
@@ -65636,7 +66275,7 @@ function bindConstructorArgumentNames(className, declared, argumentNames, pos) {
|
|
|
65636
66275
|
if (positionalIndex < 0) {
|
|
65637
66276
|
return argumentNames.filter((name) => name !== null);
|
|
65638
66277
|
}
|
|
65639
|
-
const sole = declared.
|
|
66278
|
+
const sole = declared.length === 1 ? declared[0] : void 0;
|
|
65640
66279
|
if (sole === void 0) {
|
|
65641
66280
|
throw new CompileError(
|
|
65642
66281
|
`Class '${className}' declares constructors, so argument ${positionalIndex + 1} must be passed by name \u2014 candidates: ${describeNeoScriptDeclaredConstructors(className, declared)}.`,
|
|
@@ -67204,7 +67843,7 @@ function switchValueKey(value) {
|
|
|
67204
67843
|
const enumId = value.typeInfo.type === 8 /* Enum */ ? value.typeInfo.enumId : null;
|
|
67205
67844
|
return JSON.stringify([value.typeInfo.type, enumId, value.value]);
|
|
67206
67845
|
}
|
|
67207
|
-
function resolveNeoScriptType(type2, context, project) {
|
|
67846
|
+
function resolveNeoScriptType(type2, context, project, referenceMode = "read") {
|
|
67208
67847
|
let resolved;
|
|
67209
67848
|
switch (type2.kind) {
|
|
67210
67849
|
case "primitive":
|
|
@@ -67257,7 +67896,7 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67257
67896
|
);
|
|
67258
67897
|
const ineligible = neoScriptReferenceTargetError(targetType, project);
|
|
67259
67898
|
if (ineligible !== null) throw new CompileError(ineligible, type2.pos);
|
|
67260
|
-
resolved = neoScriptReferenceType(
|
|
67899
|
+
resolved = referenceMode === "stored" ? { kind: "reference", target: targetType } : neoScriptReferenceType(
|
|
67261
67900
|
targetType,
|
|
67262
67901
|
false,
|
|
67263
67902
|
(named2) => isNeoScriptValueNamedType(named2, project)
|
|
@@ -67297,7 +67936,7 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67297
67936
|
typeId: named.id,
|
|
67298
67937
|
...type2.typeArguments ? {
|
|
67299
67938
|
typeArguments: type2.typeArguments.map(
|
|
67300
|
-
(argument2) => resolveNeoScriptType(argument2, context, project)
|
|
67939
|
+
(argument2) => resolveNeoScriptType(argument2, context, project, "stored")
|
|
67301
67940
|
)
|
|
67302
67941
|
} : {}
|
|
67303
67942
|
};
|
|
@@ -67309,7 +67948,12 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67309
67948
|
kind: "tuple",
|
|
67310
67949
|
nullable: !type2.required,
|
|
67311
67950
|
elements: type2.elements.map((element) => ({
|
|
67312
|
-
type: resolveNeoScriptType(
|
|
67951
|
+
type: resolveNeoScriptType(
|
|
67952
|
+
element.type,
|
|
67953
|
+
context,
|
|
67954
|
+
project,
|
|
67955
|
+
referenceMode
|
|
67956
|
+
),
|
|
67313
67957
|
...element.name ? { name: element.name } : {},
|
|
67314
67958
|
...element.nameRange && context.sourceUri ? {
|
|
67315
67959
|
labelLocation: {
|
|
@@ -67322,11 +67966,21 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67322
67966
|
case "list":
|
|
67323
67967
|
resolved = {
|
|
67324
67968
|
kind: "list",
|
|
67325
|
-
elementType: resolveNeoScriptType(
|
|
67969
|
+
elementType: resolveNeoScriptType(
|
|
67970
|
+
type2.element,
|
|
67971
|
+
context,
|
|
67972
|
+
project,
|
|
67973
|
+
referenceMode
|
|
67974
|
+
)
|
|
67326
67975
|
};
|
|
67327
67976
|
break;
|
|
67328
67977
|
case "set": {
|
|
67329
|
-
const element = resolveNeoScriptType(
|
|
67978
|
+
const element = resolveNeoScriptType(
|
|
67979
|
+
type2.element,
|
|
67980
|
+
context,
|
|
67981
|
+
project,
|
|
67982
|
+
referenceMode
|
|
67983
|
+
);
|
|
67330
67984
|
resolved = {
|
|
67331
67985
|
kind: "set",
|
|
67332
67986
|
// P105 §2.2. Multiselect dialogue elements are bare dialogue ids.
|
|
@@ -67345,7 +67999,12 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67345
67999
|
resolved = {
|
|
67346
68000
|
kind: "dictionary",
|
|
67347
68001
|
keyType: key,
|
|
67348
|
-
valueType: resolveNeoScriptType(
|
|
68002
|
+
valueType: resolveNeoScriptType(
|
|
68003
|
+
type2.value,
|
|
68004
|
+
context,
|
|
68005
|
+
project,
|
|
68006
|
+
referenceMode
|
|
68007
|
+
)
|
|
67349
68008
|
};
|
|
67350
68009
|
break;
|
|
67351
68010
|
}
|
|
@@ -67353,12 +68012,7 @@ function resolveNeoScriptType(type2, context, project) {
|
|
|
67353
68012
|
return { ...resolved, nullable: !type2.required };
|
|
67354
68013
|
}
|
|
67355
68014
|
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 };
|
|
68015
|
+
return resolveNeoScriptType(type2, context, project, "stored");
|
|
67362
68016
|
}
|
|
67363
68017
|
function resultKind(kinds) {
|
|
67364
68018
|
if (kinds.includes("targetTyped")) return "targetTyped";
|
|
@@ -67373,6 +68027,9 @@ function compilesAlike(kind, target) {
|
|
|
67373
68027
|
);
|
|
67374
68028
|
return !isPrimitive(target, "decimal");
|
|
67375
68029
|
}
|
|
68030
|
+
function hasTupleLambda(expression) {
|
|
68031
|
+
return expression.kind === "lambda" || expression.kind === "tuple" && expression.elements.some((element) => hasTupleLambda(element.value));
|
|
68032
|
+
}
|
|
67376
68033
|
function sameInputs(type2, inputs) {
|
|
67377
68034
|
return type2.kind === "delegate" && type2.parameterTypes.length === inputs.length && type2.parameterTypes.every(
|
|
67378
68035
|
(input, index) => sameCompilationType(input, inputs[index])
|
|
@@ -76894,6 +77551,15 @@ function isCallableMemberForCodegen(value) {
|
|
|
76894
77551
|
var DEFAULT_NAMESPACE = "Assets.Scripts.Neo";
|
|
76895
77552
|
function createGenerationContext(exportData, diagnostics, docs = EMPTY_UNITY_CODEGEN_DOCS) {
|
|
76896
77553
|
const classes = Object.values(exportData.classes);
|
|
77554
|
+
const genericDeclarations = /* @__PURE__ */ new Map();
|
|
77555
|
+
for (const schemaClass2 of classes) {
|
|
77556
|
+
for (const param of schemaClass2.genericParams ?? []) {
|
|
77557
|
+
genericDeclarations.set(param.id, {
|
|
77558
|
+
param,
|
|
77559
|
+
declaringClassId: schemaClass2.id
|
|
77560
|
+
});
|
|
77561
|
+
}
|
|
77562
|
+
}
|
|
76897
77563
|
const members2 = Object.values(exportData.members);
|
|
76898
77564
|
const dialogueGroups = Object.values(exportData.dialogueGroups ?? {});
|
|
76899
77565
|
const dialogueGroupsByParent = /* @__PURE__ */ new Map();
|
|
@@ -76987,6 +77653,7 @@ function createGenerationContext(exportData, diagnostics, docs = EMPTY_UNITY_COD
|
|
|
76987
77653
|
declarationSignatures: /* @__PURE__ */ new Map(),
|
|
76988
77654
|
worldKinds: indexWorldSystemClassKinds(classes),
|
|
76989
77655
|
resolvedMembers: /* @__PURE__ */ new Map(),
|
|
77656
|
+
genericDeclarations,
|
|
76990
77657
|
genericScopes: /* @__PURE__ */ new Map(),
|
|
76991
77658
|
genericEnvironments: /* @__PURE__ */ new Map(),
|
|
76992
77659
|
functionGenericParams: indexFunctionGenericParams(
|
|
@@ -77205,12 +77872,25 @@ function inheritedGeneratedMemberContract(ctx, ownerClassId, schemaKey, memberId
|
|
|
77205
77872
|
}
|
|
77206
77873
|
return null;
|
|
77207
77874
|
}
|
|
77875
|
+
function declaredGeneratedPropertyValueType(ctx, member, memberSaved, saved, genericEnv) {
|
|
77876
|
+
const declared = lookupDeclaredTypeInfo2(member);
|
|
77877
|
+
if (declared?.type !== 21 /* Generic */ || isMultiSelectionMember(member))
|
|
77878
|
+
return csharpPropertyValueType(ctx, member, memberSaved, genericEnv, saved);
|
|
77879
|
+
const target = csharpTypeInfoValueType(ctx, declared, saved, genericEnv);
|
|
77880
|
+
if (target === null) return null;
|
|
77881
|
+
return lookupProjection(ctx, member) === "slot" /* Slot */ ? `NeoReference<${target}>${isRequiredMember(member) ? "" : "?"}` : target;
|
|
77882
|
+
}
|
|
77208
77883
|
function emittedGeneratedMemberContract(ctx, ownerClassId, schemaKey, memberId, saved, genericEnv) {
|
|
77209
|
-
const member = ctx
|
|
77210
|
-
if (member ===
|
|
77884
|
+
const member = resolveMemberById(ctx, memberId, `members.${memberId}`);
|
|
77885
|
+
if (member === null) return null;
|
|
77211
77886
|
const memberSaved = memberSavedForStorage(ctx, memberId, saved, ownerClassId);
|
|
77212
|
-
const
|
|
77213
|
-
|
|
77887
|
+
const valueType = declaredGeneratedPropertyValueType(
|
|
77888
|
+
ctx,
|
|
77889
|
+
member,
|
|
77890
|
+
memberSaved,
|
|
77891
|
+
saved,
|
|
77892
|
+
genericEnv
|
|
77893
|
+
);
|
|
77214
77894
|
if (valueType === null) return null;
|
|
77215
77895
|
const inherited = inheritedGeneratedMemberContract(
|
|
77216
77896
|
ctx,
|
|
@@ -77221,11 +77901,38 @@ function emittedGeneratedMemberContract(ctx, ownerClassId, schemaKey, memberId,
|
|
|
77221
77901
|
genericEnv
|
|
77222
77902
|
);
|
|
77223
77903
|
const hasSetter = emitsGeneratedSetter(member, memberSaved) && !suppressesInheritedSetter(inherited);
|
|
77904
|
+
const declaredValueTypeInfo = generatedValueTypeInfo(ctx, member);
|
|
77905
|
+
const readsReferenceValue = referenceImplementsValueContract(
|
|
77906
|
+
ctx,
|
|
77907
|
+
member,
|
|
77908
|
+
valueType,
|
|
77909
|
+
inherited
|
|
77910
|
+
);
|
|
77911
|
+
let valueTypeInfo = declaredValueTypeInfo;
|
|
77912
|
+
if (readsReferenceValue && inherited !== null) {
|
|
77913
|
+
valueTypeInfo = inherited.valueTypeInfo;
|
|
77914
|
+
} else if (isMemberLookupBase(member) && !isMultiSelectionMember(member) && lookupProjection(ctx, member) === "slot" /* Slot */ && declaredValueTypeInfo !== null) {
|
|
77915
|
+
valueTypeInfo = {
|
|
77916
|
+
type: 29 /* Reference */,
|
|
77917
|
+
required: isRequiredMember(member),
|
|
77918
|
+
targetTypeInfo: declaredValueTypeInfo
|
|
77919
|
+
};
|
|
77920
|
+
}
|
|
77921
|
+
const emittedValueType = narrowedMemberValueType(
|
|
77922
|
+
ctx,
|
|
77923
|
+
member,
|
|
77924
|
+
valueType,
|
|
77925
|
+
inherited
|
|
77926
|
+
);
|
|
77927
|
+
if (inherited?.valueTypeInfo?.type === 29 /* Reference */ && emittedValueType === inherited.valueType) {
|
|
77928
|
+
valueTypeInfo = inherited.valueTypeInfo;
|
|
77929
|
+
}
|
|
77224
77930
|
return {
|
|
77225
|
-
valueType:
|
|
77931
|
+
valueType: emittedValueType,
|
|
77226
77932
|
hasSetter,
|
|
77227
77933
|
getOnlyContract: (inherited?.getOnlyContract ?? false) || isAbstractMember(member) === true && !hasSetter,
|
|
77228
|
-
valueTypeInfo
|
|
77934
|
+
valueTypeInfo,
|
|
77935
|
+
genericEnv,
|
|
77229
77936
|
closesGenericType: (inherited?.closesGenericType ?? false) || lookupNarrowsThroughGenericParam(member) || isMemberGenericBase(member)
|
|
77230
77937
|
};
|
|
77231
77938
|
}
|
|
@@ -77234,7 +77941,8 @@ function suppressesInheritedSetter(contract) {
|
|
|
77234
77941
|
}
|
|
77235
77942
|
function generatedValueTypeInfo(ctx, member) {
|
|
77236
77943
|
const required = isRequiredMember(member);
|
|
77237
|
-
if (isMemberTupleBase(member)
|
|
77944
|
+
if (isMemberTupleBase(member) || isMemberVariantBase(member))
|
|
77945
|
+
return memberTypeInfoForCodegen(ctx, member);
|
|
77238
77946
|
const slotType = classSlotTypeInfo(ctx, member, required);
|
|
77239
77947
|
if (slotType !== null) return slotType;
|
|
77240
77948
|
const returnType = nsPropertyReturnTypeInfo(member);
|
|
@@ -77249,8 +77957,8 @@ function generatedValueTypeInfo(ctx, member) {
|
|
|
77249
77957
|
return null;
|
|
77250
77958
|
}
|
|
77251
77959
|
function genericParamTypeInfo2(ctx, genericParamId, required) {
|
|
77252
|
-
const declaration =
|
|
77253
|
-
if (declaration ===
|
|
77960
|
+
const declaration = ctx.genericDeclarations.get(genericParamId);
|
|
77961
|
+
if (declaration === void 0) {
|
|
77254
77962
|
ctx.diagnostics.push({
|
|
77255
77963
|
severity: "error",
|
|
77256
77964
|
message: `Generic param "${genericParamId}" is not declared by any type in the export.`,
|
|
@@ -77261,7 +77969,7 @@ function genericParamTypeInfo2(ctx, genericParamId, required) {
|
|
|
77261
77969
|
return {
|
|
77262
77970
|
type: 21 /* Generic */,
|
|
77263
77971
|
required,
|
|
77264
|
-
ownerClassId: declaration.
|
|
77972
|
+
ownerClassId: declaration.declaringClassId,
|
|
77265
77973
|
genericParamId
|
|
77266
77974
|
};
|
|
77267
77975
|
}
|
|
@@ -77282,7 +77990,7 @@ function classSlotTypeInfo(ctx, member, required) {
|
|
|
77282
77990
|
"classArguments"
|
|
77283
77991
|
);
|
|
77284
77992
|
if (argument2 === null) return null;
|
|
77285
|
-
const typeInfo =
|
|
77993
|
+
const typeInfo = storedMemberTypeInfoForCodegen(ctx, argument2);
|
|
77286
77994
|
if (typeInfo === null) return null;
|
|
77287
77995
|
typeArguments[parameterId] = typeInfo;
|
|
77288
77996
|
}
|
|
@@ -77310,9 +78018,63 @@ function generatedValueClassId(ctx, member) {
|
|
|
77310
78018
|
const typeInfo = generatedValueTypeInfo(ctx, member);
|
|
77311
78019
|
return typeInfo?.type === 7 /* Class */ ? typeInfo.classId : null;
|
|
77312
78020
|
}
|
|
78021
|
+
function referenceDepth(ctx, type2, env) {
|
|
78022
|
+
let depth = 0;
|
|
78023
|
+
let current = type2;
|
|
78024
|
+
let seen;
|
|
78025
|
+
while (current !== null) {
|
|
78026
|
+
if (current.type === 29 /* Reference */) {
|
|
78027
|
+
depth++;
|
|
78028
|
+
current = current.targetTypeInfo;
|
|
78029
|
+
continue;
|
|
78030
|
+
}
|
|
78031
|
+
if (current.type !== 21 /* Generic */) return depth;
|
|
78032
|
+
if (!isClassGenericParamTypeInfo(current)) return depth;
|
|
78033
|
+
const entry = env?.get(current.genericParamId);
|
|
78034
|
+
if (entry === void 0 || entry.kind === "unbound") return depth;
|
|
78035
|
+
seen ??= /* @__PURE__ */ new Set();
|
|
78036
|
+
if (seen.has(entry.memberId)) return null;
|
|
78037
|
+
seen.add(entry.memberId);
|
|
78038
|
+
const binding = resolveMemberById(ctx, entry.memberId, "genericBinding");
|
|
78039
|
+
if (binding === null) return null;
|
|
78040
|
+
if (isMemberGenericBase(binding)) {
|
|
78041
|
+
current = genericParamTypeInfo2(ctx, binding.genericParamId, true);
|
|
78042
|
+
} else if (isMemberLookupBase(binding) && !isMultiSelectionMember(binding)) {
|
|
78043
|
+
current = slotTypeInfo(binding, ctx);
|
|
78044
|
+
} else {
|
|
78045
|
+
return depth;
|
|
78046
|
+
}
|
|
78047
|
+
}
|
|
78048
|
+
return null;
|
|
78049
|
+
}
|
|
78050
|
+
function referenceImplementsValueContract(ctx, member, rawValueType, contract) {
|
|
78051
|
+
if (contract?.getOnlyContract !== true || !isMemberLookupBase(member) || isMultiSelectionMember(member))
|
|
78052
|
+
return false;
|
|
78053
|
+
const projection = lookupProjection(ctx, member);
|
|
78054
|
+
if (contract.valueTypeInfo?.type === 21 /* Generic */ && (lookupDeclaredTypeInfo2(member)?.type === 21 /* Generic */ || projection === "collection" /* Collection */))
|
|
78055
|
+
return true;
|
|
78056
|
+
if (projection !== "slot" /* Slot */) return false;
|
|
78057
|
+
const target = lookupDeclaredTypeInfo2(member);
|
|
78058
|
+
const inherited = contract.valueTypeInfo;
|
|
78059
|
+
if (target?.type === 29 /* Reference */ && inherited?.type === 29 /* Reference */) {
|
|
78060
|
+
const targetDepth = referenceDepth(ctx, target, contract.genericEnv);
|
|
78061
|
+
return targetDepth !== null && targetDepth === referenceDepth(ctx, inherited, contract.genericEnv);
|
|
78062
|
+
}
|
|
78063
|
+
const wrapper = `NeoReference<${contract.valueType}>`;
|
|
78064
|
+
if (rawValueType === wrapper || rawValueType === `${wrapper}?`) return true;
|
|
78065
|
+
if (contract.valueType.endsWith("?")) {
|
|
78066
|
+
const requiredTarget = `NeoReference<${contract.valueType.slice(0, -1)}>`;
|
|
78067
|
+
return rawValueType === requiredTarget || rawValueType === `${requiredTarget}?`;
|
|
78068
|
+
}
|
|
78069
|
+
return false;
|
|
78070
|
+
}
|
|
77313
78071
|
function narrowedMemberValueType(ctx, member, rawValueType, contract) {
|
|
77314
78072
|
if (contract === null) return rawValueType;
|
|
77315
78073
|
if (contract.valueType === rawValueType) return rawValueType;
|
|
78074
|
+
if (referenceImplementsValueContract(ctx, member, rawValueType, contract))
|
|
78075
|
+
return contract.valueType;
|
|
78076
|
+
if (contract.valueTypeInfo?.type === 29 /* Reference */ && isMemberLookupBase(member) && !isMultiSelectionMember(member))
|
|
78077
|
+
return contract.valueType;
|
|
77316
78078
|
if (contract.closesGenericType && !isMemberGenericBase(member) && !lookupNarrowsThroughGenericParam(member)) {
|
|
77317
78079
|
return contract.valueType;
|
|
77318
78080
|
}
|
|
@@ -77331,6 +78093,13 @@ function narrowedMemberValueType(ctx, member, rawValueType, contract) {
|
|
|
77331
78093
|
return rawValueType;
|
|
77332
78094
|
const valueType = generatedValueTypeInfo(ctx, member);
|
|
77333
78095
|
if (valueType === null) return rawValueType;
|
|
78096
|
+
if (isMemberVariantBase(member) && member.valueTypeInfo == null && inheritedType.type === 7 /* Class */ && valueType.type === 7 /* Class */ && inheritedType.classId === valueType.classId) {
|
|
78097
|
+
const declaration = ctx.exportData.classes[inheritedType.classId];
|
|
78098
|
+
const targetParamId = declaration?.genericParams?.[0]?.id;
|
|
78099
|
+
const target = targetParamId === void 0 ? void 0 : inheritedType.typeArguments?.[targetParamId];
|
|
78100
|
+
if (declaration?.system?.worldKind === NeoWorldSystemClassKind.Variant && target !== void 0 && isTypeInfoAssignable(member.targetTypeInfo, target, ctx))
|
|
78101
|
+
return contract.valueType;
|
|
78102
|
+
}
|
|
77334
78103
|
const sourceType = valueType.type === 7 /* Class */ && inheritedType.type === 7 /* Class */ && valueType.required === false && inheritedType.required === true ? { ...valueType, required: true } : valueType;
|
|
77335
78104
|
try {
|
|
77336
78105
|
return isTypeInfoAssignable(sourceType, inheritedType, ctx) ? contract.valueType : rawValueType;
|
|
@@ -77433,8 +78202,13 @@ function calculateDeclarationSignature(ctx, projectionClassId, schemaKey, declar
|
|
|
77433
78202
|
true,
|
|
77434
78203
|
declaration.classDef.id
|
|
77435
78204
|
);
|
|
77436
|
-
const
|
|
77437
|
-
|
|
78205
|
+
const valueType = declaredGeneratedPropertyValueType(
|
|
78206
|
+
ctx,
|
|
78207
|
+
member,
|
|
78208
|
+
memberSaved,
|
|
78209
|
+
true,
|
|
78210
|
+
genericEnv
|
|
78211
|
+
);
|
|
77438
78212
|
if (valueType === null) return null;
|
|
77439
78213
|
const contract = inheritedGeneratedMemberContract(
|
|
77440
78214
|
ctx,
|
|
@@ -77791,11 +78565,11 @@ function csharpGenericParamType(ctx, genericParamId, saved, env, path) {
|
|
|
77791
78565
|
if (entry !== void 0 && entry.kind === "member") {
|
|
77792
78566
|
const bindingMember = resolveMemberById(ctx, entry.memberId, path);
|
|
77793
78567
|
if (bindingMember === null) return null;
|
|
77794
|
-
return
|
|
78568
|
+
return csharpGenericArgumentMemberType(ctx, bindingMember, env, saved);
|
|
77795
78569
|
}
|
|
77796
78570
|
const terminalParamId = entry !== void 0 && entry.kind === "unbound" ? entry.paramId : genericParamId;
|
|
77797
|
-
const declaration =
|
|
77798
|
-
if (declaration ===
|
|
78571
|
+
const declaration = ctx.genericDeclarations.get(terminalParamId);
|
|
78572
|
+
if (declaration === void 0) {
|
|
77799
78573
|
ctx.diagnostics.push({
|
|
77800
78574
|
severity: "error",
|
|
77801
78575
|
message: `Generic param "${terminalParamId}" is not declared by any type in the export.`,
|
|
@@ -77843,7 +78617,7 @@ function constructedTypeArgumentsSuffix(ctx, member, saved, env, genericBindingS
|
|
|
77843
78617
|
}
|
|
77844
78618
|
const bindingMember = resolveMemberById(ctx, arg.memberId, path);
|
|
77845
78619
|
if (bindingMember === null) return null;
|
|
77846
|
-
const argType =
|
|
78620
|
+
const argType = csharpGenericArgumentMemberType(ctx, bindingMember, env);
|
|
77847
78621
|
if (argType === null) {
|
|
77848
78622
|
ctx.diagnostics.push({
|
|
77849
78623
|
severity: "error",
|
|
@@ -77983,7 +78757,7 @@ var InterfaceConstructionEnv = class extends Map {
|
|
|
77983
78757
|
function bindingMemberValueType(ctx, memberId, env, path) {
|
|
77984
78758
|
const bindingMember = resolveMemberById(ctx, memberId, path);
|
|
77985
78759
|
if (bindingMember === null) return null;
|
|
77986
|
-
return
|
|
78760
|
+
return csharpGenericArgumentMemberType(ctx, bindingMember, env);
|
|
77987
78761
|
}
|
|
77988
78762
|
function typeInfoInterfaceArgumentsSuffix(ctx, typeInfo, genericEnv, genericBindingSaved) {
|
|
77989
78763
|
const params = ctx.exportData.interfaces[typeInfo.interfaceId]?.genericParams;
|
|
@@ -78003,10 +78777,16 @@ function typeInfoInterfaceArgumentsSuffix(ctx, typeInfo, genericEnv, genericBind
|
|
|
78003
78777
|
});
|
|
78004
78778
|
return null;
|
|
78005
78779
|
}
|
|
78006
|
-
const argType = csharpTypeInfoValueType(
|
|
78780
|
+
const argType = sequenceParameters.has(param.id) ? csharpTypeInfoValueType(
|
|
78007
78781
|
ctx,
|
|
78008
78782
|
argInfo,
|
|
78009
|
-
|
|
78783
|
+
false,
|
|
78784
|
+
genericEnv,
|
|
78785
|
+
genericBindingSaved
|
|
78786
|
+
) : csharpGenericArgumentType(
|
|
78787
|
+
ctx,
|
|
78788
|
+
argInfo,
|
|
78789
|
+
true,
|
|
78010
78790
|
genericEnv,
|
|
78011
78791
|
genericBindingSaved
|
|
78012
78792
|
);
|
|
@@ -78508,6 +79288,120 @@ function animationClipTargetType(ctx, member, env, ownerClassId) {
|
|
|
78508
79288
|
}
|
|
78509
79289
|
return constructedTarget;
|
|
78510
79290
|
}
|
|
79291
|
+
function storedMemberTypeInfoForCodegen(ctx, member) {
|
|
79292
|
+
if (isMemberTupleBase(member)) return tupleMemberTypeInfo(ctx, member);
|
|
79293
|
+
if (isMemberLookupBase(member) || isMemberEnumBase(member))
|
|
79294
|
+
return slotTypeInfo(member, ctx);
|
|
79295
|
+
if (isMemberWithEntries(member)) {
|
|
79296
|
+
const entry = resolveMemberById(ctx, member.entryMemberId, "entryMemberId");
|
|
79297
|
+
if (entry === null) return null;
|
|
79298
|
+
const entryTypeInfo = storedMemberTypeInfoForCodegen(ctx, entry);
|
|
79299
|
+
if (entryTypeInfo === null) return null;
|
|
79300
|
+
return {
|
|
79301
|
+
type: member.kind,
|
|
79302
|
+
required: isRequiredMember(member),
|
|
79303
|
+
entryTypeInfo,
|
|
79304
|
+
...isMemberDictionaryBase(member) && member.keyEnumId ? { keyEnumId: member.keyEnumId } : {}
|
|
79305
|
+
};
|
|
79306
|
+
}
|
|
79307
|
+
return memberTypeInfoForCodegen(ctx, member);
|
|
79308
|
+
}
|
|
79309
|
+
function csharpGenericArgumentMemberType(ctx, member, env, saved = true) {
|
|
79310
|
+
const type2 = storedMemberTypeInfoForCodegen(ctx, member);
|
|
79311
|
+
return type2 === null ? csharpValueType(ctx, member, saved, env) : csharpGenericArgumentType(ctx, type2, saved, env);
|
|
79312
|
+
}
|
|
79313
|
+
function csharpGenericArgumentType(ctx, type2, saved, env, genericBindingSaved = saved) {
|
|
79314
|
+
const optional2 = type2.required ? "" : "?";
|
|
79315
|
+
const family = saved ? "Neo" : "NeoReadOnly";
|
|
79316
|
+
switch (type2.type) {
|
|
79317
|
+
case 14 /* Vector2 */:
|
|
79318
|
+
case 15 /* Vector2Int */:
|
|
79319
|
+
case 16 /* Vector3 */:
|
|
79320
|
+
case 17 /* Vector3Int */:
|
|
79321
|
+
return `${vectorWrapperType(type2.type, saved)}${optional2}`;
|
|
79322
|
+
case 19 /* Color */:
|
|
79323
|
+
return `${family}Color${optional2}`;
|
|
79324
|
+
case 6 /* List */:
|
|
79325
|
+
case 5 /* Dictionary */:
|
|
79326
|
+
case 28 /* Set */:
|
|
79327
|
+
case 9 /* Lookup */: {
|
|
79328
|
+
const entry = type2.entryTypeInfo;
|
|
79329
|
+
const set = type2.type === 28 /* Set */ || type2.type === 9 /* Lookup */;
|
|
79330
|
+
let wrapper = type2.type === 6 /* List */ ? "List" : "Dictionary";
|
|
79331
|
+
let entryType;
|
|
79332
|
+
if (set && entry.type === 29 /* Reference */) {
|
|
79333
|
+
wrapper = "LookupSet";
|
|
79334
|
+
entryType = csharpGenericArgumentType(
|
|
79335
|
+
ctx,
|
|
79336
|
+
entry,
|
|
79337
|
+
false,
|
|
79338
|
+
env,
|
|
79339
|
+
genericBindingSaved
|
|
79340
|
+
);
|
|
79341
|
+
} else if (set && entry.type === 8 /* Enum */) {
|
|
79342
|
+
wrapper = "EnumSet";
|
|
79343
|
+
entryType = csharpTypeInfoValueType(
|
|
79344
|
+
ctx,
|
|
79345
|
+
entry,
|
|
79346
|
+
false,
|
|
79347
|
+
env,
|
|
79348
|
+
genericBindingSaved
|
|
79349
|
+
);
|
|
79350
|
+
} else if (set && entry.type === 18 /* DialogueLookup */) {
|
|
79351
|
+
return `${family}DialogueReferenceSet${optional2}`;
|
|
79352
|
+
} else {
|
|
79353
|
+
if (set) wrapper = "Set";
|
|
79354
|
+
const entrySaved = saved && (!set || entry.type === 7 /* Class */ || entry.type === 22 /* Interface */ || entry.type === 21 /* Generic */);
|
|
79355
|
+
entryType = csharpGenericArgumentType(
|
|
79356
|
+
ctx,
|
|
79357
|
+
entry,
|
|
79358
|
+
entrySaved,
|
|
79359
|
+
env,
|
|
79360
|
+
genericBindingSaved
|
|
79361
|
+
);
|
|
79362
|
+
}
|
|
79363
|
+
if (entryType === null) return null;
|
|
79364
|
+
if (type2.type === 5 /* Dictionary */ && type2.keyEnumId !== void 0) {
|
|
79365
|
+
const key = ctx.enumNames.get(type2.keyEnumId);
|
|
79366
|
+
if (key === void 0) return null;
|
|
79367
|
+
entryType = `${key}, ${entryType}`;
|
|
79368
|
+
}
|
|
79369
|
+
return `${family}${wrapper}<${entryType}>${optional2}`;
|
|
79370
|
+
}
|
|
79371
|
+
case 29 /* Reference */: {
|
|
79372
|
+
const collection = referencedCollectionView(
|
|
79373
|
+
ctx,
|
|
79374
|
+
type2.targetTypeInfo,
|
|
79375
|
+
env
|
|
79376
|
+
);
|
|
79377
|
+
if (collection !== null) return `${collection.view}${optional2}`;
|
|
79378
|
+
const handle = referenceHandleTypeInfo(ctx, type2);
|
|
79379
|
+
if (handle !== null)
|
|
79380
|
+
return csharpTypeInfoValueType(
|
|
79381
|
+
ctx,
|
|
79382
|
+
handle,
|
|
79383
|
+
false,
|
|
79384
|
+
env,
|
|
79385
|
+
genericBindingSaved
|
|
79386
|
+
);
|
|
79387
|
+
return csharpTypeInfoValueType(
|
|
79388
|
+
ctx,
|
|
79389
|
+
type2,
|
|
79390
|
+
false,
|
|
79391
|
+
env,
|
|
79392
|
+
genericBindingSaved
|
|
79393
|
+
);
|
|
79394
|
+
}
|
|
79395
|
+
default:
|
|
79396
|
+
return csharpTypeInfoValueType(
|
|
79397
|
+
ctx,
|
|
79398
|
+
type2,
|
|
79399
|
+
saved,
|
|
79400
|
+
env,
|
|
79401
|
+
genericBindingSaved
|
|
79402
|
+
);
|
|
79403
|
+
}
|
|
79404
|
+
}
|
|
78511
79405
|
function csharpTypeInfoValueType(ctx, typeInfo, saved, genericEnv, genericBindingSaved = saved) {
|
|
78512
79406
|
const optional2 = !typeInfo.required;
|
|
78513
79407
|
switch (typeInfo.type) {
|
|
@@ -78693,7 +79587,7 @@ function typeInfoConstructedSuffix(ctx, typeInfo, saved, genericEnv, genericBind
|
|
|
78693
79587
|
});
|
|
78694
79588
|
return null;
|
|
78695
79589
|
}
|
|
78696
|
-
const argType =
|
|
79590
|
+
const argType = csharpGenericArgumentType(
|
|
78697
79591
|
ctx,
|
|
78698
79592
|
argInfo,
|
|
78699
79593
|
true,
|
|
@@ -79429,24 +80323,29 @@ function pointerOwnershipForStorage(storage) {
|
|
|
79429
80323
|
return "asset";
|
|
79430
80324
|
}
|
|
79431
80325
|
}
|
|
80326
|
+
function tupleMemberTypeInfo(ctx, member) {
|
|
80327
|
+
const elements = [];
|
|
80328
|
+
for (const [index, id] of member.elementMemberIds.entries()) {
|
|
80329
|
+
const descriptor = resolveMemberById(ctx, id, "elementMemberIds");
|
|
80330
|
+
if (descriptor === null) return null;
|
|
80331
|
+
const typeInfo = storedMemberTypeInfoForCodegen(ctx, descriptor);
|
|
80332
|
+
if (typeInfo === null) return null;
|
|
80333
|
+
elements.push({
|
|
80334
|
+
typeInfo,
|
|
80335
|
+
...descriptor.name === `Item${index + 1}` ? {} : { name: descriptor.name }
|
|
80336
|
+
});
|
|
80337
|
+
}
|
|
80338
|
+
return {
|
|
80339
|
+
type: 30 /* Tuple */,
|
|
80340
|
+
required: isRequiredMember(member),
|
|
80341
|
+
elements
|
|
80342
|
+
};
|
|
80343
|
+
}
|
|
79432
80344
|
function memberTypeInfoForCodegen(ctx, member) {
|
|
79433
80345
|
const required = isRequiredMember(member);
|
|
79434
80346
|
if (isMemberGenericBase(member))
|
|
79435
80347
|
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
|
-
}
|
|
80348
|
+
if (isMemberTupleBase(member)) return tupleMemberTypeInfo(ctx, member);
|
|
79450
80349
|
const slotType = classSlotTypeInfo(ctx, member, required);
|
|
79451
80350
|
if (slotType !== null) return slotType;
|
|
79452
80351
|
if (isMemberLookupBase(member)) {
|
|
@@ -79491,9 +80390,12 @@ function memberTypeInfoForCodegen(ctx, member) {
|
|
|
79491
80390
|
}
|
|
79492
80391
|
if (isMemberNSPropertyBase(member)) return member.returnTypeInfo;
|
|
79493
80392
|
if (isMemberVariantBase(member)) {
|
|
80393
|
+
const lookup = member.valueTypeInfo != null;
|
|
80394
|
+
const kind = lookup ? NeoWorldSystemClassKind.LookupVariant : NeoWorldSystemClassKind.Variant;
|
|
80395
|
+
const declaration = ctx.exportData.classes[requireWorldSystemClassDefinition(kind).classId];
|
|
79494
80396
|
const systemClass = neoVariantSystemClass(
|
|
79495
|
-
|
|
79496
|
-
|
|
80397
|
+
declaration === void 0 ? [] : [declaration],
|
|
80398
|
+
lookup
|
|
79497
80399
|
);
|
|
79498
80400
|
return variantMemberDeclaredTypeInfo(member, systemClass);
|
|
79499
80401
|
}
|