@neocompose/cli 0.26.4 → 0.26.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/neo.mjs
CHANGED
|
@@ -41382,8 +41382,8 @@ function envFromStamp(stamp) {
|
|
|
41382
41382
|
}
|
|
41383
41383
|
return env;
|
|
41384
41384
|
}
|
|
41385
|
-
function substituteMember(member, env, members) {
|
|
41386
|
-
const resolved = resolveMember2(member, members);
|
|
41385
|
+
function substituteMember(member, env, members, preResolvedMember) {
|
|
41386
|
+
const resolved = preResolvedMember ?? resolveMember2(member, members);
|
|
41387
41387
|
if (isMemberGenericBase(resolved)) {
|
|
41388
41388
|
const binding = substituteMember(
|
|
41389
41389
|
resolveTerminalBinding(
|
|
@@ -42342,6 +42342,12 @@ function stampCreatedValuesMapKey(values, mapKey) {
|
|
|
42342
42342
|
}
|
|
42343
42343
|
}
|
|
42344
42344
|
function applyDeclaredStorageKeyOverrides(args) {
|
|
42345
|
+
const boundaryValues = args.createdValues.filter(
|
|
42346
|
+
(value) => normalizeStorageKeyDeclaration(
|
|
42347
|
+
args.declarationByValueId.get(value.id)
|
|
42348
|
+
) !== STORAGE_KEY_INHERIT
|
|
42349
|
+
);
|
|
42350
|
+
if (boundaryValues.length === 0) return;
|
|
42345
42351
|
const createdById = new Map(
|
|
42346
42352
|
args.createdValues.map((value) => [value.id, value])
|
|
42347
42353
|
);
|
|
@@ -42367,12 +42373,7 @@ function applyDeclaredStorageKeyOverrides(args) {
|
|
|
42367
42373
|
}
|
|
42368
42374
|
return depth;
|
|
42369
42375
|
};
|
|
42370
|
-
const boundaries =
|
|
42371
|
-
const declaration = normalizeStorageKeyDeclaration(
|
|
42372
|
-
args.declarationByValueId.get(value.id)
|
|
42373
|
-
);
|
|
42374
|
-
return declaration !== STORAGE_KEY_INHERIT;
|
|
42375
|
-
}).sort((left, right) => depthOf(left) - depthOf(right));
|
|
42376
|
+
const boundaries = boundaryValues.sort((left, right) => depthOf(left) - depthOf(right));
|
|
42376
42377
|
for (const boundary of boundaries) {
|
|
42377
42378
|
const parentCreated = parentOf.get(boundary.id);
|
|
42378
42379
|
const parent = parentCreated !== void 0 ? {
|
|
@@ -43567,7 +43568,59 @@ function descendPositionThroughMember(position, memberId) {
|
|
|
43567
43568
|
}
|
|
43568
43569
|
function recordStorageKeyDeclaration(sink, valueId, member) {
|
|
43569
43570
|
if (sink === void 0) return;
|
|
43570
|
-
|
|
43571
|
+
const declaration = normalizeStorageKeyDeclaration(member.storageKey);
|
|
43572
|
+
if (declaration === STORAGE_KEY_INHERIT) return;
|
|
43573
|
+
sink.set(valueId, declaration);
|
|
43574
|
+
}
|
|
43575
|
+
function documentHasInitValueContent(document, value) {
|
|
43576
|
+
return document.isInitValueContent?.(value) ?? isInitValueContent(value);
|
|
43577
|
+
}
|
|
43578
|
+
function createDocumentValueRow(document, projectId, body) {
|
|
43579
|
+
return document.createValueRow?.(projectId, body) ?? buildNewValue(projectId, body);
|
|
43580
|
+
}
|
|
43581
|
+
function directScalarDefaultBody(document, member) {
|
|
43582
|
+
if (member.kind !== 1 /* Bool */ && member.kind !== 2 /* Int */ && member.kind !== 4 /* Float */ && member.kind !== 3 /* String */ && member.kind !== 20 /* Decimal */ && member.kind !== 8 /* Enum */ && member.kind !== 0 /* Null */) {
|
|
43583
|
+
return void 0;
|
|
43584
|
+
}
|
|
43585
|
+
if (!member.required && (member.defaultValue === void 0 || member.defaultValue === null)) {
|
|
43586
|
+
return void 0;
|
|
43587
|
+
}
|
|
43588
|
+
if (documentHasInitValueContent(document, member.defaultValue)) {
|
|
43589
|
+
return void 0;
|
|
43590
|
+
}
|
|
43591
|
+
const body = member.defaultValue ?? primitiveFallbackValue(document, member);
|
|
43592
|
+
if (!isLiteralValueContent(body)) return void 0;
|
|
43593
|
+
if (body.value !== null && typeof body.value !== "boolean" && typeof body.value !== "number" && typeof body.value !== "string") {
|
|
43594
|
+
return void 0;
|
|
43595
|
+
}
|
|
43596
|
+
validateProjectDocumentFileMemberValue(
|
|
43597
|
+
document,
|
|
43598
|
+
member,
|
|
43599
|
+
body,
|
|
43600
|
+
DECLARATION_DEFAULT_POSITION
|
|
43601
|
+
);
|
|
43602
|
+
return { value: body.value, classId: body.classId };
|
|
43603
|
+
}
|
|
43604
|
+
function buildDefaultClassMaterializationPlan(document, classId, instanceEnv) {
|
|
43605
|
+
const merged = document.storedInstanceSchema?.(classId) ?? mergeStoredInstanceSchema(classId, document.classes, document.members);
|
|
43606
|
+
return merged.flatMap((entry) => {
|
|
43607
|
+
if (entry.memberId === null) return [];
|
|
43608
|
+
const childMember = findMemberInDocument(document, entry.memberId);
|
|
43609
|
+
if (!memberKindOwnsStoredValue(childMember.kind)) return [];
|
|
43610
|
+
const member = substituteMember(
|
|
43611
|
+
childMember,
|
|
43612
|
+
instanceEnv,
|
|
43613
|
+
document.members,
|
|
43614
|
+
document.resolvedMember?.(childMember)
|
|
43615
|
+
);
|
|
43616
|
+
return [
|
|
43617
|
+
{
|
|
43618
|
+
schemaKey: entry.schemaKey,
|
|
43619
|
+
member,
|
|
43620
|
+
directScalarBody: directScalarDefaultBody(document, member)
|
|
43621
|
+
}
|
|
43622
|
+
];
|
|
43623
|
+
});
|
|
43571
43624
|
}
|
|
43572
43625
|
function assertLookupInitializerLiteral(member, literal2) {
|
|
43573
43626
|
if (!isMemberLookupBase(member)) return;
|
|
@@ -43589,7 +43642,6 @@ function assertLookupInitializerLiteral(member, literal2) {
|
|
|
43589
43642
|
function evaluateLiteralContainer(args) {
|
|
43590
43643
|
const body = args.body;
|
|
43591
43644
|
if (body === void 0) return void 0;
|
|
43592
|
-
if (!isInitValueContent(body)) return { literal: body };
|
|
43593
43645
|
if (args.initEvaluator === void 0) {
|
|
43594
43646
|
throw new Error(
|
|
43595
43647
|
`Cannot materialize member "${args.member.name}": its value is a NeoScript initializer, which this builder cannot evaluate. Supply an initEvaluator.`
|
|
@@ -43621,9 +43673,16 @@ function evaluateLiteralContainer(args) {
|
|
|
43621
43673
|
};
|
|
43622
43674
|
}
|
|
43623
43675
|
function buildDefaultMemberValue(args) {
|
|
43624
|
-
const
|
|
43676
|
+
const resolvedMember = args.document.resolvedMember?.(args.member) ?? resolveMember2(args.member, args.document.members);
|
|
43677
|
+
const member = args.genericEnv !== void 0 ? substituteMember(
|
|
43678
|
+
args.member,
|
|
43679
|
+
args.genericEnv,
|
|
43680
|
+
args.document.members,
|
|
43681
|
+
resolvedMember
|
|
43682
|
+
) : resolvedMember;
|
|
43625
43683
|
const declaredDefault = member.defaultValue;
|
|
43626
|
-
if (
|
|
43684
|
+
if (documentHasInitValueContent(args.document, declaredDefault)) {
|
|
43685
|
+
const initializerCreatedValuesStart = args.createdValues.length;
|
|
43627
43686
|
const evaluated = evaluateLiteralContainer({
|
|
43628
43687
|
body: declaredDefault,
|
|
43629
43688
|
member,
|
|
@@ -43637,13 +43696,17 @@ function buildDefaultMemberValue(args) {
|
|
|
43637
43696
|
if (evaluated.existingValueRow !== void 0) {
|
|
43638
43697
|
return evaluated.existingValueRow;
|
|
43639
43698
|
}
|
|
43640
|
-
const value2 =
|
|
43699
|
+
const value2 = createDocumentValueRow(
|
|
43700
|
+
args.document,
|
|
43701
|
+
args.projectId,
|
|
43702
|
+
evaluated.literal
|
|
43703
|
+
);
|
|
43641
43704
|
if (evaluated.genericBindings !== void 0) {
|
|
43642
43705
|
value2.genericBindings = { ...evaluated.genericBindings };
|
|
43643
43706
|
}
|
|
43644
43707
|
if (evaluated.provisionalRootId !== void 0) {
|
|
43645
43708
|
retargetDelegateReceiverValueIds(
|
|
43646
|
-
[value2, ...args.createdValues],
|
|
43709
|
+
[value2, ...args.createdValues.slice(initializerCreatedValuesStart)],
|
|
43647
43710
|
evaluated.provisionalRootId,
|
|
43648
43711
|
value2.id
|
|
43649
43712
|
);
|
|
@@ -43659,7 +43722,11 @@ function buildDefaultMemberValue(args) {
|
|
|
43659
43722
|
`Required Class member "${member.name}" cannot have a null default.`
|
|
43660
43723
|
);
|
|
43661
43724
|
}
|
|
43662
|
-
const value3 =
|
|
43725
|
+
const value3 = createDocumentValueRow(
|
|
43726
|
+
args.document,
|
|
43727
|
+
args.projectId,
|
|
43728
|
+
declaredDefault
|
|
43729
|
+
);
|
|
43663
43730
|
args.createdValues.push(value3);
|
|
43664
43731
|
recordStorageKeyDeclaration(
|
|
43665
43732
|
args.storageKeyDeclarations,
|
|
@@ -43685,7 +43752,7 @@ function buildDefaultMemberValue(args) {
|
|
|
43685
43752
|
`Cannot create a value of abstract class "${effectiveClass.name}".`
|
|
43686
43753
|
);
|
|
43687
43754
|
}
|
|
43688
|
-
const childEnv = resolveInstanceEnv(
|
|
43755
|
+
const childEnv = args.document.instanceEnv?.(effectiveClassId, member.classArguments) ?? resolveInstanceEnv(
|
|
43689
43756
|
effectiveClassId,
|
|
43690
43757
|
member.classArguments,
|
|
43691
43758
|
args.document.classes
|
|
@@ -43710,10 +43777,13 @@ function buildDefaultMemberValue(args) {
|
|
|
43710
43777
|
);
|
|
43711
43778
|
}
|
|
43712
43779
|
}
|
|
43713
|
-
const
|
|
43780
|
+
const materializationPlan = args.document.storedInstanceMaterializationPlan?.(
|
|
43714
43781
|
effectiveClassId,
|
|
43715
|
-
|
|
43716
|
-
|
|
43782
|
+
childEnv
|
|
43783
|
+
) ?? buildDefaultClassMaterializationPlan(
|
|
43784
|
+
args.document,
|
|
43785
|
+
effectiveClassId,
|
|
43786
|
+
childEnv
|
|
43717
43787
|
);
|
|
43718
43788
|
const record3 = member.partial === true ? {} : cloneDefaultClassRecord({
|
|
43719
43789
|
document: args.document,
|
|
@@ -43733,39 +43803,43 @@ function buildDefaultMemberValue(args) {
|
|
|
43733
43803
|
position: DECLARATION_DEFAULT_POSITION
|
|
43734
43804
|
});
|
|
43735
43805
|
let anchorsParentClassPartition = false;
|
|
43736
|
-
for (const
|
|
43737
|
-
|
|
43738
|
-
|
|
43739
|
-
|
|
43740
|
-
|
|
43741
|
-
childMember,
|
|
43742
|
-
childEnv,
|
|
43743
|
-
args.document.members
|
|
43744
|
-
);
|
|
43806
|
+
for (const {
|
|
43807
|
+
schemaKey,
|
|
43808
|
+
member: resolvedChildMember,
|
|
43809
|
+
directScalarBody
|
|
43810
|
+
} of member.partial === true ? [] : materializationPlan) {
|
|
43745
43811
|
if (storageKeyReferencesParentClass(
|
|
43746
43812
|
normalizeStorageKeyDeclaration(resolvedChildMember.storageKey)
|
|
43747
43813
|
)) {
|
|
43748
43814
|
anchorsParentClassPartition = true;
|
|
43749
43815
|
}
|
|
43750
|
-
if (record3[
|
|
43751
|
-
if (args.authoredRoot?.suppliedSchemaKeys.has(
|
|
43816
|
+
if (record3[schemaKey] !== void 0) continue;
|
|
43817
|
+
if (args.authoredRoot?.suppliedSchemaKeys.has(schemaKey) === true) {
|
|
43752
43818
|
continue;
|
|
43753
43819
|
}
|
|
43754
43820
|
if (skipProvidedConstructorSchemaKey(
|
|
43755
43821
|
args.constructorRoot,
|
|
43756
|
-
|
|
43757
|
-
resolvedChildMember
|
|
43822
|
+
schemaKey,
|
|
43823
|
+
resolvedChildMember,
|
|
43824
|
+
documentHasInitValueContent(
|
|
43825
|
+
args.document,
|
|
43826
|
+
resolvedChildMember.defaultValue
|
|
43827
|
+
)
|
|
43758
43828
|
)) {
|
|
43759
43829
|
continue;
|
|
43760
43830
|
}
|
|
43761
43831
|
if (!shouldMaterializeChildDefaultForRoot(
|
|
43762
43832
|
args.constructorRoot,
|
|
43763
|
-
resolvedChildMember
|
|
43833
|
+
resolvedChildMember,
|
|
43834
|
+
documentHasInitValueContent(
|
|
43835
|
+
args.document,
|
|
43836
|
+
resolvedChildMember.defaultValue
|
|
43837
|
+
)
|
|
43764
43838
|
)) {
|
|
43765
43839
|
continue;
|
|
43766
43840
|
}
|
|
43767
43841
|
if (shouldSkipRequiredChildDefault(resolvedChildMember)) continue;
|
|
43768
|
-
const childValue = buildDefaultMemberValue({
|
|
43842
|
+
const childValue = directScalarBody === void 0 ? buildDefaultMemberValue({
|
|
43769
43843
|
document: args.document,
|
|
43770
43844
|
projectId: args.projectId,
|
|
43771
43845
|
member: resolvedChildMember,
|
|
@@ -43773,13 +43847,29 @@ function buildDefaultMemberValue(args) {
|
|
|
43773
43847
|
storageKeyDeclarations: args.storageKeyDeclarations,
|
|
43774
43848
|
initEvaluator: args.initEvaluator,
|
|
43775
43849
|
genericEnv: childEnv
|
|
43776
|
-
})
|
|
43777
|
-
|
|
43850
|
+
}) : createDocumentValueRow(
|
|
43851
|
+
args.document,
|
|
43852
|
+
args.projectId,
|
|
43853
|
+
directScalarBody
|
|
43854
|
+
);
|
|
43855
|
+
if (directScalarBody !== void 0) {
|
|
43856
|
+
args.createdValues.push(childValue);
|
|
43857
|
+
recordStorageKeyDeclaration(
|
|
43858
|
+
args.storageKeyDeclarations,
|
|
43859
|
+
childValue.id,
|
|
43860
|
+
resolvedChildMember
|
|
43861
|
+
);
|
|
43862
|
+
}
|
|
43863
|
+
record3[schemaKey] = childValue.id;
|
|
43778
43864
|
}
|
|
43779
|
-
const value2 =
|
|
43780
|
-
|
|
43781
|
-
|
|
43782
|
-
|
|
43865
|
+
const value2 = createDocumentValueRow(
|
|
43866
|
+
args.document,
|
|
43867
|
+
args.projectId,
|
|
43868
|
+
{
|
|
43869
|
+
value: record3,
|
|
43870
|
+
classId: member.partial === true || effectiveClassId !== member.classId || anchorsParentClassPartition ? effectiveClassId : void 0
|
|
43871
|
+
}
|
|
43872
|
+
);
|
|
43783
43873
|
args.createdValues.push(value2);
|
|
43784
43874
|
recordStorageKeyDeclaration(args.storageKeyDeclarations, value2.id, member);
|
|
43785
43875
|
return value2;
|
|
@@ -43797,7 +43887,11 @@ function buildDefaultMemberValue(args) {
|
|
|
43797
43887
|
path: /* @__PURE__ */ new Set(),
|
|
43798
43888
|
position: DECLARATION_DEFAULT_POSITION
|
|
43799
43889
|
});
|
|
43800
|
-
const value2 =
|
|
43890
|
+
const value2 = createDocumentValueRow(
|
|
43891
|
+
args.document,
|
|
43892
|
+
args.projectId,
|
|
43893
|
+
record3
|
|
43894
|
+
);
|
|
43801
43895
|
stampGenericBindings(value2, member, args);
|
|
43802
43896
|
args.createdValues.push(value2);
|
|
43803
43897
|
recordStorageKeyDeclaration(args.storageKeyDeclarations, value2.id, member);
|
|
@@ -43816,14 +43910,20 @@ function buildDefaultMemberValue(args) {
|
|
|
43816
43910
|
path: /* @__PURE__ */ new Set(),
|
|
43817
43911
|
position: DECLARATION_DEFAULT_POSITION
|
|
43818
43912
|
});
|
|
43819
|
-
const value2 =
|
|
43913
|
+
const value2 = createDocumentValueRow(
|
|
43914
|
+
args.document,
|
|
43915
|
+
args.projectId,
|
|
43916
|
+
list
|
|
43917
|
+
);
|
|
43820
43918
|
stampGenericBindings(value2, member, args);
|
|
43821
43919
|
args.createdValues.push(value2);
|
|
43822
43920
|
recordStorageKeyDeclaration(args.storageKeyDeclarations, value2.id, member);
|
|
43823
43921
|
return value2;
|
|
43824
43922
|
}
|
|
43825
43923
|
if (isMemberNullBase(member)) {
|
|
43826
|
-
const value2 =
|
|
43924
|
+
const value2 = createDocumentValueRow(args.document, args.projectId, {
|
|
43925
|
+
value: null
|
|
43926
|
+
});
|
|
43827
43927
|
args.createdValues.push(value2);
|
|
43828
43928
|
recordStorageKeyDeclaration(args.storageKeyDeclarations, value2.id, member);
|
|
43829
43929
|
return value2;
|
|
@@ -43843,30 +43943,33 @@ function buildDefaultMemberValue(args) {
|
|
|
43843
43943
|
DECLARATION_DEFAULT_POSITION
|
|
43844
43944
|
);
|
|
43845
43945
|
}
|
|
43846
|
-
const value =
|
|
43946
|
+
const value = createDocumentValueRow(
|
|
43947
|
+
args.document,
|
|
43948
|
+
args.projectId,
|
|
43949
|
+
clonedBody
|
|
43950
|
+
);
|
|
43847
43951
|
args.createdValues.push(value);
|
|
43848
43952
|
recordStorageKeyDeclaration(args.storageKeyDeclarations, value.id, member);
|
|
43849
43953
|
return value;
|
|
43850
43954
|
}
|
|
43851
|
-
function buildNewValue(projectId, body) {
|
|
43955
|
+
function buildNewValue(projectId, body, timestamp = Date.now()) {
|
|
43852
43956
|
if (isInitValueContent(body)) {
|
|
43853
43957
|
throw new Error(
|
|
43854
43958
|
"Cannot build a value row from an initializer-backed container: the initializer must be evaluated into a literal value first."
|
|
43855
43959
|
);
|
|
43856
43960
|
}
|
|
43857
|
-
const now = Date.now();
|
|
43858
43961
|
const id2 = v4_default();
|
|
43859
43962
|
const props = {
|
|
43860
43963
|
id: id2,
|
|
43861
43964
|
projectId,
|
|
43862
43965
|
value: body.value,
|
|
43863
43966
|
classId: body.classId ?? void 0,
|
|
43864
|
-
|
|
43865
|
-
|
|
43866
|
-
},
|
|
43867
|
-
createdAt: now,
|
|
43868
|
-
updatedAt: now
|
|
43967
|
+
createdAt: timestamp,
|
|
43968
|
+
updatedAt: timestamp
|
|
43869
43969
|
};
|
|
43970
|
+
if (body.constructorArgs !== void 0 && body.constructorArgs !== null) {
|
|
43971
|
+
props.constructorArgs = cloneJsonValue(body.constructorArgs);
|
|
43972
|
+
}
|
|
43870
43973
|
return props;
|
|
43871
43974
|
}
|
|
43872
43975
|
function retargetDelegateReceiverValueIds(rows, fromValueId, toValueId) {
|
|
@@ -44009,9 +44112,11 @@ function cloneDefaultValueForMember(args) {
|
|
|
44009
44112
|
const member = substituteMember(
|
|
44010
44113
|
args.member,
|
|
44011
44114
|
args.genericEnv,
|
|
44012
|
-
args.document.members
|
|
44115
|
+
args.document.members,
|
|
44116
|
+
args.document.resolvedMember?.(args.member)
|
|
44013
44117
|
);
|
|
44014
|
-
if (
|
|
44118
|
+
if (documentHasInitValueContent(args.document, sourceValue)) {
|
|
44119
|
+
const initializerCreatedValuesStart = args.createdValues.length;
|
|
44015
44120
|
const evaluated = evaluateLiteralContainer({
|
|
44016
44121
|
body: sourceValue,
|
|
44017
44122
|
member,
|
|
@@ -44026,13 +44131,20 @@ function cloneDefaultValueForMember(args) {
|
|
|
44026
44131
|
if (evaluated.existingValueRow !== void 0) {
|
|
44027
44132
|
return evaluated.existingValueRow;
|
|
44028
44133
|
}
|
|
44029
|
-
const evaluatedRow =
|
|
44134
|
+
const evaluatedRow = createDocumentValueRow(
|
|
44135
|
+
args.document,
|
|
44136
|
+
args.projectId,
|
|
44137
|
+
evaluated.literal
|
|
44138
|
+
);
|
|
44030
44139
|
if (evaluated.genericBindings !== void 0) {
|
|
44031
44140
|
evaluatedRow.genericBindings = { ...evaluated.genericBindings };
|
|
44032
44141
|
}
|
|
44033
44142
|
if (evaluated.provisionalRootId !== void 0) {
|
|
44034
44143
|
retargetDelegateReceiverValueIds(
|
|
44035
|
-
[
|
|
44144
|
+
[
|
|
44145
|
+
evaluatedRow,
|
|
44146
|
+
...args.createdValues.slice(initializerCreatedValuesStart)
|
|
44147
|
+
],
|
|
44036
44148
|
evaluated.provisionalRootId,
|
|
44037
44149
|
evaluatedRow.id
|
|
44038
44150
|
);
|
|
@@ -44049,7 +44161,7 @@ function cloneDefaultValueForMember(args) {
|
|
|
44049
44161
|
let body;
|
|
44050
44162
|
if (isMemberClassBase(member)) {
|
|
44051
44163
|
const effectiveClassId = typeof sourceValue.classId === "string" ? sourceValue.classId : member.classId;
|
|
44052
|
-
const childEnv = resolveInstanceEnv(
|
|
44164
|
+
const childEnv = args.document.instanceEnv?.(effectiveClassId, member.classArguments) ?? resolveInstanceEnv(
|
|
44053
44165
|
effectiveClassId,
|
|
44054
44166
|
member.classArguments,
|
|
44055
44167
|
args.document.classes
|
|
@@ -44107,7 +44219,7 @@ function cloneDefaultValueForMember(args) {
|
|
|
44107
44219
|
args.position
|
|
44108
44220
|
);
|
|
44109
44221
|
}
|
|
44110
|
-
const value =
|
|
44222
|
+
const value = createDocumentValueRow(args.document, args.projectId, body);
|
|
44111
44223
|
value.sourceValueId = sourceValue.sourceValueId ?? sourceValue.id;
|
|
44112
44224
|
if (isMemberListBase(member) || isMemberDictionaryBase(member)) {
|
|
44113
44225
|
stampGenericBindings(value, member, args);
|
|
@@ -44130,9 +44242,7 @@ function formatDefaultReferenceLocation(memberName, key) {
|
|
|
44130
44242
|
}
|
|
44131
44243
|
function getSchemaEntryMap(document, classId) {
|
|
44132
44244
|
return new Map(
|
|
44133
|
-
mergeStoredInstanceSchema(classId, document.classes, document.members).map(
|
|
44134
|
-
(entry) => [entry.schemaKey, entry]
|
|
44135
|
-
)
|
|
44245
|
+
(document.storedInstanceSchema?.(classId) ?? mergeStoredInstanceSchema(classId, document.classes, document.members)).map((entry) => [entry.schemaKey, entry])
|
|
44136
44246
|
);
|
|
44137
44247
|
}
|
|
44138
44248
|
function cloneMemberValueBase(body) {
|
|
@@ -44189,26 +44299,26 @@ function shouldMaterializeChildDefault(member) {
|
|
|
44189
44299
|
}
|
|
44190
44300
|
return member.defaultValue !== void 0;
|
|
44191
44301
|
}
|
|
44192
|
-
function shouldMaterializeConstructorChildDefault(member) {
|
|
44193
|
-
if (
|
|
44302
|
+
function shouldMaterializeConstructorChildDefault(member, isInitializer = isInitValueContent(member.defaultValue)) {
|
|
44303
|
+
if (isInitializer) return true;
|
|
44194
44304
|
if (!member.required) return false;
|
|
44195
44305
|
return shouldMaterializeChildDefault(member);
|
|
44196
44306
|
}
|
|
44197
|
-
function skipProvidedConstructorSchemaKey(constructorRoot, schemaKey, member) {
|
|
44307
|
+
function skipProvidedConstructorSchemaKey(constructorRoot, schemaKey, member, isInitializer = isInitValueContent(member.defaultValue)) {
|
|
44198
44308
|
if (constructorRoot === void 0) return false;
|
|
44199
44309
|
if (!constructorRoot.providedSchemaKeys.has(schemaKey)) return false;
|
|
44200
44310
|
if (constructorRoot.runsMemberInitializers !== true) {
|
|
44201
|
-
return !
|
|
44311
|
+
return !isInitializer;
|
|
44202
44312
|
}
|
|
44203
44313
|
return member.defaultValue === void 0;
|
|
44204
44314
|
}
|
|
44205
|
-
function shouldMaterializeChildDefaultForRoot(constructorRoot, member) {
|
|
44315
|
+
function shouldMaterializeChildDefaultForRoot(constructorRoot, member, isInitializer = isInitValueContent(member.defaultValue)) {
|
|
44206
44316
|
if (constructorRoot === void 0)
|
|
44207
44317
|
return shouldMaterializeChildDefault(member);
|
|
44208
44318
|
if (constructorRoot.runsMemberInitializers === true) {
|
|
44209
44319
|
return shouldMaterializeChildDefault(member);
|
|
44210
44320
|
}
|
|
44211
|
-
return shouldMaterializeConstructorChildDefault(member);
|
|
44321
|
+
return shouldMaterializeConstructorChildDefault(member, isInitializer);
|
|
44212
44322
|
}
|
|
44213
44323
|
function primitiveFallbackValue(document, member) {
|
|
44214
44324
|
if (isMemberBoolBase(member)) return { value: false };
|
|
@@ -58443,6 +58553,7 @@ function buildEvaluatorBaseIndexes(members, values, valueById = new Map(
|
|
|
58443
58553
|
ownershipRootIdsByRowId: /* @__PURE__ */ new Map(),
|
|
58444
58554
|
ownershipDistancesByRowId: /* @__PURE__ */ new Map(),
|
|
58445
58555
|
ownedValueAttachmentsByValueId: /* @__PURE__ */ new Map(),
|
|
58556
|
+
constructorOwnershipDirtyValueIds: /* @__PURE__ */ new Set(),
|
|
58446
58557
|
memberByRowId: /* @__PURE__ */ new Map()
|
|
58447
58558
|
};
|
|
58448
58559
|
const membersByValueId = /* @__PURE__ */ new Map();
|
|
@@ -58454,7 +58565,7 @@ function buildEvaluatorBaseIndexes(members, values, valueById = new Map(
|
|
|
58454
58565
|
membersByValueId.set(member.valueId, bucket);
|
|
58455
58566
|
}
|
|
58456
58567
|
}
|
|
58457
|
-
|
|
58568
|
+
indexEvaluatorRows(indexes, values);
|
|
58458
58569
|
return {
|
|
58459
58570
|
rows: values,
|
|
58460
58571
|
valueById,
|
|
@@ -58498,6 +58609,7 @@ function evaluatorIndexes(ctx) {
|
|
|
58498
58609
|
ownershipRootIdsByRowId: sharedOwnershipCaches?.ownershipRootIdsByRowId ?? /* @__PURE__ */ new Map(),
|
|
58499
58610
|
ownershipDistancesByRowId: sharedOwnershipCaches?.ownershipDistancesByRowId ?? /* @__PURE__ */ new Map(),
|
|
58500
58611
|
ownedValueAttachmentsByValueId: /* @__PURE__ */ new Map(),
|
|
58612
|
+
constructorOwnershipDirtyValueIds: /* @__PURE__ */ new Set(),
|
|
58501
58613
|
memberByRowId: /* @__PURE__ */ new Map()
|
|
58502
58614
|
};
|
|
58503
58615
|
if (base === void 0) {
|
|
@@ -58506,18 +58618,21 @@ function evaluatorIndexes(ctx) {
|
|
|
58506
58618
|
indexes.memberByValueId.set(member.valueId, member);
|
|
58507
58619
|
}
|
|
58508
58620
|
}
|
|
58509
|
-
|
|
58621
|
+
indexEvaluatorRows(indexes, evaluatorValues(ctx));
|
|
58510
58622
|
} else {
|
|
58623
|
+
const localRows = [];
|
|
58511
58624
|
for (const row of ctx.__runtimeSessionValues?.values() ?? []) {
|
|
58512
58625
|
indexes.shadowedBaseRowIds.add(row.id);
|
|
58513
|
-
|
|
58626
|
+
localRows.push(row);
|
|
58514
58627
|
}
|
|
58515
58628
|
for (const row of ctx.__valueOverlay?.values() ?? []) {
|
|
58516
58629
|
indexes.shadowedBaseRowIds.add(row.id);
|
|
58517
|
-
|
|
58630
|
+
localRows.push(row);
|
|
58518
58631
|
}
|
|
58632
|
+
indexEvaluatorRows(indexes, localRows, true);
|
|
58519
58633
|
}
|
|
58520
58634
|
syncLazyOverlayReferences(indexes, ctx.__valueOverlay);
|
|
58635
|
+
indexes.constructorOwnershipDirtyValueIds.clear();
|
|
58521
58636
|
ctx.__indexes = indexes;
|
|
58522
58637
|
return indexes;
|
|
58523
58638
|
}
|
|
@@ -58534,27 +58649,32 @@ function syncLazyOverlayReferences(indexes, overlay) {
|
|
|
58534
58649
|
}
|
|
58535
58650
|
indexes.indexedOverlayRowCount += materializedRows.length;
|
|
58536
58651
|
}
|
|
58537
|
-
function indexEvaluatorRow(indexes, row, allowBaseShadow = false) {
|
|
58652
|
+
function indexEvaluatorRow(indexes, row, allowBaseShadow = false, sharedCachesAlreadyInvalidated = false) {
|
|
58653
|
+
if (indexes.indexedRowIds.has(row.id) || !allowBaseShadow && indexes.baseIndexedRowIds?.has(row.id) === true) {
|
|
58654
|
+
return;
|
|
58655
|
+
}
|
|
58656
|
+
if (!sharedCachesAlreadyInvalidated) {
|
|
58657
|
+
indexes.ownershipRootIdsByRowId.clear();
|
|
58658
|
+
indexes.ownershipDistancesByRowId.clear();
|
|
58659
|
+
indexes.memberByRowId.clear();
|
|
58660
|
+
}
|
|
58538
58661
|
indexes.ownedValueAttachmentsByValueId.delete(row.id);
|
|
58662
|
+
indexes.constructorOwnershipDirtyValueIds.add(row.id);
|
|
58539
58663
|
if (Array.isArray(row.value)) {
|
|
58540
58664
|
for (const childId of row.value) {
|
|
58541
58665
|
if (typeof childId === "string") {
|
|
58542
58666
|
indexes.ownedValueAttachmentsByValueId.delete(childId);
|
|
58667
|
+
indexes.constructorOwnershipDirtyValueIds.add(childId);
|
|
58543
58668
|
}
|
|
58544
58669
|
}
|
|
58545
58670
|
} else if (typeof row.value === "object" && row.value !== null) {
|
|
58546
58671
|
for (const childId of Object.values(row.value)) {
|
|
58547
58672
|
if (typeof childId === "string") {
|
|
58548
58673
|
indexes.ownedValueAttachmentsByValueId.delete(childId);
|
|
58674
|
+
indexes.constructorOwnershipDirtyValueIds.add(childId);
|
|
58549
58675
|
}
|
|
58550
58676
|
}
|
|
58551
58677
|
}
|
|
58552
|
-
indexes.ownershipRootIdsByRowId.clear();
|
|
58553
|
-
indexes.ownershipDistancesByRowId.clear();
|
|
58554
|
-
indexes.memberByRowId.clear();
|
|
58555
|
-
if (indexes.indexedRowIds.has(row.id) || !allowBaseShadow && indexes.baseIndexedRowIds?.has(row.id) === true) {
|
|
58556
|
-
return;
|
|
58557
|
-
}
|
|
58558
58678
|
indexes.indexedRowIds.add(row.id);
|
|
58559
58679
|
if (typeof row.sourceValueId === "string") {
|
|
58560
58680
|
const rows = indexes.rowsBySourceValueId.get(row.sourceValueId) ?? [];
|
|
@@ -58582,6 +58702,55 @@ function indexEvaluatorRow(indexes, row, allowBaseShadow = false) {
|
|
|
58582
58702
|
}
|
|
58583
58703
|
}
|
|
58584
58704
|
}
|
|
58705
|
+
function indexEvaluatorRows(indexes, rows, allowBaseShadow = false) {
|
|
58706
|
+
let sharedCachesInvalidated = false;
|
|
58707
|
+
for (const row of rows) {
|
|
58708
|
+
const alreadyIndexed = indexes.indexedRowIds.has(row.id) || !allowBaseShadow && indexes.baseIndexedRowIds?.has(row.id) === true;
|
|
58709
|
+
if (alreadyIndexed) continue;
|
|
58710
|
+
if (!sharedCachesInvalidated) {
|
|
58711
|
+
indexes.ownershipRootIdsByRowId.clear();
|
|
58712
|
+
indexes.ownershipDistancesByRowId.clear();
|
|
58713
|
+
indexes.memberByRowId.clear();
|
|
58714
|
+
sharedCachesInvalidated = true;
|
|
58715
|
+
}
|
|
58716
|
+
indexEvaluatorRow(indexes, row, allowBaseShadow, true);
|
|
58717
|
+
}
|
|
58718
|
+
}
|
|
58719
|
+
function unindexEvaluatorRow(indexes, row) {
|
|
58720
|
+
indexes.indexedRowIds.delete(row.id);
|
|
58721
|
+
indexes.ownedValueAttachmentsByValueId.delete(row.id);
|
|
58722
|
+
indexes.constructorOwnershipDirtyValueIds.delete(row.id);
|
|
58723
|
+
indexes.parentLinksByChildId.delete(row.id);
|
|
58724
|
+
if (typeof row.value === "object" && row.value !== null && indexes.rowByValueReference.get(row.value) === row) {
|
|
58725
|
+
indexes.rowByValueReference.delete(row.value);
|
|
58726
|
+
}
|
|
58727
|
+
if (typeof row.sourceValueId === "string") {
|
|
58728
|
+
const sourceRows = indexes.rowsBySourceValueId.get(row.sourceValueId);
|
|
58729
|
+
if (sourceRows !== void 0) {
|
|
58730
|
+
const retained = sourceRows.filter((candidate) => candidate !== row);
|
|
58731
|
+
if (retained.length === 0) {
|
|
58732
|
+
indexes.rowsBySourceValueId.delete(row.sourceValueId);
|
|
58733
|
+
} else {
|
|
58734
|
+
indexes.rowsBySourceValueId.set(row.sourceValueId, retained);
|
|
58735
|
+
}
|
|
58736
|
+
}
|
|
58737
|
+
}
|
|
58738
|
+
const childIds = Array.isArray(row.value) ? row.value : typeof row.value === "object" && row.value !== null ? Object.values(row.value) : [];
|
|
58739
|
+
for (const childId of childIds) {
|
|
58740
|
+
if (typeof childId !== "string") continue;
|
|
58741
|
+
const links = indexes.parentLinksByChildId.get(childId);
|
|
58742
|
+
if (links !== void 0) {
|
|
58743
|
+
const retained = links.filter((link) => link.parentId !== row.id);
|
|
58744
|
+
if (retained.length === 0) indexes.parentLinksByChildId.delete(childId);
|
|
58745
|
+
else indexes.parentLinksByChildId.set(childId, retained);
|
|
58746
|
+
}
|
|
58747
|
+
indexes.ownedValueAttachmentsByValueId.delete(childId);
|
|
58748
|
+
indexes.constructorOwnershipDirtyValueIds.add(childId);
|
|
58749
|
+
}
|
|
58750
|
+
indexes.ownershipRootIdsByRowId.clear();
|
|
58751
|
+
indexes.ownershipDistancesByRowId.clear();
|
|
58752
|
+
indexes.memberByRowId.clear();
|
|
58753
|
+
}
|
|
58585
58754
|
function addEvaluatorParentLink(indexes, childId, parentId, key) {
|
|
58586
58755
|
const links = indexes.parentLinksByChildId.get(childId) ?? [];
|
|
58587
58756
|
links.push({ parentId, key });
|
|
@@ -58751,6 +58920,12 @@ function evaluatorResolutionCache(ctx) {
|
|
|
58751
58920
|
compiledFunctionByMemberId: /* @__PURE__ */ new Map(),
|
|
58752
58921
|
compiledGetterByMemberId: /* @__PURE__ */ new Map(),
|
|
58753
58922
|
compiledSetterByMemberId: /* @__PURE__ */ new Map(),
|
|
58923
|
+
resolvedMemberById: /* @__PURE__ */ new Map(),
|
|
58924
|
+
storedInstanceSchemaByClassId: /* @__PURE__ */ new Map(),
|
|
58925
|
+
instanceEnvByKey: /* @__PURE__ */ new Map(),
|
|
58926
|
+
validatedConstructorDescriptorByInfo: /* @__PURE__ */ new WeakMap(),
|
|
58927
|
+
validatedInitValueContents: /* @__PURE__ */ new WeakSet(),
|
|
58928
|
+
storedInstanceMaterializationPlanByClassAndEnv: /* @__PURE__ */ new Map(),
|
|
58754
58929
|
effectiveStorageResolver: void 0
|
|
58755
58930
|
};
|
|
58756
58931
|
resolutionCacheByMembers.set(members, {
|
|
@@ -58762,10 +58937,139 @@ function evaluatorResolutionCache(ctx) {
|
|
|
58762
58937
|
ctx.__resolutionCache = cache;
|
|
58763
58938
|
return cache;
|
|
58764
58939
|
}
|
|
58765
|
-
function
|
|
58940
|
+
function cachedResolvedMember(member, ctx) {
|
|
58941
|
+
const memberId = member.id;
|
|
58942
|
+
if (typeof memberId !== "string") {
|
|
58943
|
+
return resolveMember2(member, ctx.vm.members);
|
|
58944
|
+
}
|
|
58945
|
+
const cache = evaluatorResolutionCache(ctx).resolvedMemberById;
|
|
58946
|
+
const cached = cache.get(memberId);
|
|
58947
|
+
if (cached !== void 0) return cached;
|
|
58948
|
+
const resolved = resolveMember2(member, ctx.vm.members);
|
|
58949
|
+
cache.set(memberId, resolved);
|
|
58950
|
+
return resolved;
|
|
58951
|
+
}
|
|
58952
|
+
function cachedStoredInstanceSchema(classId, ctx) {
|
|
58953
|
+
const cache = evaluatorResolutionCache(ctx).storedInstanceSchemaByClassId;
|
|
58954
|
+
const cached = cache.get(classId);
|
|
58955
|
+
if (cached !== void 0) return cached;
|
|
58956
|
+
const merged = mergeStoredInstanceSchema(
|
|
58957
|
+
classId,
|
|
58958
|
+
ctx.vm.classes,
|
|
58959
|
+
ctx.vm.members
|
|
58960
|
+
);
|
|
58961
|
+
cache.set(classId, merged);
|
|
58962
|
+
return merged;
|
|
58963
|
+
}
|
|
58964
|
+
function cachedStoredInstanceMaterializationPlan(classId, instanceEnv, ctx) {
|
|
58965
|
+
const cache = evaluatorResolutionCache(
|
|
58966
|
+
ctx
|
|
58967
|
+
).storedInstanceMaterializationPlanByClassAndEnv;
|
|
58968
|
+
let byEnvironment = cache.get(classId);
|
|
58969
|
+
const cached = byEnvironment?.get(instanceEnv);
|
|
58970
|
+
if (cached !== void 0) return cached;
|
|
58971
|
+
const plan = buildDefaultClassMaterializationPlan(
|
|
58972
|
+
{
|
|
58973
|
+
project: ctx.vm.project,
|
|
58974
|
+
members: ctx.vm.members,
|
|
58975
|
+
classes: ctx.vm.classes,
|
|
58976
|
+
enums: ctx.vm.enums,
|
|
58977
|
+
values: ctx.vm.values,
|
|
58978
|
+
memberById: ctx.vm.databaseVM?.memberById,
|
|
58979
|
+
valueById: ctx.vm.databaseVM?.valueById,
|
|
58980
|
+
resolvedMember: (member) => cachedResolvedMember(member, ctx),
|
|
58981
|
+
storedInstanceSchema: (nestedClassId) => cachedStoredInstanceSchema(nestedClassId, ctx),
|
|
58982
|
+
instanceEnv: (nestedClassId, classArguments2) => cachedInstanceEnv(nestedClassId, classArguments2, ctx),
|
|
58983
|
+
isInitValueContent: (value) => cachedIsInitValueContent(value, ctx),
|
|
58984
|
+
projectFiles: ctx.vm.projectFiles ?? [],
|
|
58985
|
+
textureTemplates: ctx.vm.textureTemplates ?? []
|
|
58986
|
+
},
|
|
58987
|
+
classId,
|
|
58988
|
+
instanceEnv
|
|
58989
|
+
);
|
|
58990
|
+
byEnvironment ??= /* @__PURE__ */ new WeakMap();
|
|
58991
|
+
byEnvironment.set(instanceEnv, plan);
|
|
58992
|
+
cache.set(classId, byEnvironment);
|
|
58993
|
+
return plan;
|
|
58994
|
+
}
|
|
58995
|
+
function cachedInstanceEnv(classId, classArguments2, ctx) {
|
|
58996
|
+
const key = `${classId}:${JSON.stringify(classArguments2 ?? null)}`;
|
|
58997
|
+
const cache = evaluatorResolutionCache(ctx).instanceEnvByKey;
|
|
58998
|
+
const cached = cache.get(key);
|
|
58999
|
+
if (cached !== void 0) return cached;
|
|
59000
|
+
const resolved = resolveInstanceEnv(classId, classArguments2, ctx.vm.classes);
|
|
59001
|
+
cache.set(key, resolved);
|
|
59002
|
+
return resolved;
|
|
59003
|
+
}
|
|
59004
|
+
function cachedIsInitValueContent(value, ctx) {
|
|
59005
|
+
if (typeof value !== "object" || value === null) return false;
|
|
59006
|
+
const cache = evaluatorResolutionCache(ctx).validatedInitValueContents;
|
|
59007
|
+
if (cache.has(value)) return true;
|
|
59008
|
+
if (!isInitValueContent(value)) return false;
|
|
59009
|
+
cache.add(value);
|
|
59010
|
+
return true;
|
|
59011
|
+
}
|
|
59012
|
+
function sessionCreationCheckpoint(ctx) {
|
|
59013
|
+
if (ctx.__sessionCreationStrategy === "snapshot") {
|
|
59014
|
+
return new Set(ctx.__runtimeSessionValues?.keys());
|
|
59015
|
+
}
|
|
59016
|
+
const state = ctx.__executionState;
|
|
59017
|
+
if (state === void 0) {
|
|
59018
|
+
throw new NSGetterRuntimeError(
|
|
59019
|
+
"Created Session values require an effect-capable evaluator scope."
|
|
59020
|
+
);
|
|
59021
|
+
}
|
|
59022
|
+
return state.sessionCreationJournal.length;
|
|
59023
|
+
}
|
|
59024
|
+
function registerRuntimeSessionValue(ctx, row) {
|
|
59025
|
+
const session = ctx.__runtimeSessionValues;
|
|
59026
|
+
const state = ctx.__executionState;
|
|
59027
|
+
if (session === void 0 || state === void 0) {
|
|
59028
|
+
throw new NSGetterRuntimeError(
|
|
59029
|
+
"Session publication requires an effect-capable evaluator scope."
|
|
59030
|
+
);
|
|
59031
|
+
}
|
|
59032
|
+
if (!state.knownSessionValueIds.has(row.id)) {
|
|
59033
|
+
state.knownSessionValueIds.add(row.id);
|
|
59034
|
+
state.sessionCreationJournal.push(row.id);
|
|
59035
|
+
}
|
|
59036
|
+
session.set(row.id, row);
|
|
59037
|
+
}
|
|
59038
|
+
function deleteRuntimeSessionValue(ctx, rowId) {
|
|
59039
|
+
const session = ctx.__runtimeSessionValues;
|
|
59040
|
+
if (session === void 0) return;
|
|
59041
|
+
const row = session.get(rowId);
|
|
59042
|
+
if (row !== void 0 && ctx.__indexes !== void 0) {
|
|
59043
|
+
unindexEvaluatorRow(ctx.__indexes, row);
|
|
59044
|
+
}
|
|
59045
|
+
session.delete(rowId);
|
|
59046
|
+
}
|
|
59047
|
+
function createdSessionValuesSince(ctx, checkpoint) {
|
|
59048
|
+
const session = ctx.__runtimeSessionValues;
|
|
59049
|
+
const state = ctx.__executionState;
|
|
59050
|
+
if (session === void 0 || state === void 0) {
|
|
59051
|
+
throw new NSGetterRuntimeError(
|
|
59052
|
+
"Created Session values require an effect-capable evaluator scope."
|
|
59053
|
+
);
|
|
59054
|
+
}
|
|
58766
59055
|
const created = [];
|
|
58767
|
-
|
|
58768
|
-
|
|
59056
|
+
if (typeof checkpoint !== "number") {
|
|
59057
|
+
for (const row of session.values()) {
|
|
59058
|
+
if (checkpoint.has(row.id)) continue;
|
|
59059
|
+
if (!isLiteralValueContent(row)) {
|
|
59060
|
+
throw new NSGetterRuntimeError(
|
|
59061
|
+
`Evaluator Session row ${row.id} carries an unevaluated initializer instead of a value.`
|
|
59062
|
+
);
|
|
59063
|
+
}
|
|
59064
|
+
created.push(row);
|
|
59065
|
+
}
|
|
59066
|
+
return created;
|
|
59067
|
+
}
|
|
59068
|
+
for (let index = checkpoint; index < state.sessionCreationJournal.length; index += 1) {
|
|
59069
|
+
const rowId = state.sessionCreationJournal[index];
|
|
59070
|
+
if (rowId === void 0) continue;
|
|
59071
|
+
const row = session.get(rowId);
|
|
59072
|
+
if (row === void 0) continue;
|
|
58769
59073
|
if (!isLiteralValueContent(row)) {
|
|
58770
59074
|
throw new NSGetterRuntimeError(
|
|
58771
59075
|
`Evaluator Session row '${row.id}' carries an unevaluated initializer instead of a value.`
|
|
@@ -58784,7 +59088,7 @@ function evaluateNSGetterWithEffects(getter, ctx, argumentValues = []) {
|
|
|
58784
59088
|
const runtimeCtx = withEvaluationRuntime(ctx, requestedWrites);
|
|
58785
59089
|
consumeBudget(runtimeCtx, "workUnits", 1, "work unit");
|
|
58786
59090
|
const writes = runtimeCtx.__executionState?.writes ?? requestedWrites;
|
|
58787
|
-
const
|
|
59091
|
+
const creationCheckpoint = sessionCreationCheckpoint(runtimeCtx);
|
|
58788
59092
|
const scope = createTopLevelScope(runtimeCtx);
|
|
58789
59093
|
const parameters = getter.parameters.slice(2);
|
|
58790
59094
|
if (parameters.length !== argumentValues.length) {
|
|
@@ -58816,8 +59120,8 @@ function evaluateNSGetterWithEffects(getter, ctx, argumentValues = []) {
|
|
|
58816
59120
|
);
|
|
58817
59121
|
result.value = preserveReadOnlyReturnIdentity(result.value, runtimeCtx);
|
|
58818
59122
|
const createdSessionValues = createdSessionValuesSince(
|
|
58819
|
-
runtimeCtx
|
|
58820
|
-
|
|
59123
|
+
runtimeCtx,
|
|
59124
|
+
creationCheckpoint
|
|
58821
59125
|
);
|
|
58822
59126
|
return createdSessionValues.length === 0 ? { value: result.value, writes } : { value: result.value, writes, createdSessionValues };
|
|
58823
59127
|
}
|
|
@@ -58834,7 +59138,7 @@ function evaluateNSVoidBody(action, ctx) {
|
|
|
58834
59138
|
const writes = [];
|
|
58835
59139
|
const runtimeCtx = withEvaluationRuntime(ctx, writes);
|
|
58836
59140
|
consumeBudget(runtimeCtx, "workUnits", 1, "work unit");
|
|
58837
|
-
const
|
|
59141
|
+
const creationCheckpoint = sessionCreationCheckpoint(runtimeCtx);
|
|
58838
59142
|
const scope = createTopLevelScope(runtimeCtx);
|
|
58839
59143
|
try {
|
|
58840
59144
|
const result = evalInstructions(action.instructions, scope, runtimeCtx, {
|
|
@@ -58855,8 +59159,8 @@ function evaluateNSVoidBody(action, ctx) {
|
|
|
58855
59159
|
throw error;
|
|
58856
59160
|
}
|
|
58857
59161
|
const createdSessionValues = createdSessionValuesSince(
|
|
58858
|
-
runtimeCtx
|
|
58859
|
-
|
|
59162
|
+
runtimeCtx,
|
|
59163
|
+
creationCheckpoint
|
|
58860
59164
|
);
|
|
58861
59165
|
return createdSessionValues.length === 0 ? { writes } : { writes, createdSessionValues };
|
|
58862
59166
|
}
|
|
@@ -58865,7 +59169,7 @@ function evaluateNSFunction(action, ctx, args) {
|
|
|
58865
59169
|
const writes = [];
|
|
58866
59170
|
const runtimeCtx = withEvaluationRuntime(ctx, writes);
|
|
58867
59171
|
consumeBudget(runtimeCtx, "workUnits", 1, "work unit");
|
|
58868
|
-
const
|
|
59172
|
+
const creationCheckpoint = sessionCreationCheckpoint(runtimeCtx);
|
|
58869
59173
|
const runtimeArgs = remapRuntimeArguments(args, runtimeCtx);
|
|
58870
59174
|
let value;
|
|
58871
59175
|
try {
|
|
@@ -58886,8 +59190,8 @@ function evaluateNSFunction(action, ctx, args) {
|
|
|
58886
59190
|
throw error;
|
|
58887
59191
|
}
|
|
58888
59192
|
const createdSessionValues = createdSessionValuesSince(
|
|
58889
|
-
runtimeCtx
|
|
58890
|
-
|
|
59193
|
+
runtimeCtx,
|
|
59194
|
+
creationCheckpoint
|
|
58891
59195
|
);
|
|
58892
59196
|
return createdSessionValues.length === 0 ? { value, writes } : { value, writes, createdSessionValues };
|
|
58893
59197
|
}
|
|
@@ -58912,6 +59216,7 @@ function withEvaluationRuntime(ctx, writes) {
|
|
|
58912
59216
|
}
|
|
58913
59217
|
const overlay = ctx.__valueOverlay ?? (ctx.storedConstructionReplay === true ? /* @__PURE__ */ new Map() : buildValueOverlay(ctx.vm));
|
|
58914
59218
|
const referenceRemap = ctx.__runtimeReferenceRemap ?? /* @__PURE__ */ new Map();
|
|
59219
|
+
const runtimeSessionValues = ctx.__runtimeSessionValues ?? /* @__PURE__ */ new Map();
|
|
58915
59220
|
const runtimeReferences = runtimeSessionValueReferences(
|
|
58916
59221
|
ctx.__runtimeSessionValues
|
|
58917
59222
|
);
|
|
@@ -58930,7 +59235,7 @@ function withEvaluationRuntime(ctx, writes) {
|
|
|
58930
59235
|
primary: remap(ctx.dialogueContext.primary),
|
|
58931
59236
|
trigger: remap(ctx.dialogueContext.trigger)
|
|
58932
59237
|
},
|
|
58933
|
-
__runtimeSessionValues:
|
|
59238
|
+
__runtimeSessionValues: runtimeSessionValues,
|
|
58934
59239
|
__saveStaticBindings: ctx.__saveStaticBindings ?? staticBindingMap(ctx.saveStaticBindings),
|
|
58935
59240
|
__sessionStaticBindings: ctx.__sessionStaticBindings ?? staticBindingMap(ctx.sessionStaticBindings),
|
|
58936
59241
|
__valueOverlay: overlay,
|
|
@@ -58939,7 +59244,12 @@ function withEvaluationRuntime(ctx, writes) {
|
|
|
58939
59244
|
writes,
|
|
58940
59245
|
functionStack: [],
|
|
58941
59246
|
delegateStack: [],
|
|
59247
|
+
knownSessionValueIds: new Set(runtimeSessionValues.keys()),
|
|
59248
|
+
sessionCreationJournal: [],
|
|
58942
59249
|
constructorGroups: /* @__PURE__ */ new Map(),
|
|
59250
|
+
constructorGroupByRowId: /* @__PURE__ */ new Map(),
|
|
59251
|
+
constructorGroupDependencies: /* @__PURE__ */ new Map(),
|
|
59252
|
+
constructionTimestamp: Date.now(),
|
|
58943
59253
|
ownedValueAttachments: /* @__PURE__ */ new Map(),
|
|
58944
59254
|
constructionStack: [],
|
|
58945
59255
|
loopIterations: 0,
|
|
@@ -59098,10 +59408,22 @@ function finalizeConstructorAllocations(ctx, returnValue, ownsInvocationState, r
|
|
|
59098
59408
|
}
|
|
59099
59409
|
const escapedRoots = /* @__PURE__ */ new Set();
|
|
59100
59410
|
const scannedRows = /* @__PURE__ */ new Set();
|
|
59411
|
+
const markConstructorGroupEscaped = (rootId) => {
|
|
59412
|
+
if (escapedRoots.has(rootId)) return;
|
|
59413
|
+
escapedRoots.add(rootId);
|
|
59414
|
+
for (const dependencyRootId of state.constructorGroupDependencies.get(
|
|
59415
|
+
rootId
|
|
59416
|
+
) ?? []) {
|
|
59417
|
+
markConstructorGroupEscaped(dependencyRootId);
|
|
59418
|
+
}
|
|
59419
|
+
};
|
|
59101
59420
|
const isOwnedRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
59102
59421
|
const scanOwnedRow = (valueId, hintedMember) => {
|
|
59103
59422
|
const groupRoot = groupByRowId.get(valueId);
|
|
59104
|
-
if (groupRoot !== void 0)
|
|
59423
|
+
if (groupRoot !== void 0) {
|
|
59424
|
+
markConstructorGroupEscaped(groupRoot);
|
|
59425
|
+
return;
|
|
59426
|
+
}
|
|
59105
59427
|
if (scannedRows.has(valueId)) return;
|
|
59106
59428
|
scannedRows.add(valueId);
|
|
59107
59429
|
const row = evalValueById(
|
|
@@ -59213,7 +59535,10 @@ function finalizeConstructorAllocations(ctx, returnValue, ownsInvocationState, r
|
|
|
59213
59535
|
const scanReturnedValue = (value, typeInfo) => {
|
|
59214
59536
|
if (typeof value === "object" && value !== null) {
|
|
59215
59537
|
const direct = groupByValueReference.get(value);
|
|
59216
|
-
if (direct !== void 0)
|
|
59538
|
+
if (direct !== void 0) {
|
|
59539
|
+
markConstructorGroupEscaped(direct);
|
|
59540
|
+
return;
|
|
59541
|
+
}
|
|
59217
59542
|
const tracked = trackedRowForValueReference(value, ctx);
|
|
59218
59543
|
if (tracked !== null) {
|
|
59219
59544
|
scanOwnedRow(tracked.id);
|
|
@@ -59261,7 +59586,7 @@ function finalizeConstructorAllocations(ctx, returnValue, ownsInvocationState, r
|
|
|
59261
59586
|
if (typeof row?.value === "object" && row.value !== null) {
|
|
59262
59587
|
collectedReferences.add(row.value);
|
|
59263
59588
|
}
|
|
59264
|
-
|
|
59589
|
+
deleteRuntimeSessionValue(ctx, rowId);
|
|
59265
59590
|
collectedIds.add(rowId);
|
|
59266
59591
|
}
|
|
59267
59592
|
}
|
|
@@ -59285,6 +59610,8 @@ function finalizeConstructorAllocations(ctx, returnValue, ownsInvocationState, r
|
|
|
59285
59610
|
invalidateEvaluatorIndexes(ctx);
|
|
59286
59611
|
}
|
|
59287
59612
|
state.constructorGroups.clear();
|
|
59613
|
+
state.constructorGroupByRowId.clear();
|
|
59614
|
+
state.constructorGroupDependencies.clear();
|
|
59288
59615
|
}
|
|
59289
59616
|
function buildValueOverlay(vm) {
|
|
59290
59617
|
return new LazyValueOverlay(vm);
|
|
@@ -60149,9 +60476,11 @@ function applyOverlayStaticAssignment(memberId, value, ctx) {
|
|
|
60149
60476
|
"Static assignment requires an evaluator Session row registry."
|
|
60150
60477
|
);
|
|
60151
60478
|
}
|
|
60479
|
+
if (ctx.__indexes !== void 0) {
|
|
60480
|
+
indexEvaluatorRows(ctx.__indexes, createdValues);
|
|
60481
|
+
}
|
|
60152
60482
|
for (const created of createdValues) {
|
|
60153
|
-
|
|
60154
|
-
if (ctx.__indexes !== void 0) indexEvaluatorRow(ctx.__indexes, created);
|
|
60483
|
+
registerRuntimeSessionValue(ctx, created);
|
|
60155
60484
|
}
|
|
60156
60485
|
bindings.set(member.id, row.id);
|
|
60157
60486
|
invalidateEvaluatorIndexes(ctx);
|
|
@@ -62940,11 +63269,17 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
|
|
|
62940
63269
|
}
|
|
62941
63270
|
const genericSlot = ctx.__constructionGenericSlots?.toReversed().find((slot) => slot.classId === classId) ?? ctx.__storedConstructionReplaySlot;
|
|
62942
63271
|
const classArguments2 = genericSlot?.classId === classId ? genericSlot.classArguments : void 0;
|
|
62943
|
-
const
|
|
62944
|
-
|
|
62945
|
-
|
|
62946
|
-
|
|
62947
|
-
)
|
|
63272
|
+
const descriptorCache = evaluatorResolutionCache(ctx).validatedConstructorDescriptorByInfo;
|
|
63273
|
+
const descriptorCacheKey = `${requireEveryRequiredField}:${ctx.storedConstructionReplay === true}:${JSON.stringify(classArguments2 ?? null)}`;
|
|
63274
|
+
const cachedDescriptor = descriptorCache.get(info)?.get(descriptorCacheKey);
|
|
63275
|
+
if (cachedDescriptor !== void 0) return cachedDescriptor;
|
|
63276
|
+
const cacheDescriptor = (descriptor) => {
|
|
63277
|
+
const variants = descriptorCache.get(info) ?? /* @__PURE__ */ new Map();
|
|
63278
|
+
variants.set(descriptorCacheKey, descriptor);
|
|
63279
|
+
descriptorCache.set(info, variants);
|
|
63280
|
+
return descriptor;
|
|
63281
|
+
};
|
|
63282
|
+
const instanceEnv = cachedInstanceEnv(classId, classArguments2, ctx);
|
|
62948
63283
|
if (firstUnboundParamId(instanceEnv) !== null) {
|
|
62949
63284
|
throw new NSGetterRuntimeError(
|
|
62950
63285
|
`Cannot construct open generic Class '${schemaClass2.name}'.`
|
|
@@ -62957,11 +63292,7 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
|
|
|
62957
63292
|
}
|
|
62958
63293
|
let mergedSchema;
|
|
62959
63294
|
try {
|
|
62960
|
-
mergedSchema =
|
|
62961
|
-
classId,
|
|
62962
|
-
ctx.vm.classes,
|
|
62963
|
-
ctx.vm.members
|
|
62964
|
-
);
|
|
63295
|
+
mergedSchema = [...cachedStoredInstanceSchema(classId, ctx)];
|
|
62965
63296
|
} catch (error) {
|
|
62966
63297
|
throw new NSGetterRuntimeError(
|
|
62967
63298
|
`Cannot validate constructor for '${schemaClass2.name}': ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -63020,7 +63351,12 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
|
|
|
63020
63351
|
);
|
|
63021
63352
|
}
|
|
63022
63353
|
if (!requireEveryRequiredField) {
|
|
63023
|
-
return {
|
|
63354
|
+
return cacheDescriptor({
|
|
63355
|
+
schemaClass: schemaClass2,
|
|
63356
|
+
fields,
|
|
63357
|
+
instanceEnv,
|
|
63358
|
+
classArguments: classArguments2
|
|
63359
|
+
});
|
|
63024
63360
|
}
|
|
63025
63361
|
for (const entry of mergedSchema) {
|
|
63026
63362
|
const rawMember = evalMemberById(ctx.vm, entry.memberId);
|
|
@@ -63032,7 +63368,8 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
|
|
|
63032
63368
|
const member = substituteMember(
|
|
63033
63369
|
rawMember,
|
|
63034
63370
|
instanceEnv,
|
|
63035
|
-
ctx.vm.members
|
|
63371
|
+
ctx.vm.members,
|
|
63372
|
+
cachedResolvedMember(rawMember, ctx)
|
|
63036
63373
|
);
|
|
63037
63374
|
if (member.isStatic || !memberKindSupportsStorage(member.kind) || member.kind === 21 /* Generic */) {
|
|
63038
63375
|
continue;
|
|
@@ -63043,7 +63380,7 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
|
|
|
63043
63380
|
);
|
|
63044
63381
|
}
|
|
63045
63382
|
}
|
|
63046
|
-
return { schemaClass: schemaClass2, fields, instanceEnv, classArguments: classArguments2 };
|
|
63383
|
+
return cacheDescriptor({ schemaClass: schemaClass2, fields, instanceEnv, classArguments: classArguments2 });
|
|
63047
63384
|
}
|
|
63048
63385
|
function assertConstructorFieldSlotWritable(args) {
|
|
63049
63386
|
const surfaceEntry = mergeInstanceSchema(
|
|
@@ -63070,7 +63407,8 @@ function validateConstructorFieldSlot(args) {
|
|
|
63070
63407
|
const member = substituteMember(
|
|
63071
63408
|
rawMember,
|
|
63072
63409
|
args.instanceEnv,
|
|
63073
|
-
ctx.vm.members
|
|
63410
|
+
ctx.vm.members,
|
|
63411
|
+
cachedResolvedMember(rawMember, ctx)
|
|
63074
63412
|
);
|
|
63075
63413
|
if (member.isStatic || !memberKindSupportsStorage(member.kind) || member.kind === 21 /* Generic */) {
|
|
63076
63414
|
throw new NSGetterRuntimeError(
|
|
@@ -63112,7 +63450,7 @@ function constructionGenericSlotsForMember(rawMember, ctx, instanceEnv, visitedM
|
|
|
63112
63450
|
const entryMember = evalMemberById(ctx.vm, member.entryMemberId);
|
|
63113
63451
|
if (entryMember === null) return [];
|
|
63114
63452
|
return constructionGenericSlotsForMember(
|
|
63115
|
-
|
|
63453
|
+
cachedResolvedMember(entryMember, ctx),
|
|
63116
63454
|
ctx,
|
|
63117
63455
|
instanceEnv,
|
|
63118
63456
|
nextVisited
|
|
@@ -63130,6 +63468,9 @@ function withConstructionGenericSlots(member, ctx, instanceEnv, evaluate) {
|
|
|
63130
63468
|
}
|
|
63131
63469
|
}
|
|
63132
63470
|
function evaluateConstructorFields(descriptor, scope, ctx) {
|
|
63471
|
+
if (descriptor.fields.length === 0) {
|
|
63472
|
+
return EMPTY_SUPPLIED_CONSTRUCTOR_FIELDS;
|
|
63473
|
+
}
|
|
63133
63474
|
const schemaClass2 = descriptor.schemaClass;
|
|
63134
63475
|
const evaluatedValues = descriptor.fields.map((validated) => {
|
|
63135
63476
|
if (validated.valuePointer === null) {
|
|
@@ -63170,16 +63511,17 @@ function evaluateConstructorFields(descriptor, scope, ctx) {
|
|
|
63170
63511
|
});
|
|
63171
63512
|
}
|
|
63172
63513
|
function syntheticConstructorMember(schemaClass2, classArguments2) {
|
|
63173
|
-
|
|
63514
|
+
const member = {
|
|
63174
63515
|
name: `new ${schemaClass2.name}`,
|
|
63175
63516
|
kind: 7 /* Class */,
|
|
63176
63517
|
classId: schemaClass2.id,
|
|
63177
|
-
...classArguments2 === void 0 ? {} : { classArguments: classArguments2 },
|
|
63178
63518
|
locked: false,
|
|
63179
63519
|
required: true,
|
|
63180
63520
|
isStatic: false,
|
|
63181
63521
|
accessModifierKind: "public"
|
|
63182
63522
|
};
|
|
63523
|
+
if (classArguments2 !== void 0) member.classArguments = classArguments2;
|
|
63524
|
+
return member;
|
|
63183
63525
|
}
|
|
63184
63526
|
function stampConstructedRootGenericBindings(root, descriptor) {
|
|
63185
63527
|
const stamp = {};
|
|
@@ -63316,37 +63658,19 @@ function stageConstructedRows(createdValues, ctx) {
|
|
|
63316
63658
|
);
|
|
63317
63659
|
}
|
|
63318
63660
|
for (const row of createdValues) {
|
|
63319
|
-
|
|
63320
|
-
|
|
63661
|
+
registerRuntimeSessionValue(ctx, row);
|
|
63662
|
+
}
|
|
63663
|
+
if (ctx.__indexes !== void 0) {
|
|
63664
|
+
indexEvaluatorRows(ctx.__indexes, createdValues);
|
|
63321
63665
|
}
|
|
63322
63666
|
}
|
|
63323
|
-
function bindConstructedDelegateTargets(
|
|
63324
|
-
|
|
63325
|
-
const
|
|
63326
|
-
const visited = /* @__PURE__ */ new Set();
|
|
63327
|
-
while (pending.length > 0) {
|
|
63328
|
-
const rowId = pending.pop();
|
|
63329
|
-
if (rowId === void 0 || visited.has(rowId)) continue;
|
|
63330
|
-
visited.add(rowId);
|
|
63331
|
-
const row = evalValueById(
|
|
63332
|
-
ctx,
|
|
63333
|
-
rowId,
|
|
63334
|
-
ctx.__runtimeSessionValues,
|
|
63335
|
-
ctx.__valueOverlay
|
|
63336
|
-
);
|
|
63337
|
-
if (row === null) continue;
|
|
63338
|
-
if (Array.isArray(row.value)) {
|
|
63339
|
-
for (const childId of row.value) {
|
|
63340
|
-
if (typeof childId === "string") pending.push(childId);
|
|
63341
|
-
}
|
|
63342
|
-
} else if (typeof row.value === "object" && row.value !== null) {
|
|
63343
|
-
for (const childId of Object.values(row.value)) {
|
|
63344
|
-
if (typeof childId === "string") pending.push(childId);
|
|
63345
|
-
}
|
|
63346
|
-
}
|
|
63667
|
+
function bindConstructedDelegateTargets(createdValues, ctx) {
|
|
63668
|
+
let indexes;
|
|
63669
|
+
for (const row of createdValues) {
|
|
63347
63670
|
if (!isMemberDelegateTarget(row.value) || row.value.valueId !== null) {
|
|
63348
63671
|
continue;
|
|
63349
63672
|
}
|
|
63673
|
+
indexes ??= evaluatorIndexes(ctx);
|
|
63350
63674
|
const target = evalMemberById(ctx.vm, row.value.memberId);
|
|
63351
63675
|
if (target === null || target.isStatic === true) continue;
|
|
63352
63676
|
const placement = findSchemaPlacement(target.id, ctx.vm.classes);
|
|
@@ -63391,8 +63715,10 @@ function bindConstructedDelegateTargets(rootId, ctx) {
|
|
|
63391
63715
|
function publishConstructedRows(args) {
|
|
63392
63716
|
const { root, createdValues, ctx } = args;
|
|
63393
63717
|
assertConstructorRowsHaveSingleStructuralOwner(createdValues, ctx);
|
|
63394
|
-
const beforeRetain = new Set(createdValues.map((row) => row.id));
|
|
63395
|
-
|
|
63718
|
+
const beforeRetain = args.mayHaveOrphanedRows === false ? null : new Set(createdValues.map((row) => row.id));
|
|
63719
|
+
if (beforeRetain !== null) {
|
|
63720
|
+
retainOnlyCreatedRowsReachableFrom(root.id, createdValues, ctx);
|
|
63721
|
+
}
|
|
63396
63722
|
stampCreatedValuesMapKey(createdValues, null);
|
|
63397
63723
|
applyDeclaredStorageKeyOverrides({
|
|
63398
63724
|
createdValues,
|
|
@@ -63441,29 +63767,84 @@ function publishConstructedRows(args) {
|
|
|
63441
63767
|
"produced collection entry"
|
|
63442
63768
|
);
|
|
63443
63769
|
const retained = retainedIds;
|
|
63444
|
-
|
|
63445
|
-
|
|
63446
|
-
|
|
63770
|
+
if (beforeRetain !== null) {
|
|
63771
|
+
for (const rowId of beforeRetain) {
|
|
63772
|
+
if (retained.has(rowId)) continue;
|
|
63773
|
+
deleteRuntimeSessionValue(ctx, rowId);
|
|
63774
|
+
}
|
|
63447
63775
|
}
|
|
63448
63776
|
for (const row of createdValues) {
|
|
63449
|
-
|
|
63450
|
-
|
|
63777
|
+
registerRuntimeSessionValue(ctx, row);
|
|
63778
|
+
}
|
|
63779
|
+
if (ctx.__indexes !== void 0) {
|
|
63780
|
+
indexEvaluatorRows(ctx.__indexes, createdValues);
|
|
63781
|
+
}
|
|
63782
|
+
bindConstructedDelegateTargets(createdValues, ctx);
|
|
63783
|
+
let rootDependencies = state.constructorGroupDependencies.get(root.id);
|
|
63784
|
+
for (const rowId of retained) {
|
|
63785
|
+
if (rowId === root.id) continue;
|
|
63786
|
+
const nestedDependencies = state.constructorGroupDependencies.get(rowId);
|
|
63787
|
+
if (nestedDependencies === void 0) continue;
|
|
63788
|
+
rootDependencies ??= /* @__PURE__ */ new Set();
|
|
63789
|
+
for (const dependencyRootId of nestedDependencies) {
|
|
63790
|
+
if (dependencyRootId !== root.id) {
|
|
63791
|
+
rootDependencies.add(dependencyRootId);
|
|
63792
|
+
}
|
|
63793
|
+
}
|
|
63794
|
+
state.constructorGroupDependencies.delete(rowId);
|
|
63795
|
+
}
|
|
63796
|
+
if (rootDependencies !== void 0) {
|
|
63797
|
+
state.constructorGroupDependencies.set(root.id, rootDependencies);
|
|
63451
63798
|
}
|
|
63452
|
-
bindConstructedDelegateTargets(root.id, ctx);
|
|
63453
63799
|
state.constructorGroups.set(root.id, retained);
|
|
63800
|
+
for (const rowId of retained) {
|
|
63801
|
+
state.constructorGroupByRowId.set(rowId, root.id);
|
|
63802
|
+
}
|
|
63803
|
+
if (ctx.__indexes !== void 0) {
|
|
63804
|
+
for (const rowId of retained) {
|
|
63805
|
+
ctx.__indexes.constructorOwnershipDirtyValueIds.delete(rowId);
|
|
63806
|
+
}
|
|
63807
|
+
}
|
|
63454
63808
|
state.ownedValueAttachments.clear();
|
|
63455
63809
|
}
|
|
63456
63810
|
function assertConstructorRowsHaveSingleStructuralOwner(createdValues, ctx) {
|
|
63457
|
-
|
|
63458
|
-
|
|
63459
|
-
|
|
63811
|
+
let indexes = ctx.__indexes;
|
|
63812
|
+
const candidateIds = /* @__PURE__ */ new Set();
|
|
63813
|
+
if (ctx.__constructorOwnershipStrategy === "cumulative") {
|
|
63814
|
+
indexes ??= evaluatorIndexes(ctx);
|
|
63815
|
+
for (const row of createdValues) candidateIds.add(row.id);
|
|
63816
|
+
for (const rowIds of ctx.__executionState?.constructorGroups.values() ?? []) {
|
|
63817
|
+
for (const rowId of rowIds) candidateIds.add(rowId);
|
|
63818
|
+
}
|
|
63819
|
+
} else if (indexes !== void 0) {
|
|
63820
|
+
const state = ctx.__executionState;
|
|
63821
|
+
for (const rowId of indexes.constructorOwnershipDirtyValueIds) {
|
|
63822
|
+
if (ctx.__constructorPerformanceMetrics !== void 0) {
|
|
63823
|
+
ctx.__constructorPerformanceMetrics.ownershipDirtyRowsVisited += 1;
|
|
63824
|
+
}
|
|
63825
|
+
const rootId = state?.constructorGroupByRowId.get(rowId);
|
|
63826
|
+
if (rootId !== void 0 && state?.constructorGroups.has(rootId)) {
|
|
63827
|
+
candidateIds.add(rowId);
|
|
63828
|
+
} else {
|
|
63829
|
+
indexes.constructorOwnershipDirtyValueIds.delete(rowId);
|
|
63830
|
+
}
|
|
63831
|
+
}
|
|
63832
|
+
}
|
|
63833
|
+
if (candidateIds.size === 0) return;
|
|
63834
|
+
indexes ??= evaluatorIndexes(ctx);
|
|
63835
|
+
if (ctx.__constructorPerformanceMetrics !== void 0) {
|
|
63836
|
+
ctx.__constructorPerformanceMetrics.ownershipCandidateRowsValidated += candidateIds.size;
|
|
63460
63837
|
}
|
|
63461
63838
|
for (const valueId of candidateIds) {
|
|
63462
63839
|
const owners = currentOwnedValueAttachments(valueId, ctx);
|
|
63463
|
-
if (owners.length
|
|
63464
|
-
|
|
63465
|
-
|
|
63466
|
-
|
|
63840
|
+
if (owners.length > 1) {
|
|
63841
|
+
throw new NSGetterRuntimeError(
|
|
63842
|
+
`Constructed value '${valueId}' has multiple structural parents (${owners.map((owner) => owner.label).join(
|
|
63843
|
+
", "
|
|
63844
|
+
)}). Reuse its row in one field or call Clone() explicitly.`
|
|
63845
|
+
);
|
|
63846
|
+
}
|
|
63847
|
+
indexes.constructorOwnershipDirtyValueIds.delete(valueId);
|
|
63467
63848
|
}
|
|
63468
63849
|
}
|
|
63469
63850
|
function assertImplicitConstructionAllowed(schemaClass2) {
|
|
@@ -63508,6 +63889,20 @@ function constructClassValueWithinFrame(descriptor, scope, ctx) {
|
|
|
63508
63889
|
values: ctx.vm.values,
|
|
63509
63890
|
memberById: ctx.vm.databaseVM?.memberById,
|
|
63510
63891
|
valueById: ctx.vm.databaseVM?.valueById,
|
|
63892
|
+
resolvedMember: (member) => member === syntheticMember ? syntheticMember : cachedResolvedMember(member, ctx),
|
|
63893
|
+
storedInstanceSchema: (nestedClassId) => cachedStoredInstanceSchema(nestedClassId, ctx),
|
|
63894
|
+
storedInstanceMaterializationPlan: (nestedClassId, instanceEnv) => cachedStoredInstanceMaterializationPlan(
|
|
63895
|
+
nestedClassId,
|
|
63896
|
+
instanceEnv,
|
|
63897
|
+
ctx
|
|
63898
|
+
),
|
|
63899
|
+
instanceEnv: (nestedClassId, classArguments2) => cachedInstanceEnv(nestedClassId, classArguments2, ctx),
|
|
63900
|
+
isInitValueContent: (value) => cachedIsInitValueContent(value, ctx),
|
|
63901
|
+
createValueRow: (projectId, body) => buildNewValue(
|
|
63902
|
+
projectId,
|
|
63903
|
+
body,
|
|
63904
|
+
ctx.__executionState?.constructionTimestamp
|
|
63905
|
+
),
|
|
63511
63906
|
projectFiles: ctx.vm.projectFiles ?? [],
|
|
63512
63907
|
textureTemplates: ctx.vm.textureTemplates ?? []
|
|
63513
63908
|
},
|
|
@@ -63543,19 +63938,21 @@ function constructClassValueWithinFrame(descriptor, scope, ctx) {
|
|
|
63543
63938
|
);
|
|
63544
63939
|
}
|
|
63545
63940
|
const rootRecord = root.value;
|
|
63546
|
-
|
|
63547
|
-
|
|
63548
|
-
|
|
63549
|
-
|
|
63550
|
-
|
|
63551
|
-
|
|
63552
|
-
|
|
63553
|
-
|
|
63554
|
-
|
|
63555
|
-
|
|
63556
|
-
|
|
63557
|
-
|
|
63558
|
-
|
|
63941
|
+
if (supplied.length > 0) {
|
|
63942
|
+
applyConstructorFields({
|
|
63943
|
+
supplied,
|
|
63944
|
+
root,
|
|
63945
|
+
rootRecord,
|
|
63946
|
+
schemaClass: schemaClass2,
|
|
63947
|
+
instanceEnv: descriptor.instanceEnv,
|
|
63948
|
+
createdValues,
|
|
63949
|
+
createdById: new Map(createdValues.map((row) => [row.id, row])),
|
|
63950
|
+
storageKeyDeclarations,
|
|
63951
|
+
// Generated C# factories pass null for an omitted optional parameter.
|
|
63952
|
+
nullMeansOmit: true,
|
|
63953
|
+
ctx
|
|
63954
|
+
});
|
|
63955
|
+
}
|
|
63559
63956
|
} catch (error) {
|
|
63560
63957
|
if (error instanceof NSGetterRuntimeError) throw error;
|
|
63561
63958
|
throw new NSGetterRuntimeError(
|
|
@@ -63567,6 +63964,7 @@ function constructClassValueWithinFrame(descriptor, scope, ctx) {
|
|
|
63567
63964
|
classId,
|
|
63568
63965
|
createdValues,
|
|
63569
63966
|
storageKeyDeclarations,
|
|
63967
|
+
mayHaveOrphanedRows: supplied.some((entry) => entry.value !== null),
|
|
63570
63968
|
ctx
|
|
63571
63969
|
});
|
|
63572
63970
|
return root.value;
|
|
@@ -64095,9 +64493,12 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
|
|
|
64095
64493
|
const closeFrame = pushConstructionFrame(ctx, `${member.name} initializer`);
|
|
64096
64494
|
let result;
|
|
64097
64495
|
try {
|
|
64496
|
+
const initializerCtx = ctx.thisValue === null ? ctx : Object.assign({}, ctx, {
|
|
64497
|
+
thisValue: null
|
|
64498
|
+
});
|
|
64098
64499
|
result = evaluateNSGetterWithEffects(
|
|
64099
64500
|
compiled,
|
|
64100
|
-
|
|
64501
|
+
initializerCtx,
|
|
64101
64502
|
argumentValues
|
|
64102
64503
|
);
|
|
64103
64504
|
} finally {
|
|
@@ -64125,9 +64526,8 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
|
|
|
64125
64526
|
}
|
|
64126
64527
|
return { value: result.value, classId: existingRuntimeClassId };
|
|
64127
64528
|
}
|
|
64128
|
-
ctx
|
|
64529
|
+
deleteRuntimeSessionValue(ctx, rootRow.id);
|
|
64129
64530
|
ctx.__executionState?.constructorGroups.delete(rootRow.id);
|
|
64130
|
-
invalidateEvaluatorIndexes(ctx);
|
|
64131
64531
|
const constructorArgs = typeof result.value === "object" && result.value !== null ? ctx.__constructedArgumentsByValue.get(result.value) : void 0;
|
|
64132
64532
|
return {
|
|
64133
64533
|
value: result.value,
|
|
@@ -64146,10 +64546,9 @@ function encodeLookupInitializerResult(member, value, created, ctx) {
|
|
|
64146
64546
|
);
|
|
64147
64547
|
if (created.length > 0) {
|
|
64148
64548
|
for (const row of created) {
|
|
64149
|
-
ctx
|
|
64549
|
+
deleteRuntimeSessionValue(ctx, row.id);
|
|
64150
64550
|
ctx.__executionState?.constructorGroups.delete(row.id);
|
|
64151
64551
|
}
|
|
64152
|
-
invalidateEvaluatorIndexes(ctx);
|
|
64153
64552
|
}
|
|
64154
64553
|
return { value: selection, classId: null };
|
|
64155
64554
|
}
|
|
@@ -64205,10 +64604,25 @@ function initializerRootRow(value, created) {
|
|
|
64205
64604
|
return created.find((row) => row.value === value) ?? null;
|
|
64206
64605
|
}
|
|
64207
64606
|
function constructorGroupForRow(valueId, ctx) {
|
|
64208
|
-
|
|
64209
|
-
|
|
64210
|
-
|
|
64211
|
-
return null;
|
|
64607
|
+
const state = ctx.__executionState;
|
|
64608
|
+
if (state === void 0) return null;
|
|
64609
|
+
const rootId = state.constructorGroupByRowId.get(valueId);
|
|
64610
|
+
return rootId !== void 0 && state.constructorGroups.has(rootId) ? rootId : null;
|
|
64611
|
+
}
|
|
64612
|
+
function recordConstructorGroupDependency(valueId, destination, ctx) {
|
|
64613
|
+
if (!destination.identity.startsWith("value:")) return;
|
|
64614
|
+
const state = ctx.__executionState;
|
|
64615
|
+
if (state === void 0) return;
|
|
64616
|
+
const dependencyRootId = constructorGroupForRow(valueId, ctx);
|
|
64617
|
+
if (dependencyRootId === null) return;
|
|
64618
|
+
const ownerRootId = constructorGroupForRow(destination.label, ctx) ?? destination.label;
|
|
64619
|
+
if (ownerRootId === dependencyRootId) return;
|
|
64620
|
+
let dependencies = state.constructorGroupDependencies.get(ownerRootId);
|
|
64621
|
+
if (dependencies === void 0) {
|
|
64622
|
+
dependencies = /* @__PURE__ */ new Set();
|
|
64623
|
+
state.constructorGroupDependencies.set(ownerRootId, dependencies);
|
|
64624
|
+
}
|
|
64625
|
+
dependencies.add(dependencyRootId);
|
|
64212
64626
|
}
|
|
64213
64627
|
function encodeRequiredConstructorArgument(args) {
|
|
64214
64628
|
const trackedId = findKnownRowIdByValueReference(args.value, args.ctx);
|
|
@@ -64342,6 +64756,10 @@ function constructDeclaredClassValueWithinFrame(descriptor, record3, info, scope
|
|
|
64342
64756
|
);
|
|
64343
64757
|
const createdValues = [];
|
|
64344
64758
|
const storageKeyDeclarations = /* @__PURE__ */ new Map();
|
|
64759
|
+
const syntheticMember = syntheticConstructorMember(
|
|
64760
|
+
schemaClass2,
|
|
64761
|
+
descriptor.classArguments
|
|
64762
|
+
);
|
|
64345
64763
|
let root;
|
|
64346
64764
|
try {
|
|
64347
64765
|
root = buildDefaultMemberValue({
|
|
@@ -64353,14 +64771,25 @@ function constructDeclaredClassValueWithinFrame(descriptor, record3, info, scope
|
|
|
64353
64771
|
values: ctx.vm.values,
|
|
64354
64772
|
memberById: ctx.vm.databaseVM?.memberById,
|
|
64355
64773
|
valueById: ctx.vm.databaseVM?.valueById,
|
|
64774
|
+
resolvedMember: (member) => member === syntheticMember ? syntheticMember : cachedResolvedMember(member, ctx),
|
|
64775
|
+
storedInstanceSchema: (nestedClassId) => cachedStoredInstanceSchema(nestedClassId, ctx),
|
|
64776
|
+
storedInstanceMaterializationPlan: (nestedClassId, instanceEnv) => cachedStoredInstanceMaterializationPlan(
|
|
64777
|
+
nestedClassId,
|
|
64778
|
+
instanceEnv,
|
|
64779
|
+
ctx
|
|
64780
|
+
),
|
|
64781
|
+
instanceEnv: (nestedClassId, classArguments2) => cachedInstanceEnv(nestedClassId, classArguments2, ctx),
|
|
64782
|
+
isInitValueContent: (value) => cachedIsInitValueContent(value, ctx),
|
|
64783
|
+
createValueRow: (projectId, body) => buildNewValue(
|
|
64784
|
+
projectId,
|
|
64785
|
+
body,
|
|
64786
|
+
ctx.__executionState?.constructionTimestamp
|
|
64787
|
+
),
|
|
64356
64788
|
projectFiles: ctx.vm.projectFiles ?? [],
|
|
64357
64789
|
textureTemplates: ctx.vm.textureTemplates ?? []
|
|
64358
64790
|
},
|
|
64359
64791
|
projectId: ctx.vm.project.id,
|
|
64360
|
-
member:
|
|
64361
|
-
schemaClass2,
|
|
64362
|
-
descriptor.classArguments
|
|
64363
|
-
),
|
|
64792
|
+
member: syntheticMember,
|
|
64364
64793
|
topLevelClassId: classId,
|
|
64365
64794
|
createdValues,
|
|
64366
64795
|
storageKeyDeclarations,
|
|
@@ -64427,7 +64856,7 @@ function constructDeclaredClassValueWithinFrame(descriptor, record3, info, scope
|
|
|
64427
64856
|
root.constructorArgs = structuredClone(encoded);
|
|
64428
64857
|
}
|
|
64429
64858
|
stageConstructedRows(createdValues, ctx);
|
|
64430
|
-
bindConstructedDelegateTargets(
|
|
64859
|
+
bindConstructedDelegateTargets(createdValues, ctx);
|
|
64431
64860
|
if (record3 !== null) {
|
|
64432
64861
|
runDeclaredConstructorChain({
|
|
64433
64862
|
record: record3,
|
|
@@ -64465,20 +64894,22 @@ function constructDeclaredClassValueWithinFrame(descriptor, record3, info, scope
|
|
|
64465
64894
|
}
|
|
64466
64895
|
const supplied = evaluateConstructorFields(descriptor, scope, ctx);
|
|
64467
64896
|
try {
|
|
64468
|
-
|
|
64469
|
-
|
|
64470
|
-
|
|
64471
|
-
|
|
64472
|
-
|
|
64473
|
-
|
|
64474
|
-
|
|
64475
|
-
|
|
64476
|
-
|
|
64477
|
-
|
|
64478
|
-
|
|
64479
|
-
|
|
64480
|
-
|
|
64481
|
-
|
|
64897
|
+
if (supplied.length > 0) {
|
|
64898
|
+
applyConstructorFields({
|
|
64899
|
+
supplied,
|
|
64900
|
+
root,
|
|
64901
|
+
rootRecord,
|
|
64902
|
+
schemaClass: schemaClass2,
|
|
64903
|
+
instanceEnv: descriptor.instanceEnv,
|
|
64904
|
+
createdValues,
|
|
64905
|
+
createdById: new Map(createdValues.map((row) => [row.id, row])),
|
|
64906
|
+
storageKeyDeclarations,
|
|
64907
|
+
// §6.1 step 4: these are initializer-block assignments, so an explicit
|
|
64908
|
+
// null clears the slot rather than omitting the field.
|
|
64909
|
+
nullMeansOmit: false,
|
|
64910
|
+
ctx
|
|
64911
|
+
});
|
|
64912
|
+
}
|
|
64482
64913
|
} catch (error) {
|
|
64483
64914
|
if (error instanceof NSGetterRuntimeError) throw error;
|
|
64484
64915
|
throw new NSGetterRuntimeError(
|
|
@@ -64490,6 +64921,7 @@ function constructDeclaredClassValueWithinFrame(descriptor, record3, info, scope
|
|
|
64490
64921
|
classId,
|
|
64491
64922
|
createdValues,
|
|
64492
64923
|
storageKeyDeclarations,
|
|
64924
|
+
mayHaveOrphanedRows: record3 !== null || supplied.length > 0,
|
|
64493
64925
|
ctx
|
|
64494
64926
|
});
|
|
64495
64927
|
return root.value;
|
|
@@ -64523,6 +64955,7 @@ function assertOwnedValueAttachable(valueId, destination, destinationName2, ctx,
|
|
|
64523
64955
|
);
|
|
64524
64956
|
if (constructorArgumentReservation && (destination.label === reserved.label || destinationConstructorGroup === reserved.label)) {
|
|
64525
64957
|
ctx.__executionState?.ownedValueAttachments.set(valueId, destination);
|
|
64958
|
+
recordConstructorGroupDependency(valueId, destination, ctx);
|
|
64526
64959
|
return;
|
|
64527
64960
|
}
|
|
64528
64961
|
throw new NSGetterRuntimeError(
|
|
@@ -64532,11 +64965,15 @@ function assertOwnedValueAttachable(valueId, destination, destinationName2, ctx,
|
|
|
64532
64965
|
if (reserveUntilPublished) {
|
|
64533
64966
|
ctx.__executionState?.ownedValueAttachments.set(valueId, destination);
|
|
64534
64967
|
}
|
|
64968
|
+
recordConstructorGroupDependency(valueId, destination, ctx);
|
|
64535
64969
|
}
|
|
64536
64970
|
function currentOwnedValueAttachments(valueId, ctx) {
|
|
64537
64971
|
const indexes = evaluatorIndexes(ctx);
|
|
64538
64972
|
const cached = indexes.ownedValueAttachmentsByValueId.get(valueId);
|
|
64539
64973
|
if (cached !== void 0) return [...cached];
|
|
64974
|
+
if (ctx.__constructorPerformanceMetrics !== void 0) {
|
|
64975
|
+
ctx.__constructorPerformanceMetrics.ownershipAttachmentCacheMisses += 1;
|
|
64976
|
+
}
|
|
64540
64977
|
const found = /* @__PURE__ */ new Map();
|
|
64541
64978
|
const add = (attachment) => {
|
|
64542
64979
|
found.set(attachment.identity, attachment);
|
|
@@ -65156,11 +65593,11 @@ function cloneClassValueGraph(receiver, expectedClassId, ctx) {
|
|
|
65156
65593
|
`Class.Clone source value '${sourceId3}' has runtime Class '${runtimeClassId}', which is not assignable to '${expectedClassId}'.`
|
|
65157
65594
|
);
|
|
65158
65595
|
}
|
|
65159
|
-
|
|
65596
|
+
if (ctx.__runtimeSessionValues === void 0) {
|
|
65160
65597
|
throw new NSGetterRuntimeError(
|
|
65161
65598
|
"Class.Clone requires an evaluator Session value registry."
|
|
65162
65599
|
);
|
|
65163
|
-
}
|
|
65600
|
+
}
|
|
65164
65601
|
const active = /* @__PURE__ */ new Set();
|
|
65165
65602
|
const clonedBySourceId = /* @__PURE__ */ new Map();
|
|
65166
65603
|
const constructorArgumentReferenceCounts = /* @__PURE__ */ new Map();
|
|
@@ -65190,7 +65627,7 @@ function cloneClassValueGraph(receiver, expectedClassId, ctx) {
|
|
|
65190
65627
|
// parent explicitly supplies its fresh id.
|
|
65191
65628
|
containerId: clonedContainerId ?? null
|
|
65192
65629
|
};
|
|
65193
|
-
|
|
65630
|
+
registerRuntimeSessionValue(ctx, clone);
|
|
65194
65631
|
clonedBySourceId.set(sourceRow.id, clone);
|
|
65195
65632
|
if (typeof sourceRow.value === "object" && sourceRow.value !== null && !Array.isArray(sourceRow.value)) {
|
|
65196
65633
|
const sourceRecord = sourceRow.value;
|
|
@@ -65459,7 +65896,7 @@ function iterateCollection(c, ctx, callback) {
|
|
|
65459
65896
|
return callback(entry, key, valueId);
|
|
65460
65897
|
});
|
|
65461
65898
|
}
|
|
65462
|
-
var DELEGATE_LEXICAL_THIS, DELEGATE_LEXICAL_ROOT, NonCatchableNSGetterRuntimeError, NativeFunctionDelegateUnavailableError, CorruptNeoScriptIRError, NeoScriptResourceLimitError, NeoScriptWallClockTimeoutError, DEFAULT_NEO_SCRIPT_EXECUTION_BUDGET_LIMITS, liveListIndexesByProject, evaluatorOwnershipCachesByBase, MAX_CONSTRUCTION_DEPTH, MAX_LOOP_ITERATIONS, resolutionCacheByMembers, NO_SCHEMA_REVISION, LazyValueOverlay, READONLY_FOREACH_BINDING_ERROR, READONLY_CATCH_BINDING_ERROR;
|
|
65899
|
+
var DELEGATE_LEXICAL_THIS, DELEGATE_LEXICAL_ROOT, NonCatchableNSGetterRuntimeError, NativeFunctionDelegateUnavailableError, CorruptNeoScriptIRError, NeoScriptResourceLimitError, NeoScriptWallClockTimeoutError, DEFAULT_NEO_SCRIPT_EXECUTION_BUDGET_LIMITS, liveListIndexesByProject, evaluatorOwnershipCachesByBase, MAX_CONSTRUCTION_DEPTH, MAX_LOOP_ITERATIONS, resolutionCacheByMembers, NO_SCHEMA_REVISION, LazyValueOverlay, READONLY_FOREACH_BINDING_ERROR, READONLY_CATCH_BINDING_ERROR, EMPTY_SUPPLIED_CONSTRUCTOR_FIELDS;
|
|
65463
65900
|
var init_evaluateNSGetter = __esm({
|
|
65464
65901
|
"../src/view-models/neoscript-evaluator/evaluateNSGetter.ts"() {
|
|
65465
65902
|
"use strict";
|
|
@@ -65603,6 +66040,7 @@ var init_evaluateNSGetter = __esm({
|
|
|
65603
66040
|
};
|
|
65604
66041
|
READONLY_FOREACH_BINDING_ERROR = "Cannot assign to a read-only foreach iterator binding.";
|
|
65605
66042
|
READONLY_CATCH_BINDING_ERROR = "Cannot assign to a read-only catch message binding.";
|
|
66043
|
+
EMPTY_SUPPLIED_CONSTRUCTOR_FIELDS = [];
|
|
65606
66044
|
}
|
|
65607
66045
|
});
|
|
65608
66046
|
|
|
@@ -87437,10 +87875,28 @@ function emitMemberDefaultSourcesV4(records2, manifest) {
|
|
|
87437
87875
|
continue;
|
|
87438
87876
|
}
|
|
87439
87877
|
const member = record3.data;
|
|
87878
|
+
const manifestMember = context.manifestMembers.get(record3.recordId);
|
|
87879
|
+
const defaultValue = isObjectRecord2(member.defaultValue) ? member.defaultValue : {};
|
|
87880
|
+
const linkedLocalizedTextId = defaultValue.value;
|
|
87881
|
+
if (manifestMember?.kind === "string" && manifestMember.localizable && typeof linkedLocalizedTextId === "string" && context.localizedTexts.has(linkedLocalizedTextId)) {
|
|
87882
|
+
const localizedText = context.localizedTexts.get(linkedLocalizedTextId);
|
|
87883
|
+
const localeValues = isObjectRecord2(localizedText?.localeValues) ? localizedText.localeValues : {};
|
|
87884
|
+
const mainLocale = localeValues[context.mainLocale];
|
|
87885
|
+
const mainLocaleValue = isObjectRecord2(mainLocale) ? mainLocale.value : void 0;
|
|
87886
|
+
initializers.set(
|
|
87887
|
+
record3.recordId,
|
|
87888
|
+
mainLocaleValue === null ? quote5(linkedLocalizedTextId) : quote5(localizedString(context, member, linkedLocalizedTextId))
|
|
87889
|
+
);
|
|
87890
|
+
recordKeysByMember.set(
|
|
87891
|
+
record3.recordId,
|
|
87892
|
+
/* @__PURE__ */ new Set([`localized-text:${linkedLocalizedTextId}`])
|
|
87893
|
+
);
|
|
87894
|
+
context.localizedTextIds.clear();
|
|
87895
|
+
continue;
|
|
87896
|
+
}
|
|
87440
87897
|
const backed = rowBackedDefaultBody(member, (id2) => context.values.has(id2));
|
|
87441
87898
|
if (backed === null) continue;
|
|
87442
87899
|
const visited = /* @__PURE__ */ new Set();
|
|
87443
|
-
const defaultValue = isObjectRecord2(member.defaultValue) ? member.defaultValue : {};
|
|
87444
87900
|
const environment = declaringClassGenericEnvironment(context, member);
|
|
87445
87901
|
let expression;
|
|
87446
87902
|
if (backed.kind === "class") {
|
|
@@ -87797,6 +88253,39 @@ function lowerMemberDefaultSourcesV4(state, analysis, manifest, options = {}) {
|
|
|
87797
88253
|
bindingRuntimeIdentifiers(context, binding)
|
|
87798
88254
|
);
|
|
87799
88255
|
const baseData3 = stateData(context, "member", memberId);
|
|
88256
|
+
const annotatedExpression = annotatedValue(expression).expression;
|
|
88257
|
+
const storedDefault = isObjectRecord2(baseData3?.defaultValue) ? baseData3.defaultValue : null;
|
|
88258
|
+
const storedLocalizedTextId = storedDefault?.value;
|
|
88259
|
+
const storedDefaultClassId = storedDefault?.classId;
|
|
88260
|
+
const storedLocalizedText = typeof storedLocalizedTextId === "string" ? state[`localized-text:${storedLocalizedTextId}`]?.data : void 0;
|
|
88261
|
+
const authoredLocalizedValue = annotatedExpression.kind === "litString" ? annotatedExpression.value : annotatedExpression.kind === "litNull" ? null : void 0;
|
|
88262
|
+
if (member.kind === "string" && member.localizable && authoredLocalizedValue !== void 0 && typeof storedLocalizedTextId === "string" && isObjectRecord2(storedLocalizedText)) {
|
|
88263
|
+
if (annotatedExpression.kind === "litString" && annotatedExpression.value === storedLocalizedTextId) {
|
|
88264
|
+
addReconstructed(
|
|
88265
|
+
context,
|
|
88266
|
+
"localized-text",
|
|
88267
|
+
storedLocalizedTextId,
|
|
88268
|
+
nonVolatileFields(storedLocalizedText),
|
|
88269
|
+
binding.source
|
|
88270
|
+
);
|
|
88271
|
+
memberDefaultValues.set(memberId, {
|
|
88272
|
+
value: storedLocalizedTextId,
|
|
88273
|
+
classId: typeof storedDefaultClassId === "string" ? storedDefaultClassId : null
|
|
88274
|
+
});
|
|
88275
|
+
continue;
|
|
88276
|
+
}
|
|
88277
|
+
const preservedTextId = lowerLinkedLocalizedText(
|
|
88278
|
+
context,
|
|
88279
|
+
storedLocalizedTextId,
|
|
88280
|
+
authoredLocalizedValue,
|
|
88281
|
+
binding
|
|
88282
|
+
);
|
|
88283
|
+
memberDefaultValues.set(memberId, {
|
|
88284
|
+
value: preservedTextId,
|
|
88285
|
+
classId: typeof storedDefaultClassId === "string" ? storedDefaultClassId : null
|
|
88286
|
+
});
|
|
88287
|
+
continue;
|
|
88288
|
+
}
|
|
87800
88289
|
const backed = baseData3 === null || requiresEvaluation ? null : rowBackedDefaultBody(baseData3, (id2) => pulledValueIds.has(id2));
|
|
87801
88290
|
if (backed !== null && baseData3 !== null) {
|
|
87802
88291
|
const existingReconstructedKeys = new Set(context.reconstructed.keys());
|
|
@@ -90300,6 +90789,18 @@ function lowerStringValue(context, member, expression, base, source) {
|
|
|
90300
90789
|
if (!isObjectRecord2(textState?.data)) {
|
|
90301
90790
|
return expression.value;
|
|
90302
90791
|
}
|
|
90792
|
+
return lowerLinkedLocalizedText(
|
|
90793
|
+
context,
|
|
90794
|
+
base.value,
|
|
90795
|
+
expression.value,
|
|
90796
|
+
source
|
|
90797
|
+
);
|
|
90798
|
+
}
|
|
90799
|
+
function lowerLinkedLocalizedText(context, textId, value, source) {
|
|
90800
|
+
const textState = context.state[`localized-text:${textId}`];
|
|
90801
|
+
if (!isObjectRecord2(textState?.data)) {
|
|
90802
|
+
throw new Error(`Localized text ${textId} was not pulled.`);
|
|
90803
|
+
}
|
|
90303
90804
|
const textBase = textState.data;
|
|
90304
90805
|
const localeValues = isObjectRecord2(textBase.localeValues) ? textBase.localeValues : {};
|
|
90305
90806
|
const currentValue = localeValues[context.mainLocale];
|
|
@@ -90307,17 +90808,17 @@ function lowerStringValue(context, member, expression, base, source) {
|
|
|
90307
90808
|
addReconstructed(
|
|
90308
90809
|
context,
|
|
90309
90810
|
"localized-text",
|
|
90310
|
-
|
|
90811
|
+
textId,
|
|
90311
90812
|
{
|
|
90312
90813
|
...nonVolatileFields(textBase),
|
|
90313
90814
|
localeValues: {
|
|
90314
90815
|
...localeValues,
|
|
90315
|
-
[context.mainLocale]: { ...current, value
|
|
90816
|
+
[context.mainLocale]: { ...current, value }
|
|
90316
90817
|
}
|
|
90317
90818
|
},
|
|
90318
90819
|
source.source
|
|
90319
90820
|
);
|
|
90320
|
-
return
|
|
90821
|
+
return textId;
|
|
90321
90822
|
}
|
|
90322
90823
|
function lowerEnum2(context, member, expression) {
|
|
90323
90824
|
const elements = member.multiselect ? expression.kind === "litList" ? expression.elements : null : [expression];
|
|
@@ -93989,16 +94490,28 @@ var init_workspace_status = __esm({
|
|
|
93989
94490
|
// src/project-source/status-output.ts
|
|
93990
94491
|
function groupProjectStatusChangesV4(status) {
|
|
93991
94492
|
const groups = /* @__PURE__ */ new Map();
|
|
94493
|
+
const group = (source) => {
|
|
94494
|
+
const existing = groups.get(source);
|
|
94495
|
+
if (existing !== void 0) return existing;
|
|
94496
|
+
const created = { changes: [], authoredValueSeeds: [] };
|
|
94497
|
+
groups.set(source, created);
|
|
94498
|
+
return created;
|
|
94499
|
+
};
|
|
93992
94500
|
for (const change of status.changes) {
|
|
93993
94501
|
const reconstructed3 = status.reconstructed.get(
|
|
93994
94502
|
recordStateKey(change.recordKind, change.recordId)
|
|
93995
94503
|
);
|
|
93996
94504
|
const source = reconstructed3?.sourceSpan?.path ?? change.file ?? "<unplaced>";
|
|
93997
|
-
|
|
93998
|
-
entries.push(change);
|
|
93999
|
-
groups.set(source, entries);
|
|
94505
|
+
group(source).changes.push(change);
|
|
94000
94506
|
}
|
|
94001
|
-
|
|
94507
|
+
for (const [memberId, seed] of status.authoredValueSeeds) {
|
|
94508
|
+
const reconstructed3 = status.reconstructed.get(
|
|
94509
|
+
recordStateKey("member", memberId)
|
|
94510
|
+
);
|
|
94511
|
+
const source = reconstructed3?.sourceSpan?.path ?? "<unplaced>";
|
|
94512
|
+
group(source).authoredValueSeeds.push({ memberId, seed });
|
|
94513
|
+
}
|
|
94514
|
+
return [...groups].sort(([left], [right]) => compareCodePoints(left, right)).map(([source, entries]) => ({ source, ...entries }));
|
|
94002
94515
|
}
|
|
94003
94516
|
function projectStatusJsonV4(status, options) {
|
|
94004
94517
|
return {
|
|
@@ -94040,7 +94553,18 @@ function projectStatusJsonV4(status, options) {
|
|
|
94040
94553
|
mimeType: binary.mimeType
|
|
94041
94554
|
} : null,
|
|
94042
94555
|
conflictArtifactPath: binary.conflictArtifactPath ?? null
|
|
94043
|
-
}))
|
|
94556
|
+
})),
|
|
94557
|
+
authoredValueSeeds: [...status.authoredValueSeeds].sort(([left], [right]) => compareCodePoints(left, right)).map(([memberId, seed]) => {
|
|
94558
|
+
const reconstructed3 = status.reconstructed.get(
|
|
94559
|
+
recordStateKey("member", memberId)
|
|
94560
|
+
);
|
|
94561
|
+
return {
|
|
94562
|
+
operation: "create",
|
|
94563
|
+
memberId,
|
|
94564
|
+
valueId: seed.valueId ?? null,
|
|
94565
|
+
sourceSpan: reconstructed3?.sourceSpan ?? null
|
|
94566
|
+
};
|
|
94567
|
+
})
|
|
94044
94568
|
};
|
|
94045
94569
|
}
|
|
94046
94570
|
function recordChangeJsonV4(change, status, options) {
|
|
@@ -102673,7 +103197,7 @@ var init_registry2 = __esm({
|
|
|
102673
103197
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
102674
103198
|
formatVersion: 3,
|
|
102675
103199
|
contractVersion: "3.9",
|
|
102676
|
-
cliVersion: "0.26.
|
|
103200
|
+
cliVersion: "0.26.5",
|
|
102677
103201
|
projectFileUploadBatchSize: 32,
|
|
102678
103202
|
documentRecords: {
|
|
102679
103203
|
member: {
|
|
@@ -109238,7 +109762,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
|
|
|
109238
109762
|
async function main() {
|
|
109239
109763
|
const args = parseArgs(process.argv.slice(2));
|
|
109240
109764
|
if (args.command === "--version") {
|
|
109241
|
-
console.log("0.26.
|
|
109765
|
+
console.log("0.26.5");
|
|
109242
109766
|
return;
|
|
109243
109767
|
}
|
|
109244
109768
|
if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
|
|
@@ -109653,17 +110177,17 @@ async function main() {
|
|
|
109653
110177
|
` ${paintChangeKind(change.kind)} ${describeChange(change).replace(`${change.kind} `, "")}`
|
|
109654
110178
|
);
|
|
109655
110179
|
}
|
|
110180
|
+
if (group.authoredValueSeeds.length > 0) {
|
|
110181
|
+
console.log(
|
|
110182
|
+
` ${paintChangeKind("create")} ${group.authoredValueSeeds.length} member value seed(s)`
|
|
110183
|
+
);
|
|
110184
|
+
}
|
|
109656
110185
|
}
|
|
109657
110186
|
for (const binary of status.binaryChanges ?? []) {
|
|
109658
110187
|
console.log(
|
|
109659
110188
|
`${paintChangeKind(binary.action === "create" ? "create" : "update")} project-file bytes ${binary.symbol} (${binary.path}) \u2014 ${binary.action}`
|
|
109660
110189
|
);
|
|
109661
110190
|
}
|
|
109662
|
-
if (status.authoredValueSeeds.size > 0) {
|
|
109663
|
-
console.log(
|
|
109664
|
-
` ${paintChangeKind("create")} ${status.authoredValueSeeds.size} member value seed(s)`
|
|
109665
|
-
);
|
|
109666
|
-
}
|
|
109667
110191
|
if (status.conflictedFiles.length === 0 && status.parseErrors.length === 0 && status.changes.length === 0 && status.authoredValueSeeds.size === 0 && (status.binaryChanges?.length ?? 0) === 0) {
|
|
109668
110192
|
console.log(`${sym.ok} Working copy is clean.`);
|
|
109669
110193
|
}
|
|
@@ -109695,13 +110219,18 @@ async function main() {
|
|
|
109695
110219
|
console.log(color.dim(` ${line}`));
|
|
109696
110220
|
}
|
|
109697
110221
|
}
|
|
110222
|
+
if (group.authoredValueSeeds.length > 0) {
|
|
110223
|
+
console.log(
|
|
110224
|
+
` ${paintChangeKind("create")} ${group.authoredValueSeeds.length} member value seed(s)`
|
|
110225
|
+
);
|
|
110226
|
+
}
|
|
109698
110227
|
}
|
|
109699
110228
|
for (const binary of status.binaryChanges ?? []) {
|
|
109700
110229
|
console.log(
|
|
109701
110230
|
`${paintChangeKind(binary.action === "create" ? "create" : "update")} project-file bytes ${binary.symbol} (${binary.path}) \u2014 ${binary.action}`
|
|
109702
110231
|
);
|
|
109703
110232
|
}
|
|
109704
|
-
if (status.changes.length === 0 && (status.binaryChanges?.length ?? 0) === 0) {
|
|
110233
|
+
if (status.changes.length === 0 && status.authoredValueSeeds.size === 0 && (status.binaryChanges?.length ?? 0) === 0) {
|
|
109705
110234
|
console.log(`${sym.ok} No local changes.`);
|
|
109706
110235
|
}
|
|
109707
110236
|
return;
|