@neocompose/cli 0.89.6 → 0.89.8
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 +19 -0
- package/dist/neo-runtime.mjs +818 -305
- package/dist/test-worker.mjs +657 -300
- package/package.json +1 -1
- package/skills/neocompose-cli/SKILL.md +1 -1
- package/skills/neocompose-cli/references/cli-development.md +10 -1
- package/skills/neocompose-cli/references/declarations/constructors.md +4 -0
- package/skills/neocompose-cli/references/declarations/initializers.md +9 -0
- package/skills/neocompose-cli/references/neoscript/collections.md +9 -1
package/dist/neo-runtime.mjs
CHANGED
|
@@ -19407,7 +19407,7 @@ var init_registry = __esm({
|
|
|
19407
19407
|
"../packages/manifest/schema-contract/registry.mjs"() {
|
|
19408
19408
|
"use strict";
|
|
19409
19409
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
19410
|
-
cliVersion: "0.89.
|
|
19410
|
+
cliVersion: "0.89.8",
|
|
19411
19411
|
projectFileUploadBatchSize: 32,
|
|
19412
19412
|
documentRecords: {
|
|
19413
19413
|
member: {
|
|
@@ -28481,15 +28481,7 @@ function calculateDeclarationSignature(ctx, projectionClassId, schemaKey, declar
|
|
|
28481
28481
|
declarationClassId: declaration.classDef.id,
|
|
28482
28482
|
memberId: declaration.memberId,
|
|
28483
28483
|
isAbstract: isAbstractMember(member) === true,
|
|
28484
|
-
isVirtual: isVirtualMember(member) !== false
|
|
28485
|
-
// Openness belongs to the DECLARING class, not to whoever is asking: a
|
|
28486
|
-
// descendant that closes the param still has to see a declaration it is
|
|
28487
|
-
// obliged to implement.
|
|
28488
|
-
requiresClosingImplementation: lookupDeclaredTypeInfo(member) === null ? false : lookupNarrowingAwaitsClosingBinding(
|
|
28489
|
-
ctx,
|
|
28490
|
-
member,
|
|
28491
|
-
resolveGenericEnvForEmission(ctx, declaration.classDef.id)
|
|
28492
|
-
)
|
|
28484
|
+
isVirtual: isVirtualMember(member) !== false
|
|
28493
28485
|
};
|
|
28494
28486
|
if (isCallableMemberForCodegen(member)) {
|
|
28495
28487
|
const parameterTypes = member.argumentTypes.map(
|
|
@@ -28699,7 +28691,7 @@ function generatedInstanceMemberSignaturesEqual(left, right) {
|
|
|
28699
28691
|
return false;
|
|
28700
28692
|
}
|
|
28701
28693
|
function emitsAbstractDeclaration(signature2) {
|
|
28702
|
-
return signature2.isAbstract
|
|
28694
|
+
return signature2.isAbstract;
|
|
28703
28695
|
}
|
|
28704
28696
|
function resolveGeneratedInstanceMemberPlan(ctx, classDef, schemaKey) {
|
|
28705
28697
|
const declaration = ownInstanceMemberDeclaration(classDef, schemaKey);
|
|
@@ -30892,11 +30884,6 @@ function lookupHasRuntimeOwnership(member) {
|
|
|
30892
30884
|
function lookupNarrowsThroughGenericParam(member) {
|
|
30893
30885
|
return lookupDeclaredTypeInfo(member)?.type === 21 /* Generic */;
|
|
30894
30886
|
}
|
|
30895
|
-
function lookupNarrowingAwaitsClosingBinding(ctx, member, env) {
|
|
30896
|
-
if (!lookupNarrowsThroughGenericParam(member)) return false;
|
|
30897
|
-
if (lookupProjection(ctx, member) !== "class" /* Class */) return false;
|
|
30898
|
-
return lookupTargetClassProjection(ctx, member, env) === null;
|
|
30899
|
-
}
|
|
30900
30887
|
function lookupTargetValueType(ctx, member, saved, env) {
|
|
30901
30888
|
if (!isMemberLookupBase(member)) return "NeoLookupSelection";
|
|
30902
30889
|
const targetSaved = lookupTargetSaved(ctx, member) ?? saved;
|
|
@@ -38831,7 +38818,8 @@ function blankEvaluatorIndexes(memberByValueId) {
|
|
|
38831
38818
|
return {
|
|
38832
38819
|
rowByValueReference: /* @__PURE__ */ new WeakMap(),
|
|
38833
38820
|
memberByValueId,
|
|
38834
|
-
parentLinksByChildId:
|
|
38821
|
+
parentLinksByChildId: new EvaluatorParentLinks(),
|
|
38822
|
+
placementParentLinksByChildId: /* @__PURE__ */ new Map(),
|
|
38835
38823
|
indexedRowIds: /* @__PURE__ */ new Set(),
|
|
38836
38824
|
indexedOverlayValues: /* @__PURE__ */ new Map(),
|
|
38837
38825
|
indexedOverlayRowCount: 0,
|
|
@@ -39070,8 +39058,15 @@ function evaluatorIndexes(ctx) {
|
|
|
39070
39058
|
rowByValueReference: /* @__PURE__ */ new WeakMap(),
|
|
39071
39059
|
baseRowByValueReference: base?.rowByValueReference,
|
|
39072
39060
|
memberByValueId: base?.memberByValueId ?? /* @__PURE__ */ new Map(),
|
|
39073
|
-
parentLinksByChildId:
|
|
39061
|
+
parentLinksByChildId: new EvaluatorParentLinks(),
|
|
39062
|
+
placementParentLinksByChildId: /* @__PURE__ */ new Map(),
|
|
39074
39063
|
baseParentLinksByChildId: base?.parentLinksByChildId,
|
|
39064
|
+
isSelectionRow: (row) => {
|
|
39065
|
+
const member = runtimeCollectionMember(row, ctx);
|
|
39066
|
+
if (member === null || !isMemberLookupBase(member)) return false;
|
|
39067
|
+
const direct = indexes4.memberByValueId.get(row.id);
|
|
39068
|
+
return direct === void 0 || isMemberLookupBase(direct);
|
|
39069
|
+
},
|
|
39075
39070
|
indexedRowIds: /* @__PURE__ */ new Set(),
|
|
39076
39071
|
baseIndexedRowIds: base?.indexedRowIds,
|
|
39077
39072
|
indexedOverlayValues: /* @__PURE__ */ new Map(),
|
|
@@ -39165,7 +39160,13 @@ function indexEvaluatorRow(indexes4, row, allowBaseShadow = false, sharedCachesA
|
|
|
39165
39160
|
visitEvaluatorRecordOwnershipEdges(indexes4, row, (childId, key) => {
|
|
39166
39161
|
indexes4.ownedValueAttachmentsByValueId.delete(childId);
|
|
39167
39162
|
indexes4.constructorOwnershipDirtyValueIds.add(childId);
|
|
39168
|
-
addEvaluatorParentLink(
|
|
39163
|
+
addEvaluatorParentLink(
|
|
39164
|
+
indexes4,
|
|
39165
|
+
childId,
|
|
39166
|
+
row.id,
|
|
39167
|
+
key,
|
|
39168
|
+
indexes4.isSelectionRow?.(row) === true
|
|
39169
|
+
);
|
|
39169
39170
|
});
|
|
39170
39171
|
}
|
|
39171
39172
|
function indexEvaluatorRows(indexes4, rows, allowBaseShadow = false, liveOverlayRowById) {
|
|
@@ -39214,7 +39215,13 @@ function augmentEvaluatorOwnershipEdges(indexes4, row, liveRow) {
|
|
|
39214
39215
|
if (links.some((link) => link.parentId === row.id && link.key === key)) {
|
|
39215
39216
|
return;
|
|
39216
39217
|
}
|
|
39217
|
-
addEvaluatorParentLink(
|
|
39218
|
+
addEvaluatorParentLink(
|
|
39219
|
+
indexes4,
|
|
39220
|
+
childId,
|
|
39221
|
+
row.id,
|
|
39222
|
+
key,
|
|
39223
|
+
indexes4.isSelectionRow?.(row) === true
|
|
39224
|
+
);
|
|
39218
39225
|
indexes4.ownedValueAttachmentsByValueId.delete(childId);
|
|
39219
39226
|
indexes4.constructorOwnershipDirtyValueIds.add(childId);
|
|
39220
39227
|
});
|
|
@@ -39260,12 +39267,11 @@ function unindexEvaluatorRow(indexes4, row, preserveIncomingLinks = false) {
|
|
|
39260
39267
|
indexes4.indexedRowIds.delete(row.id);
|
|
39261
39268
|
indexes4.ownedValueAttachmentsByValueId.delete(row.id);
|
|
39262
39269
|
indexes4.constructorOwnershipDirtyValueIds.delete(row.id);
|
|
39263
|
-
if (!preserveIncomingLinks)
|
|
39264
|
-
|
|
39265
|
-
|
|
39266
|
-
|
|
39267
|
-
|
|
39268
|
-
else indexes4.parentLinksByChildId.set(row.id, retained);
|
|
39270
|
+
if (!preserveIncomingLinks) {
|
|
39271
|
+
indexes4.parentLinksByChildId.delete(row.id);
|
|
39272
|
+
indexes4.placementParentLinksByChildId.delete(row.id);
|
|
39273
|
+
} else if (typeof row.containerId === "string") {
|
|
39274
|
+
removeEvaluatorParentLinks(indexes4, row.id, row.containerId, "");
|
|
39269
39275
|
}
|
|
39270
39276
|
if (typeof row.value === "object" && row.value !== null && indexes4.rowByValueReference.get(row.value) === row) {
|
|
39271
39277
|
indexes4.rowByValueReference.delete(row.value);
|
|
@@ -39282,12 +39288,7 @@ function unindexEvaluatorRow(indexes4, row, preserveIncomingLinks = false) {
|
|
|
39282
39288
|
}
|
|
39283
39289
|
}
|
|
39284
39290
|
visitEvaluatorRecordOwnershipEdges(indexes4, row, (childId) => {
|
|
39285
|
-
|
|
39286
|
-
if (links !== void 0) {
|
|
39287
|
-
const retained = links.filter((link) => link.parentId !== row.id);
|
|
39288
|
-
if (retained.length === 0) indexes4.parentLinksByChildId.delete(childId);
|
|
39289
|
-
else indexes4.parentLinksByChildId.set(childId, retained);
|
|
39290
|
-
}
|
|
39291
|
+
removeEvaluatorParentLinks(indexes4, childId, row.id);
|
|
39291
39292
|
indexes4.ownedValueAttachmentsByValueId.delete(childId);
|
|
39292
39293
|
indexes4.constructorOwnershipDirtyValueIds.add(childId);
|
|
39293
39294
|
});
|
|
@@ -39300,36 +39301,101 @@ function dropReconciledOwnershipRows(indexes4) {
|
|
|
39300
39301
|
indexes4.reconciledOwnershipRows = /* @__PURE__ */ new WeakSet();
|
|
39301
39302
|
indexes4.indexedVirtualRowSets = /* @__PURE__ */ new WeakSet();
|
|
39302
39303
|
}
|
|
39303
|
-
function addEvaluatorParentLink(indexes4, childId, parentId, key) {
|
|
39304
|
-
const
|
|
39305
|
-
|
|
39306
|
-
|
|
39304
|
+
function addEvaluatorParentLink(indexes4, childId, parentId, key, selectionOnly = false) {
|
|
39305
|
+
const placements = indexes4.placementParentLinksByChildId.get(childId);
|
|
39306
|
+
if (selectionOnly) {
|
|
39307
|
+
if (placements === void 0) {
|
|
39308
|
+
indexes4.placementParentLinksByChildId.set(childId, [
|
|
39309
|
+
...indexes4.parentLinksByChildId.get(childId) ?? []
|
|
39310
|
+
]);
|
|
39311
|
+
indexes4.parentLinksByChildId.indexParents(childId);
|
|
39312
|
+
}
|
|
39313
|
+
} else {
|
|
39314
|
+
placements?.push({ parentId, key });
|
|
39315
|
+
}
|
|
39316
|
+
indexes4.parentLinksByChildId.add(childId, { parentId, key });
|
|
39317
|
+
}
|
|
39318
|
+
function removeEvaluatorParentLinks(indexes4, childId, parentId, key) {
|
|
39319
|
+
indexes4.parentLinksByChildId.remove(childId, parentId, key);
|
|
39320
|
+
if (!indexes4.parentLinksByChildId.has(childId)) {
|
|
39321
|
+
indexes4.placementParentLinksByChildId.delete(childId);
|
|
39322
|
+
return;
|
|
39323
|
+
}
|
|
39324
|
+
const placements = indexes4.placementParentLinksByChildId.get(childId);
|
|
39325
|
+
if (placements !== void 0)
|
|
39326
|
+
indexes4.placementParentLinksByChildId.set(
|
|
39327
|
+
childId,
|
|
39328
|
+
placements.filter(
|
|
39329
|
+
(link) => link.parentId !== parentId || key !== void 0 && link.key !== key
|
|
39330
|
+
)
|
|
39331
|
+
);
|
|
39307
39332
|
}
|
|
39308
|
-
function
|
|
39333
|
+
function indexRuntimeCollectionChange(collection, entry, ctx, removedEntries = null, entryKey, change = "entry") {
|
|
39309
39334
|
const indexes4 = ctx.__indexes;
|
|
39310
39335
|
const row = indexes4?.rowByValueReference.get(collection);
|
|
39311
39336
|
if (indexes4 === void 0 || indexes4.invalidated || row === void 0 || ctx.__runtimeSessionValues?.get(row.id) !== row || !indexes4.indexedRowIds.has(row.id))
|
|
39312
39337
|
return false;
|
|
39313
|
-
if (
|
|
39314
|
-
|
|
39315
|
-
|
|
39316
|
-
|
|
39338
|
+
if (removedEntries !== null)
|
|
39339
|
+
for (const removed of removedEntries) {
|
|
39340
|
+
removeEvaluatorParentLinks(indexes4, removed, row.id, entryKey);
|
|
39341
|
+
indexes4.ownedValueAttachmentsByValueId.delete(removed);
|
|
39342
|
+
indexes4.constructorOwnershipDirtyValueIds.add(removed);
|
|
39343
|
+
}
|
|
39344
|
+
const addEdge = (childId, key) => {
|
|
39345
|
+
addEvaluatorParentLink(
|
|
39346
|
+
indexes4,
|
|
39347
|
+
childId,
|
|
39348
|
+
row.id,
|
|
39349
|
+
key,
|
|
39350
|
+
indexes4.isSelectionRow?.(row) === true
|
|
39351
|
+
);
|
|
39352
|
+
indexes4.ownedValueAttachmentsByValueId.delete(childId);
|
|
39353
|
+
indexes4.constructorOwnershipDirtyValueIds.add(childId);
|
|
39354
|
+
};
|
|
39355
|
+
if (typeof entry === "string") addEdge(entry, entryKey ?? "");
|
|
39356
|
+
else if (change === "contents")
|
|
39357
|
+
visitEvaluatorRecordOwnershipEdges(indexes4, row, addEdge);
|
|
39358
|
+
if (typeof entry === "string" || removedEntries !== null && removedEntries.length > 0) {
|
|
39317
39359
|
indexes4.ownershipRootIdsByRowId.clear();
|
|
39318
39360
|
indexes4.ownershipDistancesByRowId.clear();
|
|
39319
39361
|
indexes4.memberByRowId.clear();
|
|
39320
39362
|
}
|
|
39321
|
-
forgetLocalListIndexes(ctx, collection);
|
|
39363
|
+
if (Array.isArray(collection)) forgetLocalListIndexes(ctx, collection);
|
|
39322
39364
|
markOverlayMutated(ctx, collection);
|
|
39323
39365
|
if (ctx.__valueOverlay instanceof LazyValueOverlay)
|
|
39324
39366
|
indexes4.overlayRevision = ctx.__valueOverlay.revision;
|
|
39325
39367
|
return true;
|
|
39326
39368
|
}
|
|
39327
|
-
function
|
|
39369
|
+
function indexRuntimeCollectionEntryWrite(collection, previous, value, key, ctx) {
|
|
39370
|
+
if (!Array.isArray(collection))
|
|
39371
|
+
return indexRuntimeCollectionChange(
|
|
39372
|
+
collection,
|
|
39373
|
+
value,
|
|
39374
|
+
ctx,
|
|
39375
|
+
typeof previous === "string" ? [previous] : [],
|
|
39376
|
+
String(key)
|
|
39377
|
+
);
|
|
39378
|
+
if (typeof previous !== "string" && typeof value !== "string")
|
|
39379
|
+
return indexRuntimeCollectionChange(collection, void 0, ctx);
|
|
39380
|
+
const edges = collection.filter(
|
|
39381
|
+
(entry) => typeof entry === "string"
|
|
39382
|
+
);
|
|
39383
|
+
if (typeof previous === "string") edges.push(previous);
|
|
39384
|
+
return indexRuntimeCollectionChange(
|
|
39385
|
+
collection,
|
|
39386
|
+
void 0,
|
|
39387
|
+
ctx,
|
|
39388
|
+
edges,
|
|
39389
|
+
void 0,
|
|
39390
|
+
"contents"
|
|
39391
|
+
);
|
|
39392
|
+
}
|
|
39393
|
+
function evaluatorParentLinks(indexes4, childId, placementOnly = false) {
|
|
39328
39394
|
const unfilteredBase = indexes4.baseParentLinksByChildId?.get(childId) ?? [];
|
|
39329
39395
|
const base = indexes4.shadowedBaseRowIds.size === 0 ? unfilteredBase : unfilteredBase.filter(
|
|
39330
39396
|
(link) => !indexes4.shadowedBaseRowIds.has(link.parentId)
|
|
39331
39397
|
);
|
|
39332
|
-
const local = indexes4.parentLinksByChildId.get(childId) ?? [];
|
|
39398
|
+
const local = (placementOnly ? indexes4.placementParentLinksByChildId.get(childId) : void 0) ?? indexes4.parentLinksByChildId.get(childId) ?? [];
|
|
39333
39399
|
if (base.length === 0) return local;
|
|
39334
39400
|
if (local.length === 0) return base;
|
|
39335
39401
|
return [...base, ...local];
|
|
@@ -40252,6 +40318,7 @@ function withEvaluationRuntime(ctx, writes) {
|
|
|
40252
40318
|
ctx.__setEntryIndexes ??= /* @__PURE__ */ new WeakMap();
|
|
40253
40319
|
ctx.__runtimeSets ??= /* @__PURE__ */ new WeakMap();
|
|
40254
40320
|
ctx.__collectionElementTypes ??= /* @__PURE__ */ new WeakMap();
|
|
40321
|
+
ctx.__runtimeCollectionMembers ??= /* @__PURE__ */ new WeakMap();
|
|
40255
40322
|
ctx.__dirtyRuntimeSets ??= /* @__PURE__ */ new Set();
|
|
40256
40323
|
ctx.__runtimeClassOverrides ??= /* @__PURE__ */ new Map();
|
|
40257
40324
|
ctx.__getterSubscriptions ??= getterSubscriptionsFor(ctx);
|
|
@@ -40289,6 +40356,7 @@ function withEvaluationRuntime(ctx, writes) {
|
|
|
40289
40356
|
__setEntryIndexes: ctx.__setEntryIndexes ?? /* @__PURE__ */ new WeakMap(),
|
|
40290
40357
|
__runtimeSets: ctx.__runtimeSets ?? /* @__PURE__ */ new WeakMap(),
|
|
40291
40358
|
__collectionElementTypes: ctx.__collectionElementTypes ?? /* @__PURE__ */ new WeakMap(),
|
|
40359
|
+
__runtimeCollectionMembers: ctx.__runtimeCollectionMembers ?? /* @__PURE__ */ new WeakMap(),
|
|
40292
40360
|
__tupleHandleIdentity: ctx.__tupleHandleIdentity ??= new TupleHandleIdentity(),
|
|
40293
40361
|
__dirtyRuntimeSets: ctx.__dirtyRuntimeSets ?? /* @__PURE__ */ new Set(),
|
|
40294
40362
|
__runtimeReferenceRemap: referenceRemap,
|
|
@@ -40750,11 +40818,10 @@ function remapRuntimeReferences(value, overlay2, seen, preservedReferences) {
|
|
|
40750
40818
|
const next = {};
|
|
40751
40819
|
seen.set(value, next);
|
|
40752
40820
|
for (const [key, entry] of Object.entries(value)) {
|
|
40753
|
-
|
|
40754
|
-
|
|
40755
|
-
|
|
40756
|
-
seen,
|
|
40757
|
-
preservedReferences
|
|
40821
|
+
setOwnField(
|
|
40822
|
+
next,
|
|
40823
|
+
key,
|
|
40824
|
+
remapRuntimeReferences(entry, overlay2, seen, preservedReferences)
|
|
40758
40825
|
);
|
|
40759
40826
|
}
|
|
40760
40827
|
return next;
|
|
@@ -41733,7 +41800,8 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
41733
41800
|
target.pointer,
|
|
41734
41801
|
scope,
|
|
41735
41802
|
ctx,
|
|
41736
|
-
destination
|
|
41803
|
+
destination,
|
|
41804
|
+
value
|
|
41737
41805
|
);
|
|
41738
41806
|
const through = genericSlotReference(
|
|
41739
41807
|
member,
|
|
@@ -41757,7 +41825,8 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
41757
41825
|
target.pointer,
|
|
41758
41826
|
scope,
|
|
41759
41827
|
ctx,
|
|
41760
|
-
destination
|
|
41828
|
+
destination,
|
|
41829
|
+
value
|
|
41761
41830
|
);
|
|
41762
41831
|
}
|
|
41763
41832
|
if (target.structuredLeafKind !== void 0 && destination !== void 0)
|
|
@@ -41774,6 +41843,11 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
41774
41843
|
ctx
|
|
41775
41844
|
);
|
|
41776
41845
|
const lookupMember = member !== null && isMemberLookup(member) ? member : null;
|
|
41846
|
+
const inlineReferenceValue = lookupMember !== null && target.pointer.type === "keyOf" /* keyOf */ && target.pointer.memberId === void 0 && destination !== void 0 && materializedCollectionEntryId(
|
|
41847
|
+
destination.receiver,
|
|
41848
|
+
destination.key,
|
|
41849
|
+
ctx
|
|
41850
|
+
) === null ? { value } : void 0;
|
|
41777
41851
|
if (lookupMember !== null) {
|
|
41778
41852
|
materializeReferencedSlots(value, ctx);
|
|
41779
41853
|
const holder = destination === void 0 ? null : trackedRowForValueReference(destination.receiver, ctx);
|
|
@@ -41830,7 +41904,8 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
41830
41904
|
value,
|
|
41831
41905
|
scope,
|
|
41832
41906
|
ctx,
|
|
41833
|
-
destination
|
|
41907
|
+
destination,
|
|
41908
|
+
inlineReferenceValue
|
|
41834
41909
|
);
|
|
41835
41910
|
}
|
|
41836
41911
|
const unorderedReplacement = assignedReferenceValueId === null && member !== null && isMemberEntryCollectionBase(member) && listKindOf(member) === 1 /* Unordered */ && Array.isArray(value) ? unorderedReplacementProjection(
|
|
@@ -42504,7 +42579,7 @@ function validateStructuredFieldAssignment(kind, field, value) {
|
|
|
42504
42579
|
{ errorClassId: NEO_ERROR_CLASS_IDS.NeoArgumentError }
|
|
42505
42580
|
);
|
|
42506
42581
|
}
|
|
42507
|
-
function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, destination) {
|
|
42582
|
+
function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, destination, inlineReferenceValue) {
|
|
42508
42583
|
if (target.type === "staticMember" /* staticMember */) {
|
|
42509
42584
|
if (ctx.storedConstructionReplay === true) {
|
|
42510
42585
|
throw new NSGetterRuntimeError(
|
|
@@ -42536,8 +42611,32 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
42536
42611
|
"assignment target",
|
|
42537
42612
|
reattachesReplaySlot ? void 0 : key
|
|
42538
42613
|
);
|
|
42614
|
+
if (inlineReferenceValue !== void 0) {
|
|
42615
|
+
const entryId = trackInsertedCollection(
|
|
42616
|
+
inlineReferenceValue.value,
|
|
42617
|
+
targetTypeInfo,
|
|
42618
|
+
receiver,
|
|
42619
|
+
ctx
|
|
42620
|
+
);
|
|
42621
|
+
if (entryId !== null) {
|
|
42622
|
+
const collection = Array.isArray(receiver) ? receiver : objectArg(receiver, "Assignment target");
|
|
42623
|
+
const entryKey = typeof key === "number" ? key : String(key);
|
|
42624
|
+
setOwnField(collection, String(entryKey), entryId);
|
|
42625
|
+
recordWrittenEntry(collection, entryKey, true, ctx);
|
|
42626
|
+
if (!indexRuntimeCollectionChange(
|
|
42627
|
+
collection,
|
|
42628
|
+
entryId,
|
|
42629
|
+
ctx,
|
|
42630
|
+
null,
|
|
42631
|
+
Array.isArray(collection) ? void 0 : String(entryKey)
|
|
42632
|
+
))
|
|
42633
|
+
invalidateEvaluatorIndexes(ctx, receiver);
|
|
42634
|
+
return;
|
|
42635
|
+
}
|
|
42636
|
+
}
|
|
42539
42637
|
if (Array.isArray(receiver)) {
|
|
42540
42638
|
const index = numberArg(key, "List assignment index");
|
|
42639
|
+
const previous2 = receiver[index];
|
|
42541
42640
|
if (referenceValueId !== null) {
|
|
42542
42641
|
const parentId = findKnownRowIdByValueReference(receiver, ctx);
|
|
42543
42642
|
if (parentId !== null) {
|
|
@@ -42561,10 +42660,17 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
42561
42660
|
}
|
|
42562
42661
|
receiver[index] = referenceValueId;
|
|
42563
42662
|
recordWrittenEntry(receiver, index, true, ctx);
|
|
42564
|
-
|
|
42663
|
+
if (!indexRuntimeCollectionEntryWrite(
|
|
42664
|
+
receiver,
|
|
42665
|
+
previous2,
|
|
42666
|
+
referenceValueId,
|
|
42667
|
+
index,
|
|
42668
|
+
ctx
|
|
42669
|
+
))
|
|
42670
|
+
invalidateEvaluatorIndexes(ctx, receiver);
|
|
42565
42671
|
return;
|
|
42566
42672
|
}
|
|
42567
|
-
if (collectionReferences(receiver, ctx)
|
|
42673
|
+
if (isReferenceEntry(collectionReferences(receiver, ctx), index) && replaceEntryRowValue(
|
|
42568
42674
|
receiver,
|
|
42569
42675
|
receiver[index],
|
|
42570
42676
|
value,
|
|
@@ -42574,11 +42680,13 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
42574
42680
|
return;
|
|
42575
42681
|
receiver[index] = value;
|
|
42576
42682
|
recordWrittenEntry(receiver, index, false, ctx);
|
|
42577
|
-
|
|
42683
|
+
if (!indexRuntimeCollectionEntryWrite(receiver, previous2, value, index, ctx))
|
|
42684
|
+
invalidateEvaluatorIndexes(ctx, receiver);
|
|
42578
42685
|
return;
|
|
42579
42686
|
}
|
|
42580
42687
|
const object2 = objectArg(receiver, "Assignment target");
|
|
42581
42688
|
const stringKey = String(key);
|
|
42689
|
+
const previous = object2[stringKey];
|
|
42582
42690
|
const field = target.memberId !== void 0;
|
|
42583
42691
|
if (field && isTypeInfoWithEntries(targetTypeInfo)) {
|
|
42584
42692
|
const slot = collectionSlotRow(target, { receiver, key }, ctx);
|
|
@@ -42609,18 +42717,27 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
42609
42717
|
);
|
|
42610
42718
|
noteDetachedRow(object2[stringKey], referenceValueId, ctx);
|
|
42611
42719
|
}
|
|
42612
|
-
object2
|
|
42720
|
+
setOwnField(object2, stringKey, referenceValueId);
|
|
42613
42721
|
if (!field) recordWrittenEntry(object2, stringKey, true, ctx);
|
|
42614
|
-
|
|
42722
|
+
if (field || !indexRuntimeCollectionEntryWrite(
|
|
42723
|
+
object2,
|
|
42724
|
+
previous,
|
|
42725
|
+
referenceValueId,
|
|
42726
|
+
stringKey,
|
|
42727
|
+
ctx
|
|
42728
|
+
))
|
|
42729
|
+
invalidateEvaluatorIndexes(ctx, receiver);
|
|
42615
42730
|
return;
|
|
42616
42731
|
}
|
|
42617
|
-
if (collectionReferences(object2, ctx)
|
|
42732
|
+
if (isReferenceEntry(collectionReferences(object2, ctx), stringKey) && replaceEntryRowValue(object2, object2[stringKey], value, targetTypeInfo, ctx))
|
|
42618
42733
|
return;
|
|
42619
42734
|
if (field && (targetTypeInfo.type === 7 /* Class */ || targetTypeInfo.type === 22 /* Interface */))
|
|
42620
42735
|
noteDetachedRow(object2[stringKey], value, ctx);
|
|
42621
|
-
object2
|
|
42736
|
+
setOwnField(object2, stringKey, value);
|
|
42622
42737
|
if (!field) recordWrittenEntry(object2, stringKey, false, ctx);
|
|
42623
|
-
|
|
42738
|
+
const scalarField = (previous == null || typeof previous === "number" || typeof previous === "boolean" || typeof previous === "string") && (value == null || typeof value === "number" || typeof value === "boolean" || typeof value === "string");
|
|
42739
|
+
if (field && !scalarField || !indexRuntimeCollectionEntryWrite(object2, previous, value, stringKey, ctx))
|
|
42740
|
+
invalidateEvaluatorIndexes(ctx, receiver);
|
|
42624
42741
|
}
|
|
42625
42742
|
function keptCollectionSlotValue(target, targetTypeInfo, destination, value, ctx) {
|
|
42626
42743
|
const sourceId3 = findKnownRowIdByValueReference(value, ctx);
|
|
@@ -42698,7 +42815,7 @@ function copiedCollectionContents(source, entryTypeInfo, slotId, ctx) {
|
|
|
42698
42815
|
}
|
|
42699
42816
|
}
|
|
42700
42817
|
if (Array.isArray(copy)) copy.push(entry);
|
|
42701
|
-
else copy
|
|
42818
|
+
else setOwnField(copy, String(key), entry);
|
|
42702
42819
|
return 0 /* Continue */;
|
|
42703
42820
|
});
|
|
42704
42821
|
const cache = unorderedListProjectionCache(ctx);
|
|
@@ -42767,107 +42884,6 @@ function keepAssignedCollectionValues(value, targetTypeInfo, row, ctx) {
|
|
|
42767
42884
|
return 0 /* Continue */;
|
|
42768
42885
|
});
|
|
42769
42886
|
}
|
|
42770
|
-
function pendingConstructorRootsForRow(valueId, ctx) {
|
|
42771
|
-
const roots = /* @__PURE__ */ new Set();
|
|
42772
|
-
const open2 = ctx.__executionState?.openConstructions;
|
|
42773
|
-
if (open2 === void 0 || open2.size === 0) return roots;
|
|
42774
|
-
const visited = /* @__PURE__ */ new Set();
|
|
42775
|
-
const pending = [valueId];
|
|
42776
|
-
const parentEntries = /* @__PURE__ */ new Map();
|
|
42777
|
-
const placingMembers = /* @__PURE__ */ new Map();
|
|
42778
|
-
while (pending.length > 0) {
|
|
42779
|
-
const id2 = pending.pop();
|
|
42780
|
-
if (id2 === void 0 || visited.has(id2)) continue;
|
|
42781
|
-
visited.add(id2);
|
|
42782
|
-
const row = evalValueById(
|
|
42783
|
-
ctx,
|
|
42784
|
-
id2,
|
|
42785
|
-
ctx.__runtimeSessionValues,
|
|
42786
|
-
ctx.__valueOverlay
|
|
42787
|
-
);
|
|
42788
|
-
if (row === null) continue;
|
|
42789
|
-
if (typeof row.value === "object" && row.value !== null && open2.has(row.value))
|
|
42790
|
-
roots.add(id2);
|
|
42791
|
-
for (const owner of currentOwnedValueAttachments(
|
|
42792
|
-
id2,
|
|
42793
|
-
ctx,
|
|
42794
|
-
parentEntries,
|
|
42795
|
-
placingMembers
|
|
42796
|
-
)) {
|
|
42797
|
-
if (!owner.identity.startsWith("value:")) continue;
|
|
42798
|
-
const parent = evalValueById(
|
|
42799
|
-
ctx,
|
|
42800
|
-
owner.label,
|
|
42801
|
-
ctx.__runtimeSessionValues,
|
|
42802
|
-
ctx.__valueOverlay
|
|
42803
|
-
);
|
|
42804
|
-
if (parent === null) continue;
|
|
42805
|
-
if (parent.classId === void 0 || parent.classId === null) {
|
|
42806
|
-
const raw = placingMember(
|
|
42807
|
-
parent,
|
|
42808
|
-
ctx,
|
|
42809
|
-
void 0,
|
|
42810
|
-
0,
|
|
42811
|
-
placingMembers,
|
|
42812
|
-
parentEntries
|
|
42813
|
-
);
|
|
42814
|
-
if (raw === null) continue;
|
|
42815
|
-
const member = raw.kind === 21 /* Generic */ ? substituteMember(raw, rowGenericEnv(parent, ctx), ctx.vm.members) : resolveMember(raw, ctx.vm.members);
|
|
42816
|
-
if (isMemberWithEntries(member)) {
|
|
42817
|
-
const rawEntry = evalMemberById(ctx.vm, member.entryMemberId);
|
|
42818
|
-
if (rawEntry === null) continue;
|
|
42819
|
-
const entry = rawEntry.kind === 21 /* Generic */ ? substituteMember(
|
|
42820
|
-
rawEntry,
|
|
42821
|
-
rowGenericEnv(parent, ctx),
|
|
42822
|
-
ctx.vm.members
|
|
42823
|
-
) : resolveMember(rawEntry, ctx.vm.members);
|
|
42824
|
-
if (entry.kind === 21 /* Generic */ || isMemberLookupBase(entry))
|
|
42825
|
-
continue;
|
|
42826
|
-
}
|
|
42827
|
-
}
|
|
42828
|
-
pending.push(owner.label);
|
|
42829
|
-
}
|
|
42830
|
-
for (const link of evaluatorParentLinks(evaluatorIndexes(ctx), id2)) {
|
|
42831
|
-
const parent = evalValueById(
|
|
42832
|
-
ctx,
|
|
42833
|
-
link.parentId,
|
|
42834
|
-
ctx.__runtimeSessionValues,
|
|
42835
|
-
ctx.__valueOverlay
|
|
42836
|
-
);
|
|
42837
|
-
if (parent === null || !Array.isArray(parent.value)) continue;
|
|
42838
|
-
const member = placingMember(
|
|
42839
|
-
parent,
|
|
42840
|
-
ctx,
|
|
42841
|
-
void 0,
|
|
42842
|
-
0,
|
|
42843
|
-
placingMembers,
|
|
42844
|
-
parentEntries
|
|
42845
|
-
);
|
|
42846
|
-
if (member === null || !isMemberTupleBase(member)) continue;
|
|
42847
|
-
const positions = ownershipParentEntryKeys(
|
|
42848
|
-
parent.value,
|
|
42849
|
-
id2,
|
|
42850
|
-
parentEntries
|
|
42851
|
-
);
|
|
42852
|
-
for (const position of positions ?? []) {
|
|
42853
|
-
if (typeof position !== "number") continue;
|
|
42854
|
-
const entryId = member.elementMemberIds[position];
|
|
42855
|
-
const rawEntry = entryId === void 0 ? null : evalMemberById(ctx.vm, entryId);
|
|
42856
|
-
if (rawEntry === null) continue;
|
|
42857
|
-
const entry = rawEntry.kind === 21 /* Generic */ ? substituteMember(
|
|
42858
|
-
rawEntry,
|
|
42859
|
-
rowGenericEnv(parent, ctx),
|
|
42860
|
-
ctx.vm.members
|
|
42861
|
-
) : resolveMember(rawEntry, ctx.vm.members);
|
|
42862
|
-
if (entry.kind === 21 /* Generic */ || isMemberLookupBase(entry))
|
|
42863
|
-
continue;
|
|
42864
|
-
pending.push(parent.id);
|
|
42865
|
-
break;
|
|
42866
|
-
}
|
|
42867
|
-
}
|
|
42868
|
-
}
|
|
42869
|
-
return roots;
|
|
42870
|
-
}
|
|
42871
42887
|
function preflightAssignedCollection(collection, member, row, ctx) {
|
|
42872
42888
|
if (member === null) return;
|
|
42873
42889
|
const env = rowGenericEnv(row, ctx);
|
|
@@ -42880,8 +42896,6 @@ function preflightAssignedCollection(collection, member, row, ctx) {
|
|
|
42880
42896
|
const attached = /* @__PURE__ */ new Set();
|
|
42881
42897
|
const preflight = {
|
|
42882
42898
|
parentEntries: /* @__PURE__ */ new Map(),
|
|
42883
|
-
constructorRootIds: pendingConstructorRootsForRow(row.id, ctx),
|
|
42884
|
-
constructorArgumentTransfers: /* @__PURE__ */ new Map(),
|
|
42885
42899
|
dependencies: /* @__PURE__ */ new Map()
|
|
42886
42900
|
};
|
|
42887
42901
|
forEachRawCollectionEntry(collection, ctx, ({ raw, key, valueId }) => {
|
|
@@ -42904,8 +42918,6 @@ function preflightAssignedCollection(collection, member, row, ctx) {
|
|
|
42904
42918
|
);
|
|
42905
42919
|
return 0 /* Continue */;
|
|
42906
42920
|
});
|
|
42907
|
-
for (const [id2, destination] of preflight.constructorArgumentTransfers)
|
|
42908
|
-
ctx.__executionState?.ownedValueAttachments.set(id2, destination);
|
|
42909
42921
|
for (const [id2, destination] of preflight.dependencies)
|
|
42910
42922
|
recordConstructorGroupDependency(id2, destination, ctx);
|
|
42911
42923
|
}
|
|
@@ -43534,7 +43546,22 @@ function validateAssignmentTarget(target, scope, ctx, destination) {
|
|
|
43534
43546
|
}
|
|
43535
43547
|
return resolved;
|
|
43536
43548
|
}
|
|
43537
|
-
function
|
|
43549
|
+
function materializedCollectionEntryId(receiver, key, ctx) {
|
|
43550
|
+
if (typeof receiver !== "object" || receiver === null) return null;
|
|
43551
|
+
const entryKey = typeof key === "number" ? key : String(key);
|
|
43552
|
+
if (!Object.prototype.hasOwnProperty.call(receiver, entryKey)) return null;
|
|
43553
|
+
const raw = Reflect.get(receiver, String(entryKey));
|
|
43554
|
+
if (typeof raw !== "string") return null;
|
|
43555
|
+
if (!isReferenceEntry(collectionReferences(receiver, ctx), entryKey))
|
|
43556
|
+
return null;
|
|
43557
|
+
return evalValueById(
|
|
43558
|
+
ctx,
|
|
43559
|
+
raw,
|
|
43560
|
+
ctx.__runtimeSessionValues,
|
|
43561
|
+
ctx.__valueOverlay
|
|
43562
|
+
) === null ? null : raw;
|
|
43563
|
+
}
|
|
43564
|
+
function assignmentTargetMember(target, scope, ctx, destination, value) {
|
|
43538
43565
|
if (target.type === "keyOf" /* keyOf */) {
|
|
43539
43566
|
const receiver = destination === void 0 ? evalPointer(target.keyOf.pointer, scope, ctx) : destination.receiver;
|
|
43540
43567
|
const key = destination === void 0 ? evalPointer(target.keyOf.key, scope, ctx) : destination.key;
|
|
@@ -43544,6 +43571,12 @@ function assignmentTargetMember(target, scope, ctx, destination) {
|
|
|
43544
43571
|
ctx
|
|
43545
43572
|
);
|
|
43546
43573
|
if (runtimeMember2 !== null) return runtimeMember2;
|
|
43574
|
+
const raw = typeof receiver === "object" && receiver !== null ? Reflect.get(receiver, String(key)) : void 0;
|
|
43575
|
+
if (target.memberId === void 0 && typeof receiver === "object" && receiver !== null && (materializedCollectionEntryId(receiver, key, ctx) !== null || typeof raw !== "string" && findKnownRowIdByValueReference(value, ctx) !== null)) {
|
|
43576
|
+
const contract = storedCollectionEntryContract(receiver, ctx);
|
|
43577
|
+
if (contract !== null && isMemberLookupBase(contract.member))
|
|
43578
|
+
return { ...contract.entry, ...contract.member };
|
|
43579
|
+
}
|
|
43547
43580
|
}
|
|
43548
43581
|
if ((target.type === "keyOf" /* keyOf */ || target.type === "staticMember" /* staticMember */) && target.memberId !== void 0) {
|
|
43549
43582
|
const member = evalMemberById(ctx.vm, target.memberId);
|
|
@@ -43816,14 +43849,17 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
43816
43849
|
return;
|
|
43817
43850
|
}
|
|
43818
43851
|
validateCollectionMutation(targetValue, ins.mutation, args);
|
|
43852
|
+
let insertedReferenceRowId = null;
|
|
43819
43853
|
if (!isLookupSet && entryArgumentIndex !== null && (ins.mutation === "Add" /* Add */ || ins.mutation === "Insert" /* Insert */) && findKnownRowIdByValueReference(targetValue, ctx) !== null)
|
|
43820
|
-
trackInsertedCollection(
|
|
43854
|
+
insertedReferenceRowId = trackInsertedCollection(
|
|
43821
43855
|
args[entryArgumentIndex],
|
|
43822
43856
|
collectionEntryWriteType(ins.target.typeInfo, targetValue, ctx),
|
|
43823
43857
|
targetValue,
|
|
43824
43858
|
ctx
|
|
43825
43859
|
);
|
|
43826
43860
|
const overlayArgs = [...args];
|
|
43861
|
+
let removedReferenceRowId = null;
|
|
43862
|
+
let referenceRemoval = false;
|
|
43827
43863
|
if ((ins.mutation === "Add" /* Add */ || ins.mutation === "Remove" /* Remove */) && isArrayCollection(targetValue)) {
|
|
43828
43864
|
if (setMatch !== null) overlayArgs[0] = setMatch.entry;
|
|
43829
43865
|
else if (isLookupSet)
|
|
@@ -43839,12 +43875,32 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
43839
43875
|
} else if (ins.mutation === "Add" /* Add */ && !isArrayCollection(targetValue)) {
|
|
43840
43876
|
overlayArgs[1] = findKnownRowIdByValueReference(args[1], ctx) ?? args[1];
|
|
43841
43877
|
}
|
|
43878
|
+
if (ins.mutation === "Remove" /* Remove */ && Array.isArray(targetValue) && !isLookupSet && setEntryMember === null) {
|
|
43879
|
+
const contract = storedCollectionEntryContract(targetValue, ctx);
|
|
43880
|
+
if (contract !== null && isMemberLookupBase(contract.member)) {
|
|
43881
|
+
referenceRemoval = isMultiSelectionMember(contract.member) !== true;
|
|
43882
|
+
const references = collectionReferences(targetValue, ctx);
|
|
43883
|
+
const index = targetValue.findIndex(
|
|
43884
|
+
(entry, index2) => referenceEqual(
|
|
43885
|
+
isReferenceEntry(references, index2) ? resolveValueIfId(entry, ctx) : entry,
|
|
43886
|
+
args[0],
|
|
43887
|
+
ctx
|
|
43888
|
+
)
|
|
43889
|
+
);
|
|
43890
|
+
if (index >= 0 && typeof targetValue[index] === "string") {
|
|
43891
|
+
removedReferenceRowId = targetValue[index];
|
|
43892
|
+
overlayArgs[0] = removedReferenceRowId;
|
|
43893
|
+
}
|
|
43894
|
+
}
|
|
43895
|
+
}
|
|
43896
|
+
if (insertedReferenceRowId !== null && entryArgumentIndex !== null)
|
|
43897
|
+
overlayArgs[entryArgumentIndex] = insertedReferenceRowId;
|
|
43842
43898
|
const unorderedEntriesBeforeMutation = unorderedContainerValueId === null || !Array.isArray(targetValue) || ins.mutation === "Add" /* Add */ ? null : [...targetValue];
|
|
43843
43899
|
const writesEntry = (ins.mutation === "Add" /* Add */ || ins.mutation === "Insert" /* Insert */) && !isLookupSet;
|
|
43844
43900
|
let attachedValueId = null;
|
|
43845
43901
|
if (writesEntry) {
|
|
43846
43902
|
const attachedValue = isArrayCollection(targetValue) && ins.mutation !== "Insert" /* Insert */ ? args[0] : args[1];
|
|
43847
|
-
attachedValueId = findKnownRowIdByValueReference(attachedValue, ctx);
|
|
43903
|
+
attachedValueId = insertedReferenceRowId ?? findKnownRowIdByValueReference(attachedValue, ctx);
|
|
43848
43904
|
const parentId = findKnownRowIdByValueReference(targetValue, ctx);
|
|
43849
43905
|
if (attachedValueId !== null && parentId !== null) {
|
|
43850
43906
|
assertInterfaceWriteAdmits(
|
|
@@ -43873,14 +43929,51 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
43873
43929
|
);
|
|
43874
43930
|
}
|
|
43875
43931
|
}
|
|
43876
|
-
if (ins.mutation === "Add" /* Add */ && isArrayCollection(targetValue) && unorderedContainerValueId !== null && !isLookupSet && findKnownRowIdByValueReference(args[0], ctx) === null) {
|
|
43932
|
+
if (ins.mutation === "Add" /* Add */ && isArrayCollection(targetValue) && unorderedContainerValueId !== null && !isLookupSet && insertedReferenceRowId === null && findKnownRowIdByValueReference(args[0], ctx) === null) {
|
|
43877
43933
|
overlayArgs[0] = createUnorderedScalarProjectionEntry(
|
|
43878
43934
|
unorderedContainerValueId,
|
|
43879
43935
|
args[0] instanceof NSSlotReference ? [args[0].targetId] : args[0],
|
|
43880
43936
|
ctx
|
|
43881
43937
|
);
|
|
43882
43938
|
}
|
|
43883
|
-
const removableRowIds = isLookupSet
|
|
43939
|
+
const removableRowIds = isLookupSet ? null : removableEntryRowIds(targetValue, ins.mutation, overlayArgs, ctx);
|
|
43940
|
+
let previousEdges = null;
|
|
43941
|
+
if (ins.mutation !== "Add" /* Add */ && ins.mutation !== "Insert" /* Insert */) {
|
|
43942
|
+
const contents = targetValue instanceof RuntimeSet ? targetValue.source : targetValue;
|
|
43943
|
+
const entries = Array.isArray(contents) ? contents : Object.values(objectArg(contents, "collection mutation target"));
|
|
43944
|
+
previousEdges = entries.filter(
|
|
43945
|
+
(entry) => typeof entry === "string"
|
|
43946
|
+
);
|
|
43947
|
+
}
|
|
43948
|
+
const removedMembers = removableRowIds === null ? null : /* @__PURE__ */ new Map();
|
|
43949
|
+
for (const [, id2] of removableRowIds ?? []) {
|
|
43950
|
+
if (ins.mutation === "Remove" /* Remove */ && Array.isArray(targetValue) && id2 !== overlayArgs[0])
|
|
43951
|
+
continue;
|
|
43952
|
+
const row = evalValueById(
|
|
43953
|
+
ctx,
|
|
43954
|
+
id2,
|
|
43955
|
+
ctx.__runtimeSessionValues,
|
|
43956
|
+
ctx.__valueOverlay
|
|
43957
|
+
);
|
|
43958
|
+
if (row === null) continue;
|
|
43959
|
+
const placed = memberForValueRow(row, ctx);
|
|
43960
|
+
if (placed === null) continue;
|
|
43961
|
+
const member = {
|
|
43962
|
+
...placed,
|
|
43963
|
+
...substituteMember(placed, rowGenericEnv(row, ctx), ctx.vm.members)
|
|
43964
|
+
};
|
|
43965
|
+
if (isMemberEntryCollectionBase(member) || isMemberDictionaryBase(member))
|
|
43966
|
+
removedMembers?.set(id2, {
|
|
43967
|
+
row,
|
|
43968
|
+
contract: {
|
|
43969
|
+
member,
|
|
43970
|
+
members: ctx.vm.members,
|
|
43971
|
+
classes: ctx.vm.classes,
|
|
43972
|
+
bindings: row.genericBindings === void 0 ? void 0 : { ...row.genericBindings }
|
|
43973
|
+
}
|
|
43974
|
+
});
|
|
43975
|
+
}
|
|
43976
|
+
const replacedEntry = writesEntry && dictionary && isPlainRecord(targetValue) ? Reflect.get(targetValue, String(args[0])) : null;
|
|
43884
43977
|
const previousSetSize = targetValue instanceof RuntimeSet ? targetValue.size : null;
|
|
43885
43978
|
const removedIndex = applyLocalCollectionMutation(
|
|
43886
43979
|
targetValue,
|
|
@@ -43889,7 +43982,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
43889
43982
|
ctx,
|
|
43890
43983
|
isLookupSet,
|
|
43891
43984
|
ins.reference !== true && ins.mutation === "Remove" /* Remove */ && isArrayCollection(targetValue) && setEntryMember === null && !isLookupSet && findKnownRowIdByValueReference(args[0], ctx) === null,
|
|
43892
|
-
ins.reference === true,
|
|
43985
|
+
ins.reference === true || referenceRemoval || removedReferenceRowId !== null,
|
|
43893
43986
|
setEntryMember === null && decimalEntries
|
|
43894
43987
|
);
|
|
43895
43988
|
updateCollectionReferenceProvenance(
|
|
@@ -43901,8 +43994,12 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
43901
43994
|
if (removableRowIds !== null) {
|
|
43902
43995
|
const key = Array.isArray(targetValue) ? removedIndex : String(args[0]);
|
|
43903
43996
|
for (const [entryKey, rowId] of removableRowIds) {
|
|
43904
|
-
if (ins.mutation === "Clear" /* Clear */ || entryKey === key)
|
|
43997
|
+
if (ins.mutation === "Clear" /* Clear */ || entryKey === key) {
|
|
43905
43998
|
noteDetachedRow(rowId, null, ctx);
|
|
43999
|
+
const known = removedMembers?.get(rowId);
|
|
44000
|
+
if (known !== void 0)
|
|
44001
|
+
ctx.__runtimeCollectionMembers?.set(known.row, known.contract);
|
|
44002
|
+
}
|
|
43906
44003
|
}
|
|
43907
44004
|
}
|
|
43908
44005
|
if (writesEntry && !(targetValue instanceof RuntimeSet)) {
|
|
@@ -43964,7 +44061,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
43964
44061
|
targetValue.reference,
|
|
43965
44062
|
ctx
|
|
43966
44063
|
);
|
|
43967
|
-
indexedAppend =
|
|
44064
|
+
indexedAppend = indexRuntimeCollectionChange(
|
|
43968
44065
|
targetValue.source,
|
|
43969
44066
|
overlayArgs[0],
|
|
43970
44067
|
ctx
|
|
@@ -43974,6 +44071,34 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
43974
44071
|
exportRuntimeSetValue(targetValue, ctx);
|
|
43975
44072
|
}
|
|
43976
44073
|
}
|
|
44074
|
+
if (writesEntry && !(targetValue instanceof RuntimeSet)) {
|
|
44075
|
+
if (Array.isArray(targetValue))
|
|
44076
|
+
indexedAppend = indexRuntimeCollectionChange(
|
|
44077
|
+
targetValue,
|
|
44078
|
+
ins.mutation === "Insert" /* Insert */ ? overlayArgs[1] : overlayArgs[0],
|
|
44079
|
+
ctx
|
|
44080
|
+
);
|
|
44081
|
+
else if (dictionary && isPlainRecord(targetValue))
|
|
44082
|
+
indexedAppend = indexRuntimeCollectionChange(
|
|
44083
|
+
targetValue,
|
|
44084
|
+
overlayArgs[1],
|
|
44085
|
+
ctx,
|
|
44086
|
+
typeof replacedEntry === "string" ? [replacedEntry] : [],
|
|
44087
|
+
String(args[0])
|
|
44088
|
+
);
|
|
44089
|
+
}
|
|
44090
|
+
if (previousEdges !== null) {
|
|
44091
|
+
const collection = targetValue instanceof RuntimeSet ? targetValue.source : targetValue;
|
|
44092
|
+
if (Array.isArray(collection) || isPlainRecord(collection))
|
|
44093
|
+
indexedAppend = indexRuntimeCollectionChange(
|
|
44094
|
+
collection,
|
|
44095
|
+
void 0,
|
|
44096
|
+
ctx,
|
|
44097
|
+
previousEdges,
|
|
44098
|
+
void 0,
|
|
44099
|
+
"contents"
|
|
44100
|
+
);
|
|
44101
|
+
}
|
|
43977
44102
|
if (!indexedAppend) invalidateEvaluatorIndexes(ctx, targetValue);
|
|
43978
44103
|
switch (ins.mutation) {
|
|
43979
44104
|
case "Insert" /* Insert */:
|
|
@@ -43982,7 +44107,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
43982
44107
|
target: ins.target,
|
|
43983
44108
|
index: numberArg(args[0], "Insert index"),
|
|
43984
44109
|
value: args[1],
|
|
43985
|
-
valueId: findKnownRowIdByValueReference(args[1], ctx) ?? void 0,
|
|
44110
|
+
valueId: insertedReferenceRowId ?? findKnownRowIdByValueReference(args[1], ctx) ?? void 0,
|
|
43986
44111
|
...resolvedDestinationFieldsForContainer(targetValue, ctx)
|
|
43987
44112
|
});
|
|
43988
44113
|
return;
|
|
@@ -43993,7 +44118,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
43993
44118
|
target: ins.target,
|
|
43994
44119
|
value: isLookupSet ? overlayArgs[0] : args[0],
|
|
43995
44120
|
...!isLookupSet ? {
|
|
43996
|
-
valueId: unorderedContainerValueId !== null && typeof overlayArgs[0] === "string" ? overlayArgs[0] : findKnownRowIdByValueReference(args[0], ctx) ?? void 0
|
|
44121
|
+
valueId: insertedReferenceRowId ?? (unorderedContainerValueId !== null && typeof overlayArgs[0] === "string" ? overlayArgs[0] : findKnownRowIdByValueReference(args[0], ctx) ?? void 0)
|
|
43997
44122
|
} : {},
|
|
43998
44123
|
...resolvedDestinationFieldsForContainer(targetValue, ctx)
|
|
43999
44124
|
});
|
|
@@ -44004,7 +44129,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
44004
44129
|
target: ins.target,
|
|
44005
44130
|
key: String(args[0]),
|
|
44006
44131
|
value: args[1],
|
|
44007
|
-
valueId: findKnownRowIdByValueReference(args[1], ctx) ?? void 0,
|
|
44132
|
+
valueId: insertedReferenceRowId ?? findKnownRowIdByValueReference(args[1], ctx) ?? void 0,
|
|
44008
44133
|
...resolvedDestinationFieldsForContainer(targetValue, ctx)
|
|
44009
44134
|
});
|
|
44010
44135
|
return;
|
|
@@ -44015,7 +44140,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
44015
44140
|
target: ins.target,
|
|
44016
44141
|
value: isLookupSet ? overlayArgs[0] : args[0],
|
|
44017
44142
|
...!isLookupSet ? {
|
|
44018
|
-
valueId: setMatch?.valueId ?? findKnownRowIdByValueReference(args[0], ctx) ?? void 0
|
|
44143
|
+
valueId: removedReferenceRowId ?? setMatch?.valueId ?? findKnownRowIdByValueReference(args[0], ctx) ?? void 0
|
|
44019
44144
|
} : {},
|
|
44020
44145
|
...resolvedDestinationFieldsForContainer(targetValue, ctx)
|
|
44021
44146
|
});
|
|
@@ -44111,7 +44236,15 @@ function sortCollectionInPlace(ins, value, scope, ctx, options) {
|
|
|
44111
44236
|
references
|
|
44112
44237
|
);
|
|
44113
44238
|
forgetLocalListIndexes(ctx, list);
|
|
44114
|
-
|
|
44239
|
+
if (!indexRuntimeCollectionChange(
|
|
44240
|
+
list,
|
|
44241
|
+
void 0,
|
|
44242
|
+
ctx,
|
|
44243
|
+
list.filter((entry) => typeof entry === "string"),
|
|
44244
|
+
void 0,
|
|
44245
|
+
"contents"
|
|
44246
|
+
))
|
|
44247
|
+
invalidateEvaluatorIndexes(ctx, list);
|
|
44115
44248
|
if (id2 !== null)
|
|
44116
44249
|
options.writes.push({
|
|
44117
44250
|
kind: "reorder",
|
|
@@ -44120,18 +44253,36 @@ function sortCollectionInPlace(ins, value, scope, ctx, options) {
|
|
|
44120
44253
|
...resolvedDestinationFieldsForContainer(list, ctx)
|
|
44121
44254
|
});
|
|
44122
44255
|
}
|
|
44123
|
-
function
|
|
44124
|
-
|
|
44125
|
-
return;
|
|
44126
|
-
const parent = trackedRowForValueReference(parentValue, ctx);
|
|
44256
|
+
function storedCollectionEntryContract(collection, ctx) {
|
|
44257
|
+
const parent = trackedRowForValueReference(collection, ctx);
|
|
44127
44258
|
const placement = parent === null ? null : memberForValueRow(parent, ctx);
|
|
44128
|
-
if (parent === null || placement === null) return;
|
|
44259
|
+
if (parent === null || placement === null) return null;
|
|
44129
44260
|
const genericEnv = rowGenericEnv(parent, ctx);
|
|
44130
44261
|
const parentMember = substituteMember(placement, genericEnv, ctx.vm.members);
|
|
44131
|
-
if (!isMemberWithEntries(parentMember)) return;
|
|
44262
|
+
if (!isMemberWithEntries(parentMember)) return null;
|
|
44132
44263
|
const entry = evalMemberById(ctx.vm, parentMember.entryMemberId);
|
|
44133
|
-
if (entry === null) return;
|
|
44134
|
-
|
|
44264
|
+
if (entry === null) return null;
|
|
44265
|
+
return {
|
|
44266
|
+
entry,
|
|
44267
|
+
member: substituteMember(entry, genericEnv, ctx.vm.members),
|
|
44268
|
+
genericEnv
|
|
44269
|
+
};
|
|
44270
|
+
}
|
|
44271
|
+
function trackInsertedCollection(value, type2, parentValue, ctx) {
|
|
44272
|
+
if (value !== null && typeof value !== "object" && type2.type !== 9 /* Lookup */)
|
|
44273
|
+
return null;
|
|
44274
|
+
const contract = storedCollectionEntryContract(parentValue, ctx);
|
|
44275
|
+
if (contract === null) return null;
|
|
44276
|
+
const { entry, member, genericEnv } = contract;
|
|
44277
|
+
const referenceEntry = isMemberLookupBase(member);
|
|
44278
|
+
if (referenceEntry && isMultiSelectionMember(member) !== true) {
|
|
44279
|
+
const target = lookupTargetTypeInfo(member, null, ctx);
|
|
44280
|
+
const localCollection = target.type === 6 /* List */ && Array.isArray(value) || (target.type === 28 /* Set */ || target.type === 9 /* Lookup */) && value instanceof RuntimeSet || target.type === 5 /* Dictionary */ && isPlainRecord(value);
|
|
44281
|
+
if (localCollection && findKnownRowIdByValueReference(value, ctx) === null)
|
|
44282
|
+
return null;
|
|
44283
|
+
}
|
|
44284
|
+
if (!referenceEntry && (!isTypeInfoWithEntries(type2) && type2.type !== 9 /* Lookup */ || value === null || typeof value !== "object" || findKnownRowIdByValueReference(value, ctx) !== null))
|
|
44285
|
+
return null;
|
|
44135
44286
|
const createdValues = [];
|
|
44136
44287
|
const collectionAliases = /* @__PURE__ */ new Map();
|
|
44137
44288
|
const reservations = /* @__PURE__ */ new Map();
|
|
@@ -44146,13 +44297,21 @@ function trackInsertedCollection(value, type2, parentValue, ctx) {
|
|
|
44146
44297
|
storageKeyDeclarations: /* @__PURE__ */ new Map(),
|
|
44147
44298
|
collectionEntriesAreReferences: false,
|
|
44148
44299
|
collectionAliases,
|
|
44149
|
-
attachmentReservations: reservations
|
|
44300
|
+
attachmentReservations: reservations,
|
|
44301
|
+
insertedCollections: /* @__PURE__ */ new Set()
|
|
44150
44302
|
});
|
|
44151
44303
|
row.genericBindings = computeGenericBindingsStamp(
|
|
44152
44304
|
entry,
|
|
44153
44305
|
genericEnv,
|
|
44154
44306
|
ctx.vm.members
|
|
44155
44307
|
);
|
|
44308
|
+
if (referenceEntry)
|
|
44309
|
+
ctx.__runtimeCollectionMembers?.set(row, {
|
|
44310
|
+
member: { ...entry, ...member },
|
|
44311
|
+
members: ctx.vm.members,
|
|
44312
|
+
classes: ctx.vm.classes,
|
|
44313
|
+
bindings: row.genericBindings === void 0 ? void 0 : { ...row.genericBindings }
|
|
44314
|
+
});
|
|
44156
44315
|
for (const [encoded, alias] of collectionAliases) {
|
|
44157
44316
|
retainEncodedCollectionAlias(encoded, alias, ctx);
|
|
44158
44317
|
}
|
|
@@ -44160,6 +44319,7 @@ function trackInsertedCollection(value, type2, parentValue, ctx) {
|
|
|
44160
44319
|
registerRuntimeSessionValue(ctx, created);
|
|
44161
44320
|
if (ctx.__indexes !== void 0)
|
|
44162
44321
|
indexEvaluatorRows(ctx.__indexes, createdValues);
|
|
44322
|
+
return referenceEntry ? row.id : null;
|
|
44163
44323
|
} catch (error) {
|
|
44164
44324
|
for (const created of createdValues)
|
|
44165
44325
|
ctx.__executionState?.constructorGroupDependencies.delete(created.id);
|
|
@@ -44230,7 +44390,7 @@ function storedSetEntryMember(collection, ctx) {
|
|
|
44230
44390
|
}
|
|
44231
44391
|
return substituteMember(
|
|
44232
44392
|
entry,
|
|
44233
|
-
|
|
44393
|
+
rowGenericEnv(container, ctx),
|
|
44234
44394
|
ctx.vm.members
|
|
44235
44395
|
);
|
|
44236
44396
|
}
|
|
@@ -44595,7 +44755,11 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
|
|
|
44595
44755
|
}
|
|
44596
44756
|
return null;
|
|
44597
44757
|
}
|
|
44598
|
-
|
|
44758
|
+
setOwnField(
|
|
44759
|
+
objectArg(targetValue, "Dictionary Add target"),
|
|
44760
|
+
String(args[0]),
|
|
44761
|
+
args[1]
|
|
44762
|
+
);
|
|
44599
44763
|
return null;
|
|
44600
44764
|
case "Remove" /* Remove */:
|
|
44601
44765
|
if (Array.isArray(targetValue)) {
|
|
@@ -46345,7 +46509,11 @@ function runtimeParentGenericEnv(row, ctx, visited, readRow) {
|
|
|
46345
46509
|
ctx.onUnattributableValueRead?.(
|
|
46346
46510
|
ownershipChainRead("generic-parent-resolution", row.id)
|
|
46347
46511
|
);
|
|
46348
|
-
for (const link of evaluatorParentLinks(
|
|
46512
|
+
for (const link of evaluatorParentLinks(
|
|
46513
|
+
evaluatorIndexes(ctx),
|
|
46514
|
+
row.id,
|
|
46515
|
+
true
|
|
46516
|
+
)) {
|
|
46349
46517
|
const parent = readRow === void 0 ? evalValueById(
|
|
46350
46518
|
ctx,
|
|
46351
46519
|
link.parentId,
|
|
@@ -47476,7 +47644,11 @@ function resolveValueIfId(at3, ctx) {
|
|
|
47476
47644
|
ctx.__valueOverlay
|
|
47477
47645
|
);
|
|
47478
47646
|
if (!row) return at3;
|
|
47479
|
-
const
|
|
47647
|
+
const placed = memberForValueRow(row, ctx);
|
|
47648
|
+
const member = placed?.kind === 21 /* Generic */ ? {
|
|
47649
|
+
...placed,
|
|
47650
|
+
...substituteMember(placed, rowGenericEnv(row, ctx), ctx.vm.members)
|
|
47651
|
+
} : placed;
|
|
47480
47652
|
if (member !== null && isMemberEntryCollectionBase(member) && listKindOf(member) === 1 /* Unordered */ && Array.isArray(row.value)) {
|
|
47481
47653
|
return evaluatorUnorderedListEntryIds(row.id, ctx);
|
|
47482
47654
|
}
|
|
@@ -47815,7 +47987,25 @@ function resolveMemberForValueRow(row, ctx, visited) {
|
|
|
47815
47987
|
const member = memberForCustomSchemaValue(classId, link.key, ctx);
|
|
47816
47988
|
if (member !== null) return member;
|
|
47817
47989
|
}
|
|
47818
|
-
return
|
|
47990
|
+
return runtimeCollectionMember(row, ctx);
|
|
47991
|
+
}
|
|
47992
|
+
function runtimeCollectionMember(row, ctx) {
|
|
47993
|
+
const known = ctx.__runtimeCollectionMembers?.get(row);
|
|
47994
|
+
if (known === void 0) return null;
|
|
47995
|
+
if (known.members !== ctx.vm.members || known.classes !== ctx.vm.classes)
|
|
47996
|
+
return null;
|
|
47997
|
+
const bindings = row.genericBindings;
|
|
47998
|
+
if (Object.keys(bindings ?? {}).length !== Object.keys(known.bindings ?? {}).length)
|
|
47999
|
+
return null;
|
|
48000
|
+
for (const [id2, memberId] of Object.entries(known.bindings ?? {}))
|
|
48001
|
+
if (bindings?.[id2] !== memberId) return null;
|
|
48002
|
+
if (row.value !== null) {
|
|
48003
|
+
if ((isMemberEntryCollectionBase(known.member) || isMemberLookupBase(known.member)) && !Array.isArray(row.value))
|
|
48004
|
+
return null;
|
|
48005
|
+
if (isMemberDictionaryBase(known.member) && !isPlainRecord(row.value))
|
|
48006
|
+
return null;
|
|
48007
|
+
}
|
|
48008
|
+
return known.member;
|
|
47819
48009
|
}
|
|
47820
48010
|
function* evaluatorParentEdges(row, ctx, indexes4) {
|
|
47821
48011
|
const cache = ctx.__unorderedListProjections;
|
|
@@ -47824,7 +48014,7 @@ function* evaluatorParentEdges(row, ctx, indexes4) {
|
|
|
47824
48014
|
yield { parentId: writtenParentId, key: "" };
|
|
47825
48015
|
}
|
|
47826
48016
|
const written = cache?.writtenContainerIds;
|
|
47827
|
-
for (const link of indexes4.parentLinksByChildId.get(row.id) ?? []) {
|
|
48017
|
+
for (const link of indexes4.placementParentLinksByChildId.get(row.id) ?? indexes4.parentLinksByChildId.get(row.id) ?? []) {
|
|
47828
48018
|
if (written?.has(link.parentId) !== true) yield link;
|
|
47829
48019
|
}
|
|
47830
48020
|
const database = ctx.vm.databaseVM;
|
|
@@ -50901,6 +51091,7 @@ function publishConstructedRows(args) {
|
|
|
50901
51091
|
if (beforeRetain !== null) {
|
|
50902
51092
|
for (const rowId of beforeRetain) {
|
|
50903
51093
|
if (retained.has(rowId)) continue;
|
|
51094
|
+
if (constructorGroupForRow(rowId, ctx) !== null) continue;
|
|
50904
51095
|
deleteRuntimeSessionValue(ctx, rowId);
|
|
50905
51096
|
}
|
|
50906
51097
|
}
|
|
@@ -50986,16 +51177,55 @@ function assertImplicitConstructionAllowed(schemaClass2) {
|
|
|
50986
51177
|
`Class '${schemaClass2.name}' declares a required constructor, so it cannot be constructed without one.`
|
|
50987
51178
|
);
|
|
50988
51179
|
}
|
|
51180
|
+
function constructionReplayContext(descriptor, ctx) {
|
|
51181
|
+
if (ctx.storedConstructionReplay !== true) return ctx;
|
|
51182
|
+
const target = ctx.__storedInitializerReplay;
|
|
51183
|
+
let rowId;
|
|
51184
|
+
let candidate;
|
|
51185
|
+
if (target !== void 0) {
|
|
51186
|
+
const row = storedReplayRowById(target.rowId, ctx);
|
|
51187
|
+
if (row !== null && classIdForValueRow(row, ctx) === descriptor.schemaClass.id) {
|
|
51188
|
+
rowId = target.rowId;
|
|
51189
|
+
candidate = { reattached: false };
|
|
51190
|
+
target.candidates.push(candidate);
|
|
51191
|
+
}
|
|
51192
|
+
} else if (ctx.__executionState?.constructionStack.length === 0 && ctx.__storedConstructionReplaySlot?.classId === descriptor.schemaClass.id) {
|
|
51193
|
+
rowId = ctx.__storedConstructionReplayRowId;
|
|
51194
|
+
}
|
|
51195
|
+
return {
|
|
51196
|
+
...ctx,
|
|
51197
|
+
__storedInitializerReplay: void 0,
|
|
51198
|
+
__storedReplayCandidate: candidate,
|
|
51199
|
+
__storedConstructionReplayRowId: rowId,
|
|
51200
|
+
__storedConstructionReplayRootId: void 0,
|
|
51201
|
+
__storedConstructionReplaySlot: rowId === void 0 ? ctx.__storedConstructionReplaySlot : {
|
|
51202
|
+
classId: descriptor.schemaClass.id,
|
|
51203
|
+
classArguments: descriptor.classArguments ?? {}
|
|
51204
|
+
}
|
|
51205
|
+
};
|
|
51206
|
+
}
|
|
51207
|
+
function rollbackStoredConstructionReplay(ctx, checkpoint) {
|
|
51208
|
+
if (checkpoint === void 0) return;
|
|
51209
|
+
for (const row of createdSessionValuesSince(ctx, checkpoint))
|
|
51210
|
+
deleteRuntimeSessionValue(ctx, row.id);
|
|
51211
|
+
if (ctx.__storedReplayCandidate !== void 0)
|
|
51212
|
+
ctx.__storedReplayCandidate.reattached = false;
|
|
51213
|
+
}
|
|
50989
51214
|
function constructClassValue(info, scope, ctx) {
|
|
50990
51215
|
const descriptor = validateClassConstructorDescriptor(
|
|
50991
51216
|
info,
|
|
50992
51217
|
ctx,
|
|
50993
51218
|
ctx.constructionBaselineReplay !== true
|
|
50994
51219
|
);
|
|
51220
|
+
ctx = constructionReplayContext(descriptor, ctx);
|
|
50995
51221
|
assertImplicitConstructionAllowed(descriptor.schemaClass);
|
|
51222
|
+
const replayCheckpoint = ctx.__storedConstructionReplayRowId === void 0 ? void 0 : sessionCreationCheckpoint(ctx);
|
|
50996
51223
|
const closeFrame = pushConstructionFrame(ctx, descriptor.schemaClass.name);
|
|
50997
51224
|
try {
|
|
50998
51225
|
return constructClassValueWithinFrame(descriptor, scope, ctx);
|
|
51226
|
+
} catch (error) {
|
|
51227
|
+
rollbackStoredConstructionReplay(ctx, replayCheckpoint);
|
|
51228
|
+
throw error;
|
|
50999
51229
|
} finally {
|
|
51000
51230
|
closeFrame();
|
|
51001
51231
|
}
|
|
@@ -51095,6 +51325,8 @@ function constructClassValueWithinFrame(descriptor, scope, ctx) {
|
|
|
51095
51325
|
});
|
|
51096
51326
|
root.classId = classId;
|
|
51097
51327
|
stampConstructedRootGenericBindings(root, descriptor);
|
|
51328
|
+
if (ctx.__storedReplayCandidate !== void 0)
|
|
51329
|
+
ctx.__storedReplayCandidate.value = root.value;
|
|
51098
51330
|
if (typeof root.value !== "object" || root.value === null || Array.isArray(root.value)) {
|
|
51099
51331
|
throw new Error(
|
|
51100
51332
|
`Class constructor for '${schemaClass2.name}' produced a non-record root.`
|
|
@@ -51524,15 +51756,20 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
|
|
|
51524
51756
|
sourceValueId: sourceValueId ?? null,
|
|
51525
51757
|
compileMemberId: scopeMemberId
|
|
51526
51758
|
});
|
|
51759
|
+
const childId = storedInitializerChildId(member, ctx);
|
|
51760
|
+
const initializerCtx = childId === void 0 ? ctx : {
|
|
51761
|
+
...ctx,
|
|
51762
|
+
__storedInitializerReplay: { rowId: childId, candidates: [] }
|
|
51763
|
+
};
|
|
51527
51764
|
const evaluate = (argumentValues = []) => {
|
|
51528
|
-
|
|
51765
|
+
const result = withConstructionGenericSlots(
|
|
51529
51766
|
member,
|
|
51530
|
-
|
|
51767
|
+
initializerCtx,
|
|
51531
51768
|
genericEnv,
|
|
51532
51769
|
() => evaluateInitializerInContext(
|
|
51533
51770
|
init,
|
|
51534
51771
|
member,
|
|
51535
|
-
|
|
51772
|
+
initializerCtx,
|
|
51536
51773
|
createdValues,
|
|
51537
51774
|
argumentValues,
|
|
51538
51775
|
sourceValueId ?? null,
|
|
@@ -51540,6 +51777,17 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
|
|
|
51540
51777
|
genericEnv
|
|
51541
51778
|
)
|
|
51542
51779
|
);
|
|
51780
|
+
for (const candidate of initializerCtx.__storedInitializerReplay?.candidates ?? []) {
|
|
51781
|
+
if (!candidate.reattached) continue;
|
|
51782
|
+
if (candidate.value !== result.value) {
|
|
51783
|
+
throw new NSGetterRuntimeError(
|
|
51784
|
+
`Stored initializer '${member.name}' constructed an already owned value outside its returned child. Call Clone() explicitly.`
|
|
51785
|
+
);
|
|
51786
|
+
}
|
|
51787
|
+
if (ctx.__storedReplayCandidate !== void 0)
|
|
51788
|
+
ctx.__storedReplayCandidate.reattached = true;
|
|
51789
|
+
}
|
|
51790
|
+
return result;
|
|
51543
51791
|
};
|
|
51544
51792
|
const ownerClassId = scopeMemberId === null ? null : owningClassId(scopeMemberId);
|
|
51545
51793
|
const expectedArgumentCount = compiled.parameters.slice(2).length;
|
|
@@ -51752,6 +52000,13 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
|
|
|
51752
52000
|
(argument2) => trackedRowForValueReference(argument2, ctx)?.id === existingValueRow.id
|
|
51753
52001
|
)) {
|
|
51754
52002
|
assertInitializerPlacement(existingValueRow.id, member, ctx);
|
|
52003
|
+
if (storedInitializerChildId(member, ctx) === existingValueRow.id) {
|
|
52004
|
+
return {
|
|
52005
|
+
value: result.value,
|
|
52006
|
+
classId: existingRuntimeClassId,
|
|
52007
|
+
existingValueRow
|
|
52008
|
+
};
|
|
52009
|
+
}
|
|
51755
52010
|
}
|
|
51756
52011
|
if (existingValueRow !== null && existingRuntimeClassId !== null && isClassSlotMember(member)) {
|
|
51757
52012
|
const storage = constructorArgumentStorage(existingValueRow.id, ctx);
|
|
@@ -51955,18 +52210,14 @@ function encodeRequiredConstructorArgument(args) {
|
|
|
51955
52210
|
args.ctx.__valueOverlay
|
|
51956
52211
|
) !== null ? args.value : null;
|
|
51957
52212
|
const adoptTracked = (id2, suffix) => {
|
|
51958
|
-
|
|
51959
|
-
|
|
51960
|
-
|
|
51961
|
-
{
|
|
51962
|
-
|
|
51963
|
-
|
|
51964
|
-
|
|
51965
|
-
|
|
51966
|
-
args.ctx,
|
|
51967
|
-
true
|
|
51968
|
-
);
|
|
51969
|
-
}
|
|
52213
|
+
recordConstructorGroupDependency(
|
|
52214
|
+
id2,
|
|
52215
|
+
{
|
|
52216
|
+
identity: `value:${args.ownerRootId}:constructorArg:${args.parameterId}:${suffix}`,
|
|
52217
|
+
label: args.ownerRootId
|
|
52218
|
+
},
|
|
52219
|
+
args.ctx
|
|
52220
|
+
);
|
|
51970
52221
|
return id2;
|
|
51971
52222
|
};
|
|
51972
52223
|
if (args.typeInfo.type === 21 /* Generic */) {
|
|
@@ -52887,7 +53138,8 @@ function constructDeclaredClassValue(info, scope, ctx) {
|
|
|
52887
53138
|
const descriptor = validateClassConstructorDescriptor(info, ctx, false);
|
|
52888
53139
|
const schemaClass2 = descriptor.schemaClass;
|
|
52889
53140
|
const record7 = resolveDeclaredConstructorRecord(info, schemaClass2, ctx);
|
|
52890
|
-
|
|
53141
|
+
ctx = constructionReplayContext(descriptor, ctx);
|
|
53142
|
+
const replayCheckpoint = ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === schemaClass2.id ? sessionCreationCheckpoint(ctx) : void 0;
|
|
52891
53143
|
const closeFrame = pushConstructionFrame(ctx, schemaClass2.name);
|
|
52892
53144
|
try {
|
|
52893
53145
|
return constructDeclaredClassValueWithinFrame(
|
|
@@ -52898,11 +53150,7 @@ function constructDeclaredClassValue(info, scope, ctx) {
|
|
|
52898
53150
|
ctx
|
|
52899
53151
|
);
|
|
52900
53152
|
} catch (error) {
|
|
52901
|
-
|
|
52902
|
-
for (const row of createdSessionValuesSince(ctx, replayCheckpoint)) {
|
|
52903
|
-
deleteRuntimeSessionValue(ctx, row.id);
|
|
52904
|
-
}
|
|
52905
|
-
}
|
|
53153
|
+
rollbackStoredConstructionReplay(ctx, replayCheckpoint);
|
|
52906
53154
|
throw error;
|
|
52907
53155
|
} finally {
|
|
52908
53156
|
closeFrame();
|
|
@@ -52963,6 +53211,8 @@ function constructDeclaredClassValueWithinFrame(descriptor, record7, info, scope
|
|
|
52963
53211
|
});
|
|
52964
53212
|
root.classId = classId;
|
|
52965
53213
|
stampConstructedRootGenericBindings(root, descriptor);
|
|
53214
|
+
if (ctx.__storedReplayCandidate !== void 0)
|
|
53215
|
+
ctx.__storedReplayCandidate.value = root.value;
|
|
52966
53216
|
} catch (error) {
|
|
52967
53217
|
if (error instanceof NSGetterRuntimeError) {
|
|
52968
53218
|
positionAtPassingArgument(error, info, record7, argumentValues, ctx);
|
|
@@ -52975,7 +53225,7 @@ function constructDeclaredClassValueWithinFrame(descriptor, record7, info, scope
|
|
|
52975
53225
|
`Declared constructor for '${schemaClass2.name}' produced a non-record root.`
|
|
52976
53226
|
);
|
|
52977
53227
|
}
|
|
52978
|
-
if (ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === classId
|
|
53228
|
+
if (ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === classId) {
|
|
52979
53229
|
ctx = { ...ctx, __storedConstructionReplayRootId: root.id };
|
|
52980
53230
|
}
|
|
52981
53231
|
const rootRecord = root.value;
|
|
@@ -53139,8 +53389,13 @@ function assertOwnedValueAttachable(valueId, destination, destinationName2, ctx,
|
|
|
53139
53389
|
ctx,
|
|
53140
53390
|
preflight?.parentEntries
|
|
53141
53391
|
)) {
|
|
53142
|
-
if (mode === "assign" && ownedAttachmentIdentity(owner, ctx) === ownedAttachmentIdentity(destination, ctx))
|
|
53392
|
+
if (mode === "assign" && ownedAttachmentIdentity(owner, ctx) === ownedAttachmentIdentity(destination, ctx)) {
|
|
53393
|
+
if (ctx.__storedReplayCandidate !== void 0 && ctx.__storedConstructionReplayRowId !== void 0 && owner.identity.startsWith(
|
|
53394
|
+
`value:${ctx.__storedConstructionReplayRowId}:slot:`
|
|
53395
|
+
))
|
|
53396
|
+
ctx.__storedReplayCandidate.reattached = true;
|
|
53143
53397
|
continue;
|
|
53398
|
+
}
|
|
53144
53399
|
const error = new NSGetterRuntimeError(
|
|
53145
53400
|
`Aggregate value '${valueId}' is already owned by parent value '${owner.label}' and cannot be attached to '${destinationName2}'. Call Clone() explicitly.`
|
|
53146
53401
|
);
|
|
@@ -53149,23 +53404,6 @@ function assertOwnedValueAttachable(valueId, destination, destinationName2, ctx,
|
|
|
53149
53404
|
}
|
|
53150
53405
|
const reserved = ctx.__executionState?.ownedValueAttachments.get(valueId);
|
|
53151
53406
|
if (reserved !== void 0 && (mode === "insert" || reserved.identity !== destination.identity)) {
|
|
53152
|
-
const constructorArgumentReservation = reserved.identity.startsWith(
|
|
53153
|
-
`value:${reserved.label}:constructorArg:`
|
|
53154
|
-
);
|
|
53155
|
-
const destinationConstructorGroup = constructorGroupForRow(
|
|
53156
|
-
destination.label,
|
|
53157
|
-
ctx
|
|
53158
|
-
);
|
|
53159
|
-
if (constructorArgumentReservation && (destination.label === reserved.label || destinationConstructorGroup === reserved.label || preflight?.constructorRootIds.has(reserved.label) === true)) {
|
|
53160
|
-
if (preflight === void 0) {
|
|
53161
|
-
ctx.__executionState?.ownedValueAttachments.set(valueId, destination);
|
|
53162
|
-
recordConstructorGroupDependency(valueId, destination, ctx);
|
|
53163
|
-
} else {
|
|
53164
|
-
preflight.constructorArgumentTransfers.set(valueId, destination);
|
|
53165
|
-
preflight.dependencies.set(valueId, destination);
|
|
53166
|
-
}
|
|
53167
|
-
return;
|
|
53168
|
-
}
|
|
53169
53407
|
throw new NSGetterRuntimeError(
|
|
53170
53408
|
`Aggregate value '${valueId}' is already owned by parent value '${reserved.label}' and cannot be attached to '${destinationName2}'. Call Clone() explicitly.`
|
|
53171
53409
|
);
|
|
@@ -53177,6 +53415,29 @@ function assertOwnedValueAttachable(valueId, destination, destinationName2, ctx,
|
|
|
53177
53415
|
recordConstructorGroupDependency(valueId, destination, ctx);
|
|
53178
53416
|
else preflight.dependencies.set(valueId, destination);
|
|
53179
53417
|
}
|
|
53418
|
+
function storedReplayRowById(id2, ctx) {
|
|
53419
|
+
ctx.valueDependencies?.add(id2);
|
|
53420
|
+
ctx.__getterReads?.add(id2);
|
|
53421
|
+
const database = ctx.vm.databaseVM;
|
|
53422
|
+
if (database?.storedValueById !== void 0)
|
|
53423
|
+
return database.storedValueById(id2);
|
|
53424
|
+
if (database?.evaluatorIndexes !== void 0)
|
|
53425
|
+
return database.evaluatorIndexes.valueById.get(id2) ?? null;
|
|
53426
|
+
return ctx.vm.values.find((row) => row.id === id2) ?? null;
|
|
53427
|
+
}
|
|
53428
|
+
function storedInitializerChildId(member, ctx) {
|
|
53429
|
+
if (ctx.storedConstructionReplay !== true) return void 0;
|
|
53430
|
+
const parentId = ctx.__storedConstructionReplayRowId;
|
|
53431
|
+
const memberId = Reflect.get(member, "id");
|
|
53432
|
+
if (parentId === void 0 || typeof memberId !== "string") return void 0;
|
|
53433
|
+
const parent = storedReplayRowById(parentId, ctx);
|
|
53434
|
+
if (parent?.value === null || typeof parent?.value !== "object")
|
|
53435
|
+
return void 0;
|
|
53436
|
+
const schemaKey = cachedSchemaKeyForMember(memberId, ctx);
|
|
53437
|
+
if (schemaKey === null) return void 0;
|
|
53438
|
+
const childId = Reflect.get(parent.value, schemaKey);
|
|
53439
|
+
return typeof childId === "string" ? childId : void 0;
|
|
53440
|
+
}
|
|
53180
53441
|
function assertInitializerPlacement(valueId, member, ctx) {
|
|
53181
53442
|
const replayRowId = ctx.__storedConstructionReplayRowId;
|
|
53182
53443
|
const memberId = Reflect.get(member, "id");
|
|
@@ -53213,7 +53474,7 @@ function ownershipParentEntryKeys(value, valueId, cache) {
|
|
|
53213
53474
|
}
|
|
53214
53475
|
return entries.get(valueId) ?? [];
|
|
53215
53476
|
}
|
|
53216
|
-
function currentOwnedValueAttachments(valueId, ctx, parentEntries
|
|
53477
|
+
function currentOwnedValueAttachments(valueId, ctx, parentEntries) {
|
|
53217
53478
|
const indexes4 = evaluatorIndexes(ctx);
|
|
53218
53479
|
const cached = indexes4.ownedValueAttachmentsByValueId.get(valueId);
|
|
53219
53480
|
if (cached !== void 0) return [...cached];
|
|
@@ -53262,7 +53523,7 @@ function currentOwnedValueAttachments(valueId, ctx, parentEntries, placingMember
|
|
|
53262
53523
|
ownershipChainRead("owned-value-parents", valueId)
|
|
53263
53524
|
);
|
|
53264
53525
|
const parentIds = new Set(
|
|
53265
|
-
evaluatorParentLinks(indexes4, valueId).map((link) => link.parentId)
|
|
53526
|
+
evaluatorParentLinks(indexes4, valueId, true).map((link) => link.parentId)
|
|
53266
53527
|
);
|
|
53267
53528
|
for (const parentId of parentIds) {
|
|
53268
53529
|
const parent = evalValueById(
|
|
@@ -53276,14 +53537,7 @@ function currentOwnedValueAttachments(valueId, ctx, parentEntries, placingMember
|
|
|
53276
53537
|
let member = null;
|
|
53277
53538
|
let classId = parent.classId;
|
|
53278
53539
|
if (classId === void 0 || classId === null) {
|
|
53279
|
-
member = activeStaticBindingRoot(parent.id, ctx)?.member ??
|
|
53280
|
-
parent,
|
|
53281
|
-
ctx,
|
|
53282
|
-
void 0,
|
|
53283
|
-
0,
|
|
53284
|
-
placingMembers,
|
|
53285
|
-
parentEntries
|
|
53286
|
-
));
|
|
53540
|
+
member = activeStaticBindingRoot(parent.id, ctx)?.member ?? memberForValueRow(parent, ctx);
|
|
53287
53541
|
if (member !== null) {
|
|
53288
53542
|
try {
|
|
53289
53543
|
member = resolveMember(member, ctx.vm.members);
|
|
@@ -53672,6 +53926,35 @@ function materializeConstructorArgumentValue(args) {
|
|
|
53672
53926
|
args.destinationName ?? args.member.name,
|
|
53673
53927
|
args.ctx
|
|
53674
53928
|
);
|
|
53929
|
+
if (args.insertedCollections !== void 0 && (isMemberEntryCollectionBase(args.member) || isMemberDictionaryBase(args.member)) && typeof args.value === "object" && args.value !== null) {
|
|
53930
|
+
const tracked = trackedRowForValueReference(args.value, args.ctx);
|
|
53931
|
+
if (tracked !== null) {
|
|
53932
|
+
if (args.owner === void 0)
|
|
53933
|
+
throw new NSGetterRuntimeError(
|
|
53934
|
+
"Inserted collection has no destination."
|
|
53935
|
+
);
|
|
53936
|
+
if (!args.attachmentReservations?.has(tracked.id))
|
|
53937
|
+
args.attachmentReservations?.set(
|
|
53938
|
+
tracked.id,
|
|
53939
|
+
args.ctx.__executionState?.ownedValueAttachments.get(tracked.id)
|
|
53940
|
+
);
|
|
53941
|
+
assertOwnedValueAttachable(
|
|
53942
|
+
tracked.id,
|
|
53943
|
+
args.owner,
|
|
53944
|
+
args.destinationName ?? args.member.name,
|
|
53945
|
+
args.ctx,
|
|
53946
|
+
true,
|
|
53947
|
+
"insert"
|
|
53948
|
+
);
|
|
53949
|
+
return tracked;
|
|
53950
|
+
}
|
|
53951
|
+
const identity3 = args.value instanceof RuntimeSet ? args.value.source : args.value;
|
|
53952
|
+
if (args.insertedCollections.has(identity3))
|
|
53953
|
+
throw new NSGetterRuntimeError(
|
|
53954
|
+
"Inserted collection graph contains a duplicate owned collection. Call Clone() explicitly."
|
|
53955
|
+
);
|
|
53956
|
+
args.insertedCollections.add(identity3);
|
|
53957
|
+
}
|
|
53675
53958
|
const collectionAlias = args.value;
|
|
53676
53959
|
if (args.value instanceof RuntimeSet)
|
|
53677
53960
|
args = {
|
|
@@ -53722,7 +54005,7 @@ function materializeConstructorArgumentValue(args) {
|
|
|
53722
54005
|
args.ctx
|
|
53723
54006
|
)
|
|
53724
54007
|
);
|
|
53725
|
-
if (collectionAlias instanceof RuntimeSet)
|
|
54008
|
+
if (collectionAlias instanceof RuntimeSet && isMultiSelectionMember(args.member) === true)
|
|
53726
54009
|
args.collectionAliases?.set(row, collectionAlias);
|
|
53727
54010
|
return row;
|
|
53728
54011
|
}
|
|
@@ -54894,7 +55177,7 @@ function validateRangeBound(value, name) {
|
|
|
54894
55177
|
if (typeof value !== "number" || !Number.isSafeInteger(value))
|
|
54895
55178
|
throw new NSGetterRuntimeError(`Range ${name} must be a safe int.`);
|
|
54896
55179
|
}
|
|
54897
|
-
var DELEGATE_LEXICAL_THIS, DELEGATE_LEXICAL_ROOT, DELEGATE_LEXICAL_TYPE_ARGUMENTS, NonCatchableNSGetterRuntimeError, NativeFunctionDelegateUnavailableError, CorruptNeoScriptIRError, NeoScriptWallClockTimeoutError, liveListIndexesByProject, evaluatorOwnershipCachesByBase, MAX_CONSTRUCTION_DEPTH, resolutionCacheByMembers, NO_SCHEMA_REVISION, NO_INTERFACES, LazyValueOverlay, READONLY_FOREACH_BINDING_ERROR, READONLY_CATCH_BINDING_ERROR, DIALOGUE_CONTEXT_PARAMETER_ID, validatedExecutionBodies, validatedGeneratorSchemas, STRING_TYPE_INFO, INT_TYPE_INFO, STORE_LIFETIME, STORE_NAMES, FORWARDING_TYPE_ARGUMENTS, constantDeclarationRoots, UNKNOWN_LOOKUP_TARGET, MAX_AREA_DEPTH, getAreaNative, SYSTEM_NATIVE_HANDLERS, NS_MATH_OP_NAMES, DOUBLE_INTEGRAL_MAGNITUDE, orderedQueryResults, EMPTY_SUPPLIED_CONSTRUCTOR_FIELDS, variantResolutionCopiesByOverlay, NO_BOUND_MEMBERS, NO_GENERIC_ENV, RuntimeSequenceCursor, RuntimeSequence, RuntimeRange, RangeSequenceCursor, RuntimeGeneratorSequence, GeneratorSequenceCursor, CollectionSequenceCursor, sequenceProtocolPointers;
|
|
55180
|
+
var DELEGATE_LEXICAL_THIS, DELEGATE_LEXICAL_ROOT, DELEGATE_LEXICAL_TYPE_ARGUMENTS, NonCatchableNSGetterRuntimeError, NativeFunctionDelegateUnavailableError, CorruptNeoScriptIRError, NeoScriptWallClockTimeoutError, liveListIndexesByProject, EvaluatorParentLinks, evaluatorOwnershipCachesByBase, MAX_CONSTRUCTION_DEPTH, resolutionCacheByMembers, NO_SCHEMA_REVISION, NO_INTERFACES, LazyValueOverlay, READONLY_FOREACH_BINDING_ERROR, READONLY_CATCH_BINDING_ERROR, DIALOGUE_CONTEXT_PARAMETER_ID, validatedExecutionBodies, validatedGeneratorSchemas, STRING_TYPE_INFO, INT_TYPE_INFO, STORE_LIFETIME, STORE_NAMES, FORWARDING_TYPE_ARGUMENTS, constantDeclarationRoots, UNKNOWN_LOOKUP_TARGET, MAX_AREA_DEPTH, getAreaNative, SYSTEM_NATIVE_HANDLERS, NS_MATH_OP_NAMES, DOUBLE_INTEGRAL_MAGNITUDE, orderedQueryResults, EMPTY_SUPPLIED_CONSTRUCTOR_FIELDS, variantResolutionCopiesByOverlay, NO_BOUND_MEMBERS, NO_GENERIC_ENV, RuntimeSequenceCursor, RuntimeSequence, RuntimeRange, RangeSequenceCursor, RuntimeGeneratorSequence, GeneratorSequenceCursor, CollectionSequenceCursor, sequenceProtocolPointers;
|
|
54898
55181
|
var init_evaluateNSGetter = __esm({
|
|
54899
55182
|
"../packages/neoscript-runtime/src/neoscript/evaluateNSGetter.ts"() {
|
|
54900
55183
|
"use strict";
|
|
@@ -54993,6 +55276,69 @@ var init_evaluateNSGetter = __esm({
|
|
|
54993
55276
|
}
|
|
54994
55277
|
};
|
|
54995
55278
|
liveListIndexesByProject = /* @__PURE__ */ new WeakMap();
|
|
55279
|
+
EvaluatorParentLinks = class {
|
|
55280
|
+
ordinary = /* @__PURE__ */ new Map();
|
|
55281
|
+
buckets = /* @__PURE__ */ new Map();
|
|
55282
|
+
/** Only shared selection targets need direct parent removal. */
|
|
55283
|
+
indexParents(childId) {
|
|
55284
|
+
if (this.buckets.has(childId)) return;
|
|
55285
|
+
const links = this.ordinary.get(childId) ?? [];
|
|
55286
|
+
this.ordinary.delete(childId);
|
|
55287
|
+
this.buckets.set(childId, { links: /* @__PURE__ */ new Set(), byParent: /* @__PURE__ */ new Map() });
|
|
55288
|
+
for (const link of links) this.add(childId, link);
|
|
55289
|
+
}
|
|
55290
|
+
get(childId) {
|
|
55291
|
+
const bucket = this.buckets.get(childId);
|
|
55292
|
+
if (bucket === void 0) return this.ordinary.get(childId);
|
|
55293
|
+
return bucket.snapshot ??= [...bucket.links];
|
|
55294
|
+
}
|
|
55295
|
+
has(childId) {
|
|
55296
|
+
return this.buckets.has(childId) || this.ordinary.has(childId);
|
|
55297
|
+
}
|
|
55298
|
+
add(childId, link) {
|
|
55299
|
+
const bucket = this.buckets.get(childId);
|
|
55300
|
+
if (bucket === void 0) {
|
|
55301
|
+
const links = this.ordinary.get(childId) ?? [];
|
|
55302
|
+
links.push(link);
|
|
55303
|
+
this.ordinary.set(childId, links);
|
|
55304
|
+
return;
|
|
55305
|
+
}
|
|
55306
|
+
bucket.links.add(link);
|
|
55307
|
+
let parent = bucket.byParent.get(link.parentId);
|
|
55308
|
+
if (parent === void 0) {
|
|
55309
|
+
parent = /* @__PURE__ */ new Set();
|
|
55310
|
+
bucket.byParent.set(link.parentId, parent);
|
|
55311
|
+
}
|
|
55312
|
+
parent.add(link);
|
|
55313
|
+
bucket.snapshot = void 0;
|
|
55314
|
+
}
|
|
55315
|
+
remove(childId, parentId, key) {
|
|
55316
|
+
const bucket = this.buckets.get(childId);
|
|
55317
|
+
if (bucket === void 0) {
|
|
55318
|
+
const links = this.ordinary.get(childId)?.filter(
|
|
55319
|
+
(link) => link.parentId !== parentId || key !== void 0 && link.key !== key
|
|
55320
|
+
);
|
|
55321
|
+
if (links === void 0 || links.length === 0)
|
|
55322
|
+
this.ordinary.delete(childId);
|
|
55323
|
+
else this.ordinary.set(childId, links);
|
|
55324
|
+
return;
|
|
55325
|
+
}
|
|
55326
|
+
const parent = bucket.byParent.get(parentId);
|
|
55327
|
+
if (parent === void 0) return;
|
|
55328
|
+
for (const link of parent) {
|
|
55329
|
+
if (key !== void 0 && link.key !== key) continue;
|
|
55330
|
+
bucket.links.delete(link);
|
|
55331
|
+
parent.delete(link);
|
|
55332
|
+
bucket.snapshot = void 0;
|
|
55333
|
+
}
|
|
55334
|
+
if (parent.size === 0) bucket.byParent.delete(parentId);
|
|
55335
|
+
if (bucket.links.size === 0) this.buckets.delete(childId);
|
|
55336
|
+
}
|
|
55337
|
+
delete(childId) {
|
|
55338
|
+
this.ordinary.delete(childId);
|
|
55339
|
+
this.buckets.delete(childId);
|
|
55340
|
+
}
|
|
55341
|
+
};
|
|
54996
55342
|
evaluatorOwnershipCachesByBase = /* @__PURE__ */ new WeakMap();
|
|
54997
55343
|
MAX_CONSTRUCTION_DEPTH = 64;
|
|
54998
55344
|
resolutionCacheByMembers = /* @__PURE__ */ new WeakMap();
|
|
@@ -69469,8 +69815,8 @@ var init_strict_resolver = __esm({
|
|
|
69469
69815
|
this.persistingMethodGroup = false;
|
|
69470
69816
|
}
|
|
69471
69817
|
}
|
|
69472
|
-
/**
|
|
69473
|
-
|
|
69818
|
+
/** Check an initializer with its expected type, including contextual expressions. */
|
|
69819
|
+
validateInitializerExpression(expression, expected) {
|
|
69474
69820
|
const resolved = this.resolveExpression(
|
|
69475
69821
|
expression,
|
|
69476
69822
|
this.initialScope(),
|
|
@@ -75244,6 +75590,8 @@ var init_strict_resolver = __esm({
|
|
|
75244
75590
|
}
|
|
75245
75591
|
const staticType = this.project.typeByName.get(receiverAst.name);
|
|
75246
75592
|
if (staticType && staticType.kind !== "enum") {
|
|
75593
|
+
if (receiverAst.typeQualifier)
|
|
75594
|
+
this.resolveType(receiverAst.typeQualifier);
|
|
75247
75595
|
this.assertUserSafe(
|
|
75248
75596
|
{ kind: "named", typeId: staticType.id },
|
|
75249
75597
|
"a static receiver",
|
|
@@ -75383,6 +75731,9 @@ var init_strict_resolver = __esm({
|
|
|
75383
75731
|
pointer: listIndexPointer(receiver.pointer, index),
|
|
75384
75732
|
type: viewType,
|
|
75385
75733
|
writability: "readOnly" /* ReadOnly */,
|
|
75734
|
+
...receiver.entryWritability !== void 0 ? { entryWritability: receiver.entryWritability } : {},
|
|
75735
|
+
entryUserData: receiver.entryUserData === true,
|
|
75736
|
+
...receiver.writeRoot !== void 0 ? { writeRoot: receiver.writeRoot } : {},
|
|
75386
75737
|
indexDefinition: index,
|
|
75387
75738
|
indexCollectionPointer: receiver.pointer
|
|
75388
75739
|
};
|
|
@@ -75391,7 +75742,10 @@ var init_strict_resolver = __esm({
|
|
|
75391
75742
|
return {
|
|
75392
75743
|
pointer: receiver.pointer,
|
|
75393
75744
|
type: { kind: "primitive", name: "unknown" },
|
|
75394
|
-
indexSurface: receiver.type
|
|
75745
|
+
indexSurface: receiver.type,
|
|
75746
|
+
entryWritability: receiver.entryWritability ?? receiver.writability ?? "runtime" /* Runtime */,
|
|
75747
|
+
entryUserData: receiver.entryWritability === void 0 ? receiver.userData === true : receiver.entryUserData === true,
|
|
75748
|
+
writeRoot: this.expressionWriteRoot(receiver, scope)
|
|
75395
75749
|
};
|
|
75396
75750
|
}
|
|
75397
75751
|
if ((name === "Keys" || name === "Values") && receiver.type.kind === "dictionary") {
|
|
@@ -75666,7 +76020,7 @@ var init_strict_resolver = __esm({
|
|
|
75666
76020
|
pos
|
|
75667
76021
|
);
|
|
75668
76022
|
}
|
|
75669
|
-
if (entry.id.startsWith(NEOSCRIPT_PENDING_SYMBOL_ID_PREFIX)) {
|
|
76023
|
+
if (entry.id.startsWith(NEOSCRIPT_PENDING_SYMBOL_ID_PREFIX) && !this.options.allowPendingRegistryEntries) {
|
|
75670
76024
|
throw new CompileError(
|
|
75671
76025
|
`${registry.entryType} '${name}' has no @id, so it has never been pushed and has no project file to reference. Push the file before referencing it.`,
|
|
75672
76026
|
pos
|
|
@@ -75794,7 +76148,10 @@ var init_strict_resolver = __esm({
|
|
|
75794
76148
|
key.pointer
|
|
75795
76149
|
),
|
|
75796
76150
|
type: resultType,
|
|
75797
|
-
writability: "readOnly" /* ReadOnly
|
|
76151
|
+
writability: "readOnly" /* ReadOnly */,
|
|
76152
|
+
...receiver.entryWritability !== void 0 ? { entryWritability: receiver.entryWritability } : {},
|
|
76153
|
+
entryUserData: receiver.entryUserData === true,
|
|
76154
|
+
...receiver.writeRoot !== void 0 ? { writeRoot: receiver.writeRoot } : {}
|
|
75798
76155
|
};
|
|
75799
76156
|
}
|
|
75800
76157
|
const readonlyCollection = receiver.symbol?.readonlyDeclaration === true && receiver.initWritability !== void 0 ? {
|
|
@@ -76630,6 +76987,8 @@ var init_strict_resolver = __esm({
|
|
|
76630
76987
|
}
|
|
76631
76988
|
const staticType = this.project.typeByName.get(callee.receiver.name);
|
|
76632
76989
|
if (staticType && staticType.kind !== "enum") {
|
|
76990
|
+
if (callee.receiver.typeQualifier)
|
|
76991
|
+
this.resolveType(callee.receiver.typeQualifier);
|
|
76633
76992
|
this.assertUserSafe(
|
|
76634
76993
|
{ kind: "named", typeId: staticType.id },
|
|
76635
76994
|
"a static receiver",
|
|
@@ -85231,7 +85590,10 @@ function formatNeoScript(text, options = {}) {
|
|
|
85231
85590
|
const literalNewlines = /* @__PURE__ */ new Set();
|
|
85232
85591
|
const delimiterTokensByLine = /* @__PURE__ */ new Map();
|
|
85233
85592
|
const tokensByLine = /* @__PURE__ */ new Map();
|
|
85234
|
-
const
|
|
85593
|
+
const braceHeaderLines = /* @__PURE__ */ new Map();
|
|
85594
|
+
const parenthesisLines = [];
|
|
85595
|
+
const genericLines = [];
|
|
85596
|
+
let previousHeaderLine = 0;
|
|
85235
85597
|
const genericOffsets = genericAngleOffsets(syntax.lexed.tokens);
|
|
85236
85598
|
const continuationOperator = (token) => !genericOffsets.has(token.start) && isContinuationOperator(token);
|
|
85237
85599
|
let annotationState = "none";
|
|
@@ -85267,9 +85629,22 @@ function formatNeoScript(text, options = {}) {
|
|
|
85267
85629
|
tripleString = { token, previous: previousSignificantToken };
|
|
85268
85630
|
}
|
|
85269
85631
|
if (token.kind !== "comment" && token.kind !== "eof") {
|
|
85270
|
-
|
|
85271
|
-
|
|
85272
|
-
|
|
85632
|
+
let headerLine = token.range.start.line;
|
|
85633
|
+
const followsTypeOrName = previousSignificantToken?.kind === "identifier" || previousSignificantToken?.text === "new" || previousSignificantToken?.text === ">" && genericOffsets.has(previousSignificantToken.start);
|
|
85634
|
+
if (token.kind === "identifier" && previousSignificantToken?.text === "new" || token.text === "(" && followsTypeOrName)
|
|
85635
|
+
headerLine = previousHeaderLine;
|
|
85636
|
+
if (genericOffsets.has(token.start)) {
|
|
85637
|
+
if (token.text === "<") genericLines.push(previousHeaderLine);
|
|
85638
|
+
if (token.text === ">") headerLine = genericLines.pop() ?? headerLine;
|
|
85639
|
+
}
|
|
85640
|
+
if (token.text === "(") parenthesisLines.push(headerLine);
|
|
85641
|
+
if (token.text === ")") headerLine = parenthesisLines.pop() ?? headerLine;
|
|
85642
|
+
if (token.text === "{")
|
|
85643
|
+
braceHeaderLines.set(
|
|
85644
|
+
token.start,
|
|
85645
|
+
previousSignificantToken?.text === ")" || previousSignificantToken?.text === "=>" || previousSignificantToken?.kind === "identifier" || previousSignificantToken?.text === ">" && genericOffsets.has(previousSignificantToken.start) ? previousHeaderLine : headerLine
|
|
85646
|
+
);
|
|
85647
|
+
previousHeaderLine = headerLine;
|
|
85273
85648
|
let annotationEnd = false;
|
|
85274
85649
|
if (token.kind === "punctuation" && token.text === "@" && annotationDepth === 0)
|
|
85275
85650
|
annotationState = "name";
|
|
@@ -85298,6 +85673,8 @@ function formatNeoScript(text, options = {}) {
|
|
|
85298
85673
|
}
|
|
85299
85674
|
const formatted = [];
|
|
85300
85675
|
const delimiters = [];
|
|
85676
|
+
const lineDepths = /* @__PURE__ */ new Map();
|
|
85677
|
+
const braceHeaderDepth = (token) => lineDepths.get(braceHeaderLines.get(token.start) ?? -1);
|
|
85301
85678
|
const continuations = /* @__PURE__ */ new Set();
|
|
85302
85679
|
let preceding;
|
|
85303
85680
|
let aligning;
|
|
@@ -85331,14 +85708,21 @@ function formatNeoScript(text, options = {}) {
|
|
|
85331
85708
|
const sectionDepth = switchSectionIndentDepth(syntax.parsed, contentOffset);
|
|
85332
85709
|
const leadingState = cloneDelimiterStack(delimiters);
|
|
85333
85710
|
for (const token of leadingClosers) {
|
|
85334
|
-
applyDelimiterToken(leadingState, token
|
|
85711
|
+
applyDelimiterToken(leadingState, token);
|
|
85335
85712
|
}
|
|
85336
|
-
|
|
85713
|
+
let depth = delimiterDepth(leadingState);
|
|
85337
85714
|
const significant = tokensByLine.get(lineIndex) ?? [];
|
|
85338
|
-
|
|
85715
|
+
lineDepths.set(lineIndex, depth);
|
|
85339
85716
|
const first = significant[0];
|
|
85717
|
+
const continuationScope = leadingState.at(-1)?.openingOffset ?? -1;
|
|
85718
|
+
if (first?.text === "{") {
|
|
85719
|
+
applyDelimiterToken(leadingState, first, braceHeaderDepth(first));
|
|
85720
|
+
depth = delimiterDepth(leadingState) - 1;
|
|
85721
|
+
lineDepths.set(lineIndex, depth);
|
|
85722
|
+
}
|
|
85723
|
+
pruneContinuations(continuations, leadingState);
|
|
85340
85724
|
if (leadingClosers.length === 0 && (first !== void 0 && continuationOperator(first) && preceding !== void 0 && canEndExpression(preceding) || preceding !== void 0 && continuationOperator(preceding)))
|
|
85341
|
-
continuations.add(
|
|
85725
|
+
continuations.add(continuationScope);
|
|
85342
85726
|
const lineDepth = depth + sectionDepth + continuations.size;
|
|
85343
85727
|
const normalized = first?.range.start.character === firstContentCharacter ? normalizeControlHeaderSpacing(content) : content;
|
|
85344
85728
|
const indent2 = indentUnit.repeat(lineDepth);
|
|
@@ -85349,7 +85733,7 @@ function formatNeoScript(text, options = {}) {
|
|
|
85349
85733
|
if (standalone !== void 0 && standalone.closingIndent !== indent2)
|
|
85350
85734
|
aligning = { ...standalone, indent: indent2 };
|
|
85351
85735
|
for (const token of lineTokens) {
|
|
85352
|
-
applyDelimiterToken(delimiters, token,
|
|
85736
|
+
applyDelimiterToken(delimiters, token, braceHeaderDepth(token));
|
|
85353
85737
|
}
|
|
85354
85738
|
pruneContinuations(continuations, delimiters);
|
|
85355
85739
|
const last = significant.at(-1);
|
|
@@ -85490,25 +85874,26 @@ function leadingClosingTokens(lineTokens, firstContentCharacter) {
|
|
|
85490
85874
|
}
|
|
85491
85875
|
return result;
|
|
85492
85876
|
}
|
|
85493
|
-
function applyDelimiterToken(stack, token,
|
|
85877
|
+
function applyDelimiterToken(stack, token, headerDepth) {
|
|
85494
85878
|
if (isOpeningDelimiter(token.text)) {
|
|
85495
|
-
|
|
85496
|
-
if (token.text === "{" &&
|
|
85497
|
-
|
|
85879
|
+
const restores = [];
|
|
85880
|
+
if (token.text === "{" && headerDepth !== void 0) {
|
|
85881
|
+
let depth = delimiterDepth(stack);
|
|
85882
|
+
for (let index = stack.length - 1; index >= 0 && depth > headerDepth; index--) {
|
|
85498
85883
|
const candidate = stack[index];
|
|
85499
|
-
if (candidate?.text === "
|
|
85500
|
-
|
|
85501
|
-
|
|
85884
|
+
if (candidate?.text === "{") break;
|
|
85885
|
+
if (candidate?.text === "(" && candidate.contributes) {
|
|
85886
|
+
restores.push(candidate);
|
|
85887
|
+
candidate.contributes = false;
|
|
85888
|
+
depth--;
|
|
85502
85889
|
}
|
|
85503
85890
|
}
|
|
85504
|
-
if (restores) restores.contributes = false;
|
|
85505
85891
|
}
|
|
85506
85892
|
stack.push({
|
|
85507
85893
|
text: token.text,
|
|
85508
|
-
openingLine: token.range.start.line,
|
|
85509
85894
|
openingOffset: token.start,
|
|
85510
85895
|
contributes: true,
|
|
85511
|
-
...restores ? { restores } : {}
|
|
85896
|
+
...restores.length > 0 ? { restores } : {}
|
|
85512
85897
|
});
|
|
85513
85898
|
return;
|
|
85514
85899
|
}
|
|
@@ -85522,7 +85907,7 @@ function applyDelimiterToken(stack, token, lambdaBraceOffsets) {
|
|
|
85522
85907
|
}
|
|
85523
85908
|
if (frameIndex < 0) return;
|
|
85524
85909
|
const [frame] = stack.splice(frameIndex, 1);
|
|
85525
|
-
|
|
85910
|
+
for (const restored of frame?.restores ?? []) restored.contributes = true;
|
|
85526
85911
|
}
|
|
85527
85912
|
function pruneContinuations(continuations, stack) {
|
|
85528
85913
|
const scopes = /* @__PURE__ */ new Set([-1, ...stack.map((frame) => frame.openingOffset)]);
|
|
@@ -85533,20 +85918,11 @@ function delimiterDepth(stack) {
|
|
|
85533
85918
|
return stack.filter((frame) => frame.contributes).length;
|
|
85534
85919
|
}
|
|
85535
85920
|
function cloneDelimiterStack(stack) {
|
|
85536
|
-
|
|
85921
|
+
return stack.map((frame) => ({
|
|
85537
85922
|
text: frame.text,
|
|
85538
|
-
openingLine: frame.openingLine,
|
|
85539
85923
|
openingOffset: frame.openingOffset,
|
|
85540
85924
|
contributes: frame.contributes
|
|
85541
85925
|
}));
|
|
85542
|
-
for (let index = 0; index < stack.length; index++) {
|
|
85543
|
-
const restores = stack[index]?.restores;
|
|
85544
|
-
if (!restores) continue;
|
|
85545
|
-
const restoreIndex = stack.indexOf(restores);
|
|
85546
|
-
if (restoreIndex < 0) continue;
|
|
85547
|
-
clones[index] = { ...clones[index], restores: clones[restoreIndex] };
|
|
85548
|
-
}
|
|
85549
|
-
return clones;
|
|
85550
85926
|
}
|
|
85551
85927
|
function matchingOpeningDelimiter(value) {
|
|
85552
85928
|
switch (value) {
|
|
@@ -97298,7 +97674,11 @@ function validateMember(uri, member, ownerName, documentKind, ownerScope, enviro
|
|
|
97298
97674
|
member.initializer.text,
|
|
97299
97675
|
memberType2,
|
|
97300
97676
|
scope,
|
|
97301
|
-
|
|
97677
|
+
{
|
|
97678
|
+
...environment,
|
|
97679
|
+
staticMember: member.modifiers.includes("static"),
|
|
97680
|
+
checkComputedInitializers: true
|
|
97681
|
+
},
|
|
97302
97682
|
member.initializer.range,
|
|
97303
97683
|
diagnostics,
|
|
97304
97684
|
anchorOf(member.initializer),
|
|
@@ -98222,6 +98602,80 @@ function knownGeneratorExpression(expression, scope, environment) {
|
|
|
98222
98602
|
return candidates !== void 0 && candidates.length > 0 && candidates.every((member) => member.generator === true);
|
|
98223
98603
|
}
|
|
98224
98604
|
function validateExpression(expression, expected, scope, environment, uri, range2, diagnostics, anchor, storedValue = true) {
|
|
98605
|
+
const sourceOnly = expected !== void 0 && (isNeoVariantTypeName(expected.name) || expected.name === "NeoAction" || expected.name === "ImageRef");
|
|
98606
|
+
let receiver = expression;
|
|
98607
|
+
if (environment.checkComputedInitializers) {
|
|
98608
|
+
while (receiver.kind === "member") receiver = receiver.receiver;
|
|
98609
|
+
}
|
|
98610
|
+
const computed = environment.checkComputedInitializers && !sourceOnly && (expression.kind === "member" && (receiver.kind !== "ident" || receiver.typeQualifier !== void 0) || [
|
|
98611
|
+
"binary",
|
|
98612
|
+
"unary",
|
|
98613
|
+
"force",
|
|
98614
|
+
"coalesce",
|
|
98615
|
+
"conditional",
|
|
98616
|
+
"switchExpression",
|
|
98617
|
+
"is",
|
|
98618
|
+
"lambda",
|
|
98619
|
+
"index",
|
|
98620
|
+
"litInterp",
|
|
98621
|
+
"litTripleString",
|
|
98622
|
+
"call"
|
|
98623
|
+
].includes(expression.kind)) && !isReferenceCall(expression);
|
|
98624
|
+
const count = diagnostics.length;
|
|
98625
|
+
validateStoredExpression(
|
|
98626
|
+
expression,
|
|
98627
|
+
expected,
|
|
98628
|
+
scope,
|
|
98629
|
+
computed || sourceOnly || expression.kind === "member" ? { ...environment, checkComputedInitializers: false } : environment,
|
|
98630
|
+
uri,
|
|
98631
|
+
range2,
|
|
98632
|
+
diagnostics,
|
|
98633
|
+
anchor,
|
|
98634
|
+
storedValue
|
|
98635
|
+
);
|
|
98636
|
+
if (!computed || diagnostics.length !== count) return;
|
|
98637
|
+
const { context, resolver, parameterNames, parameterTypes } = initializerResolver(
|
|
98638
|
+
environment,
|
|
98639
|
+
scope.get("this")?.name ?? "",
|
|
98640
|
+
environment.staticMember,
|
|
98641
|
+
"initializer"
|
|
98642
|
+
);
|
|
98643
|
+
try {
|
|
98644
|
+
const reads = new Set(
|
|
98645
|
+
collectIdentifierReads(expression, parameterNames).map(
|
|
98646
|
+
(read) => read.name
|
|
98647
|
+
)
|
|
98648
|
+
);
|
|
98649
|
+
const parameters = [...reads].map((name) => ({
|
|
98650
|
+
name,
|
|
98651
|
+
type: parameterTypes.get(name)
|
|
98652
|
+
}));
|
|
98653
|
+
const scopedResolver = parameters.length === 0 ? resolver : new StrictNeoScriptResolver(
|
|
98654
|
+
{ ...context, parameters },
|
|
98655
|
+
environment.projectIndex,
|
|
98656
|
+
void 0,
|
|
98657
|
+
{ allowPendingRegistryEntries: true }
|
|
98658
|
+
);
|
|
98659
|
+
scopedResolver.validateInitializerExpression(
|
|
98660
|
+
expression,
|
|
98661
|
+
expected === void 0 ? void 0 : resolveNeoScriptType(
|
|
98662
|
+
semanticAst(expected, expression.pos),
|
|
98663
|
+
context,
|
|
98664
|
+
environment.projectIndex
|
|
98665
|
+
)
|
|
98666
|
+
);
|
|
98667
|
+
} catch (error) {
|
|
98668
|
+
if (!(error instanceof CompileError)) throw error;
|
|
98669
|
+
pushDiagnostic(
|
|
98670
|
+
diagnostics,
|
|
98671
|
+
uri,
|
|
98672
|
+
anchor ? anchorSpan(anchor, error, 1) : range2,
|
|
98673
|
+
"invalid-computed-initializer",
|
|
98674
|
+
error.message.replace(/^\d+:\d+: /, "")
|
|
98675
|
+
);
|
|
98676
|
+
}
|
|
98677
|
+
}
|
|
98678
|
+
function validateStoredExpression(expression, expected, scope, environment, uri, range2, diagnostics, anchor, storedValue = true) {
|
|
98225
98679
|
if (anchor !== void 0 && expression.kind === "call") {
|
|
98226
98680
|
const error = sourceCallBinding(expression, scope, environment)?.error;
|
|
98227
98681
|
if (error?.message.includes(
|
|
@@ -98446,7 +98900,7 @@ function validateExpression(expression, expected, scope, environment, uri, range
|
|
|
98446
98900
|
// Enum dictionaries also preserve quoted option IDs, including orphaned IDs.
|
|
98447
98901
|
entry.key.kind === "litString" ? void 0 : key,
|
|
98448
98902
|
scope,
|
|
98449
|
-
environment,
|
|
98903
|
+
{ ...environment, checkComputedInitializers: false },
|
|
98450
98904
|
uri,
|
|
98451
98905
|
range2,
|
|
98452
98906
|
diagnostics,
|
|
@@ -98628,6 +99082,17 @@ function validateExpression(expression, expected, scope, environment, uri, range
|
|
|
98628
99082
|
}
|
|
98629
99083
|
if (expression.kind === "new") {
|
|
98630
99084
|
const typeName = expression.className ?? expected?.name;
|
|
99085
|
+
if (typeName === "List" || typeName === "Set" || typeName === "Dictionary") {
|
|
99086
|
+
const literal3 = typeName === "Dictionary" ? "{}" : "[]";
|
|
99087
|
+
pushDiagnostic(
|
|
99088
|
+
diagnostics,
|
|
99089
|
+
uri,
|
|
99090
|
+
anchor ? anchorSpan(anchor, expression.pos, 3) : range2,
|
|
99091
|
+
"collection-construction",
|
|
99092
|
+
`${typeName} has no constructor. Use ${literal3} for an empty collection.`
|
|
99093
|
+
);
|
|
99094
|
+
return;
|
|
99095
|
+
}
|
|
98631
99096
|
const declaration = typeName ? environment.types.get(typeName) : void 0;
|
|
98632
99097
|
for (const entry of expression.initializer ?? []) {
|
|
98633
99098
|
if (entry.name !== "layerClassId") continue;
|
|
@@ -99561,24 +100026,49 @@ function wrappedTypeParameterConstruction(declaration, typeArguments, scope, env
|
|
|
99561
100026
|
}
|
|
99562
100027
|
return target.kind === "named" ? wrappedTypeParameterMessage(target, environment.projectIndex) : null;
|
|
99563
100028
|
}
|
|
99564
|
-
function initializerResolver(environment, thisName, staticMember) {
|
|
100029
|
+
function initializerResolver(environment, thisName, staticMember, kind = "initializerExpression") {
|
|
99565
100030
|
const declaring = environment.projectIndex.typeByName.get(thisName);
|
|
99566
|
-
const key = `${declaring?.id ?? ""}:${staticMember}`;
|
|
100031
|
+
const key = `${declaring?.id ?? ""}:${staticMember}:${kind}`;
|
|
99567
100032
|
let entry = environment.initializerResolvers.get(key);
|
|
99568
100033
|
if (entry === void 0) {
|
|
99569
100034
|
const declaringType = declaring ? { kind: "named", typeId: declaring.id } : void 0;
|
|
99570
100035
|
const context = {
|
|
99571
100036
|
project: environment.project,
|
|
99572
|
-
kind
|
|
100037
|
+
kind,
|
|
99573
100038
|
...declaringType ? {
|
|
99574
100039
|
declaringType,
|
|
99575
100040
|
implicitMemberAccess: true,
|
|
99576
100041
|
...staticMember ? { staticMember } : { thisClass: declaringType }
|
|
99577
100042
|
} : {}
|
|
99578
100043
|
};
|
|
100044
|
+
const parameterTypes = /* @__PURE__ */ new Map();
|
|
100045
|
+
if (kind === "initializer" && !staticMember) {
|
|
100046
|
+
const owner = environment.types.get(thisName);
|
|
100047
|
+
for (const parameter4 of owner?.headerParameters ?? []) {
|
|
100048
|
+
try {
|
|
100049
|
+
parameterTypes.set(
|
|
100050
|
+
parameter4.name,
|
|
100051
|
+
resolveNeoScriptType(
|
|
100052
|
+
semanticAst(semanticType(parameter4.type), { line: 1, column: 1 }),
|
|
100053
|
+
context,
|
|
100054
|
+
environment.projectIndex
|
|
100055
|
+
)
|
|
100056
|
+
);
|
|
100057
|
+
} catch (error) {
|
|
100058
|
+
if (!(error instanceof CompileError)) throw error;
|
|
100059
|
+
}
|
|
100060
|
+
}
|
|
100061
|
+
}
|
|
99579
100062
|
entry = {
|
|
99580
100063
|
context,
|
|
99581
|
-
|
|
100064
|
+
parameterNames: new Set(parameterTypes.keys()),
|
|
100065
|
+
parameterTypes,
|
|
100066
|
+
resolver: new StrictNeoScriptResolver(
|
|
100067
|
+
context,
|
|
100068
|
+
environment.projectIndex,
|
|
100069
|
+
void 0,
|
|
100070
|
+
{ allowPendingRegistryEntries: true }
|
|
100071
|
+
)
|
|
99582
100072
|
};
|
|
99583
100073
|
environment.initializerResolvers.set(key, entry);
|
|
99584
100074
|
}
|
|
@@ -100128,7 +100618,7 @@ function validatePlaceReference(expression, expected, thisName, environment, rep
|
|
|
100128
100618
|
environment.staticMember
|
|
100129
100619
|
);
|
|
100130
100620
|
try {
|
|
100131
|
-
resolver.
|
|
100621
|
+
resolver.validateInitializerExpression(
|
|
100132
100622
|
expression,
|
|
100133
100623
|
expected === void 0 ? void 0 : resolveNeoScriptType(
|
|
100134
100624
|
semanticAst(expected, expression.pos),
|
|
@@ -141733,8 +142223,8 @@ var init_project_commit_preparation_scoped_loader = __esm({
|
|
|
141733
142223
|
// ../src/database/compiled-construction-types.ts
|
|
141734
142224
|
function compiledConstructionTypeMembers(members2, bodies, projectId) {
|
|
141735
142225
|
const created = [];
|
|
141736
|
-
const
|
|
141737
|
-
let
|
|
142226
|
+
const processedKeys = [];
|
|
142227
|
+
let existingMembers;
|
|
141738
142228
|
const byType = /* @__PURE__ */ new Map();
|
|
141739
142229
|
const key = (type2) => canonicalJsonStringify(type2);
|
|
141740
142230
|
const intern = (type2, slot) => {
|
|
@@ -141747,21 +142237,21 @@ function compiledConstructionTypeMembers(members2, bodies, projectId) {
|
|
|
141747
142237
|
`neo:compiled-construction-type:${projectId}:${cacheKey}`,
|
|
141748
142238
|
v5_default.URL
|
|
141749
142239
|
);
|
|
141750
|
-
|
|
141751
|
-
|
|
141752
|
-
|
|
141753
|
-
return id2;
|
|
141754
|
-
}
|
|
142240
|
+
existingMembers ??= new Map(members2.map((member) => [member.id, member]));
|
|
142241
|
+
const storedMember = existingMembers.get(id2);
|
|
142242
|
+
const alreadyStored = storedMember !== void 0;
|
|
141755
142243
|
const common = {
|
|
141756
142244
|
id: id2,
|
|
141757
142245
|
projectId,
|
|
141758
142246
|
createdAt: 0,
|
|
141759
142247
|
updatedAt: 0,
|
|
141760
142248
|
name: slot?.name ?? "Type argument",
|
|
142249
|
+
...slot?.format === void 0 ? {} : { format: slot.format },
|
|
141761
142250
|
kind: type2.type,
|
|
141762
142251
|
requirement: type2.required ? 1 /* Required */ : 0 /* Optional */
|
|
141763
142252
|
};
|
|
141764
142253
|
const mark = created.length;
|
|
142254
|
+
const processedMark = processedKeys.length;
|
|
141765
142255
|
const fields = (() => {
|
|
141766
142256
|
if (type2.type === 30 /* Tuple */) {
|
|
141767
142257
|
const elementMemberIds = [];
|
|
@@ -141776,7 +142266,15 @@ function compiledConstructionTypeMembers(members2, bodies, projectId) {
|
|
|
141776
142266
|
return { elementMemberIds };
|
|
141777
142267
|
}
|
|
141778
142268
|
if (type2.type === 6 /* List */ || type2.type === 28 /* Set */ || type2.type === 5 /* Dictionary */) {
|
|
141779
|
-
const
|
|
142269
|
+
const storedEntryId = getField(storedMember, "entryMemberId");
|
|
142270
|
+
const entryMemberId = intern(
|
|
142271
|
+
type2.entryTypeInfo,
|
|
142272
|
+
type2.type === 28 /* Set */ && type2.entryTypeInfo.type === 3 /* String */ ? {
|
|
142273
|
+
id: typeof storedEntryId === "string" ? storedEntryId : derivedEntryMemberId(id2),
|
|
142274
|
+
name: "Item",
|
|
142275
|
+
format: 1 /* Plain */
|
|
142276
|
+
} : void 0
|
|
142277
|
+
);
|
|
141780
142278
|
if (entryMemberId === null) return null;
|
|
141781
142279
|
return {
|
|
141782
142280
|
entryMemberId,
|
|
@@ -141808,6 +142306,16 @@ function compiledConstructionTypeMembers(members2, bodies, projectId) {
|
|
|
141808
142306
|
} else if (type2.type === 26 /* NSAction */) {
|
|
141809
142307
|
return { argumentTypes: namedArguments2(type2.argumentTypes) };
|
|
141810
142308
|
} else if (type2.type === 29 /* Reference */) {
|
|
142309
|
+
const target = type2.targetTypeInfo;
|
|
142310
|
+
if (target.type === 6 /* List */ || target.type === 5 /* Dictionary */ || target.type === 28 /* Set */) {
|
|
142311
|
+
intern(target);
|
|
142312
|
+
} else if (target.type === 9 /* Lookup */ && target.collectionMemberId === void 0 && target.collectionValueId === void 0 && target.entryTypeInfo.type !== NS_TYPE_UNKNOWN && target.entryTypeInfo.required && SET_ENTRY_MEMBER_KINDS.has(target.entryTypeInfo.type)) {
|
|
142313
|
+
intern({
|
|
142314
|
+
type: 28 /* Set */,
|
|
142315
|
+
required: target.required,
|
|
142316
|
+
entryTypeInfo: target.entryTypeInfo
|
|
142317
|
+
});
|
|
142318
|
+
}
|
|
141811
142319
|
return {
|
|
141812
142320
|
kind: 9 /* Lookup */,
|
|
141813
142321
|
declaredTypeInfo: type2.targetTypeInfo
|
|
@@ -141819,13 +142327,16 @@ function compiledConstructionTypeMembers(members2, bodies, projectId) {
|
|
|
141819
142327
|
}
|
|
141820
142328
|
})();
|
|
141821
142329
|
if (fields === null) {
|
|
141822
|
-
for (const member of created.splice(mark))
|
|
141823
|
-
|
|
141824
|
-
|
|
141825
|
-
|
|
141826
|
-
|
|
141827
|
-
|
|
141828
|
-
|
|
142330
|
+
for (const member of created.splice(mark))
|
|
142331
|
+
existingMembers.delete(member.id);
|
|
142332
|
+
for (const key2 of processedKeys.splice(processedMark)) byType.delete(key2);
|
|
142333
|
+
if (!alreadyStored) return null;
|
|
142334
|
+
} else if (!alreadyStored) {
|
|
142335
|
+
const member = { ...common, ...fields };
|
|
142336
|
+
created.push(member);
|
|
142337
|
+
existingMembers.set(id2, member);
|
|
142338
|
+
}
|
|
142339
|
+
processedKeys.push(cacheKey);
|
|
141829
142340
|
byType.set(cacheKey, id2);
|
|
141830
142341
|
return id2;
|
|
141831
142342
|
};
|
|
@@ -141877,10 +142388,12 @@ var init_compiled_construction_types = __esm({
|
|
|
141877
142388
|
"use strict";
|
|
141878
142389
|
init_dist_node();
|
|
141879
142390
|
init_core();
|
|
142391
|
+
init_set_entry_keys();
|
|
141880
142392
|
init_neoscript_guards();
|
|
141881
142393
|
init_neoscript();
|
|
141882
142394
|
init_project_content_hash();
|
|
141883
142395
|
init_tuple_element_member_id();
|
|
142396
|
+
init_entry_member_id();
|
|
141884
142397
|
}
|
|
141885
142398
|
});
|
|
141886
142399
|
|
|
@@ -239894,7 +240407,7 @@ var releaseWorkspaceLock = () => void 0;
|
|
|
239894
240407
|
async function main() {
|
|
239895
240408
|
const args = parseArgs(process.argv.slice(2));
|
|
239896
240409
|
if (args.command === "--version") {
|
|
239897
|
-
console.log("0.89.
|
|
240410
|
+
console.log("0.89.8");
|
|
239898
240411
|
return;
|
|
239899
240412
|
}
|
|
239900
240413
|
if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
|