@neocompose/cli 0.81.1 → 0.81.2

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
@@ -1291,6 +1291,15 @@ function neoScriptRegistryEntryType(typeName) {
1291
1291
  }
1292
1292
  return REGISTRY_ENTRY_TYPES[typeName] ?? null;
1293
1293
  }
1294
+ function typeArgumentArityMessage(typeName, expected, provided) {
1295
+ return `Type '${typeName}' expects ${expected} type argument${expected === 1 ? "" : "s"}, but ${provided} ${provided === 1 ? "was" : "were"} provided.`;
1296
+ }
1297
+ function genericParameterArgumentsMessage(name) {
1298
+ return `Generic parameter '${name}' cannot receive type arguments.`;
1299
+ }
1300
+ function delegateArityMessage(provided) {
1301
+ return `Type 'NeoDelegate' expects a return type followed by up to ${NEOSCRIPT_DELEGATE_MAX_PARAMETERS} parameter types, but ${provided} type arguments were provided.`;
1302
+ }
1294
1303
  function neoScriptRegistryReferenceType(entryTypeName) {
1295
1304
  for (const definition2 of Object.values(REGISTRY_ENTRY_TYPES)) {
1296
1305
  if (definition2.entryType === entryTypeName) return definition2.refType;
@@ -1376,7 +1385,7 @@ function vectorTypes() {
1376
1385
  members: structuredLeafFieldProperties(name)
1377
1386
  }));
1378
1387
  }
1379
- var NEO_PROJECT_IGNORED_DIRECTORY_NAMES, NEOSCRIPT_KEYWORDS, NEOSCRIPT_INFERRED_LOCAL_KEYWORD, NEOSCRIPT_CONSTRUCTOR_KEYWORD, NEOSCRIPT_PRIMITIVE_TYPES, NEOSCRIPT_BUILTIN_ANNOTATION_TYPES, NEOSCRIPT_BUILTIN_NAMESPACES, NEOSCRIPT_BUILTIN_TYPES, NEO_VARIANT_TYPE_NAME, NEO_VARIANT_FOLDER_TYPE_NAME, NEO_LOOKUP_VARIANT_TYPE_NAME, NEO_LOOKUP_VARIANT_FOLDER_TYPE_NAME, NEO_VARIANT_SCOPE_NAME, NEO_VARIANT_RESERVED_NAME, NEO_VARIANT_FOLDER_PATH_SEPARATOR, NEOSCRIPT_OPERATORS, STRING_TYPE2, INT_TYPE2, FLOAT_TYPE, DECIMAL_TYPE, BOOL_TYPE2, IMAGE_REF_TYPE, SPRITE_INFO_TYPE, VECTOR2_TYPE, FLOAT_OPTIONAL_TYPE, NEOSCRIPT_STRUCTURED_LEAF_FIELDS, NEOSCRIPT_IMAGE_REGISTRY_TYPE, NEOSCRIPT_AUDIO_CLIP_REGISTRY_TYPE, NEOSCRIPT_PENDING_SYMBOL_ID_PREFIX, REGISTRY_ENTRY_TYPES, NEOSCRIPT_GLOBALS, NEOSCRIPT_SCALAR_METHODS, NEOSCRIPT_CLASS_ID_MEMBER, NEOSCRIPT_ON_CHANGED_MEMBER, NEOSCRIPT_CLASS_ID_SYMBOL, NEOSCRIPT_PRIMITIVE_DERIVED_MEMBERS, NEOSCRIPT_SPRITE_INFO_EMPTY_MEMBER_ID, NEOSCRIPT_SPRITE_INFO_EMPTY_VALUE, NEOSCRIPT_MATH_TYPE_ID, MATH_INFERENCE_RULE, MATH_INTEGRAL_RULE, NEOSCRIPT_LIST_TYPE_NAME, NEOSCRIPT_LIST_TYPE_ID, NEOSCRIPT_LIST_REPEAT_NAME, LIST_ENTRY_TYPE, NEOSCRIPT_BUILTIN_TYPE_SYMBOLS;
1388
+ var NEO_PROJECT_IGNORED_DIRECTORY_NAMES, NEOSCRIPT_KEYWORDS, NEOSCRIPT_INFERRED_LOCAL_KEYWORD, NEOSCRIPT_CONSTRUCTOR_KEYWORD, NEOSCRIPT_PRIMITIVE_TYPES, NEOSCRIPT_BUILTIN_ANNOTATION_TYPES, NEOSCRIPT_BUILTIN_NAMESPACES, NEOSCRIPT_BUILTIN_TYPES, NEO_VARIANT_TYPE_NAME, NEO_VARIANT_FOLDER_TYPE_NAME, NEO_LOOKUP_VARIANT_TYPE_NAME, NEO_LOOKUP_VARIANT_FOLDER_TYPE_NAME, NEO_VARIANT_SCOPE_NAME, NEO_VARIANT_RESERVED_NAME, NEO_VARIANT_FOLDER_PATH_SEPARATOR, NEOSCRIPT_OPERATORS, STRING_TYPE2, INT_TYPE2, FLOAT_TYPE, DECIMAL_TYPE, BOOL_TYPE2, IMAGE_REF_TYPE, SPRITE_INFO_TYPE, VECTOR2_TYPE, FLOAT_OPTIONAL_TYPE, NEOSCRIPT_STRUCTURED_LEAF_FIELDS, NEOSCRIPT_IMAGE_REGISTRY_TYPE, NEOSCRIPT_AUDIO_CLIP_REGISTRY_TYPE, NEOSCRIPT_PENDING_SYMBOL_ID_PREFIX, REGISTRY_ENTRY_TYPES, NEOSCRIPT_DELEGATE_MAX_PARAMETERS, NEOSCRIPT_GLOBALS, NEOSCRIPT_SCALAR_METHODS, NEOSCRIPT_CLASS_ID_MEMBER, NEOSCRIPT_ON_CHANGED_MEMBER, NEOSCRIPT_CLASS_ID_SYMBOL, NEOSCRIPT_PRIMITIVE_DERIVED_MEMBERS, NEOSCRIPT_SPRITE_INFO_EMPTY_MEMBER_ID, NEOSCRIPT_SPRITE_INFO_EMPTY_VALUE, NEOSCRIPT_MATH_TYPE_ID, MATH_INFERENCE_RULE, MATH_INTEGRAL_RULE, NEOSCRIPT_LIST_TYPE_NAME, NEOSCRIPT_LIST_TYPE_ID, NEOSCRIPT_LIST_REPEAT_NAME, LIST_ENTRY_TYPE, NEOSCRIPT_BUILTIN_TYPE_SYMBOLS;
1380
1389
  var init_language_spec = __esm({
1381
1390
  "../packages/neoscript-language/src/language-spec.ts"() {
1382
1391
  "use strict";
@@ -1652,6 +1661,7 @@ var init_language_spec = __esm({
1652
1661
  refType: { kind: "primitive", name: "AudioClipRef" }
1653
1662
  }
1654
1663
  };
1664
+ NEOSCRIPT_DELEGATE_MAX_PARAMETERS = 16;
1655
1665
  NEOSCRIPT_GLOBALS = [
1656
1666
  builtinFunction(
1657
1667
  "VisitCount",
@@ -30982,21 +30992,34 @@ function resolveNeoScriptType(type, context, project) {
30982
30992
  const declaringType = declaringTypeRef?.kind === "named" ? project.typeById.get(declaringTypeRef.typeId) : void 0;
30983
30993
  const byName = (candidate) => candidate.name === type.name;
30984
30994
  const typeParameter2 = context.typeParameters?.find(byName) ?? declaringType?.typeParameters?.find(byName);
30995
+ const written = type.typeArguments?.length ?? 0;
30985
30996
  if (typeParameter2?.type.kind === "typeParameter") {
30997
+ if (written > 0)
30998
+ throw new CompileError(
30999
+ genericParameterArgumentsMessage(type.name),
31000
+ type.pos
31001
+ );
30986
31002
  resolved = typeParameter2.type;
30987
31003
  break;
30988
31004
  }
30989
31005
  const builtin = namedPrimitive(type.name);
31006
+ const registryReference = builtin ? null : neoScriptRegistryReferenceType(type.name);
31007
+ if ((builtin || registryReference) && written > 0)
31008
+ throw new CompileError(
31009
+ typeArgumentArityMessage(type.name, 0, written),
31010
+ type.pos
31011
+ );
30990
31012
  if (builtin) {
30991
31013
  resolved = { kind: "primitive", name: builtin };
30992
31014
  break;
30993
31015
  }
30994
- const registryReference = neoScriptRegistryReferenceType(type.name);
30995
31016
  if (registryReference) {
30996
31017
  resolved = registryReference;
30997
31018
  break;
30998
31019
  }
30999
31020
  if (type.name === "NeoDelegate") {
31021
+ if (written > NEOSCRIPT_DELEGATE_MAX_PARAMETERS + 1)
31022
+ throw new CompileError(delegateArityMessage(written), type.pos);
31000
31023
  const [returnType, ...parameterTypes] = (type.typeArguments ?? []).map(
31001
31024
  (argument2) => resolveNeoScriptType(argument2, context, project)
31002
31025
  );
@@ -31014,6 +31037,7 @@ function resolveNeoScriptType(type, context, project) {
31014
31037
  renamedDialogueTypeMessage(type.name, "value") ?? `Unknown type '${type.name}'`,
31015
31038
  type.pos
31016
31039
  );
31040
+ if (written > 0) assertTypeArgumentCount(named, written, type.pos);
31017
31041
  resolved = {
31018
31042
  kind: "named",
31019
31043
  typeId: named.id,
@@ -31082,6 +31106,14 @@ function assertDirectTypeParameterArguments(target, pos, project) {
31082
31106
  const message = wrappedTypeParameterMessage(target, project);
31083
31107
  if (message !== null) throw new CompileError(message, pos);
31084
31108
  }
31109
+ function assertTypeArgumentCount(declaring, count, pos) {
31110
+ const expected = declaring.typeParameters?.length ?? 0;
31111
+ if (count === expected) return;
31112
+ throw new CompileError(
31113
+ typeArgumentArityMessage(declaring.name, expected, count),
31114
+ pos
31115
+ );
31116
+ }
31085
31117
  function assertTypeArgumentConstraints(declaring, type, pos, project) {
31086
31118
  declaring.typeParameters?.forEach((parameter4, index) => {
31087
31119
  const argument2 = type.typeArguments?.[index];
@@ -36849,13 +36881,12 @@ var init_strict_resolver = __esm({
36849
36881
  const typeArguments = expression.typeArguments?.map(
36850
36882
  (argument2) => this.resolveType(argument2)
36851
36883
  );
36852
- if (typeArguments !== void 0 && typeArguments.length !== (schemaClass2.typeParameters?.length ?? 0)) {
36853
- throw new CompileError(
36854
- `Class '${schemaClass2.name}' expects ${schemaClass2.typeParameters?.length ?? 0} type argument${schemaClass2.typeParameters?.length === 1 ? "" : "s"} but got ${typeArguments.length}.`,
36884
+ if (typeArguments !== void 0) {
36885
+ assertTypeArgumentCount(
36886
+ schemaClass2,
36887
+ typeArguments.length,
36855
36888
  expression.pos
36856
36889
  );
36857
- }
36858
- if (typeArguments !== void 0) {
36859
36890
  const target = {
36860
36891
  kind: "named",
36861
36892
  typeId: schemaClass2.id,
@@ -50946,20 +50977,20 @@ function validateTypeApplication(uri, type, genericParameters, environment, diag
50946
50977
  uri,
50947
50978
  type.range,
50948
50979
  "generic-parameter-arguments",
50949
- `Generic parameter '${type.name}' cannot receive type arguments.`
50980
+ genericParameterArgumentsMessage(type.name)
50950
50981
  );
50951
50982
  }
50952
50983
  return;
50953
50984
  }
50954
50985
  const target = environment.declarations.get(type.name);
50955
50986
  if (type.name === "NeoDelegate") {
50956
- if (type.typeArguments.length < 1 || type.typeArguments.length > 17) {
50987
+ if (type.typeArguments.length < 1 || type.typeArguments.length > NEOSCRIPT_DELEGATE_MAX_PARAMETERS + 1) {
50957
50988
  diagnose(
50958
50989
  diagnostics,
50959
50990
  uri,
50960
50991
  type.range,
50961
50992
  "generic-argument-arity",
50962
- `Type 'NeoDelegate' expects a return type followed by up to 16 parameter types, but ${type.typeArguments.length} type arguments were provided.`
50993
+ delegateArityMessage(type.typeArguments.length)
50963
50994
  );
50964
50995
  }
50965
50996
  return;
@@ -50974,13 +51005,13 @@ function validateTypeApplication(uri, type, genericParameters, environment, diag
50974
51005
  "Type 'NeoAction' cannot use 'void' as a parameter type; spell a zero-argument action as bare 'NeoAction'."
50975
51006
  );
50976
51007
  }
50977
- if (type.typeArguments.length > 16) {
51008
+ if (type.typeArguments.length > NEOSCRIPT_DELEGATE_MAX_PARAMETERS) {
50978
51009
  diagnose(
50979
51010
  diagnostics,
50980
51011
  uri,
50981
51012
  type.range,
50982
51013
  "generic-argument-arity",
50983
- `Type 'NeoAction' expects up to 16 parameter types, but ${type.typeArguments.length} type arguments were provided.`
51014
+ `Type 'NeoAction' expects up to ${NEOSCRIPT_DELEGATE_MAX_PARAMETERS} parameter types, but ${type.typeArguments.length} type arguments were provided.`
50984
51015
  );
50985
51016
  }
50986
51017
  if (type.nullable) {
@@ -51002,7 +51033,7 @@ function validateTypeApplication(uri, type, genericParameters, environment, diag
51002
51033
  uri,
51003
51034
  type.range,
51004
51035
  "generic-argument-arity",
51005
- `Type '${type.name}' expects ${expected} type argument${expected === 1 ? "" : "s"}, but ${type.typeArguments.length} ${type.typeArguments.length === 1 ? "was" : "were"} provided.`,
51036
+ typeArgumentArityMessage(type.name, expected, type.typeArguments.length),
51006
51037
  target ? related(target.location, "The type declaration is here.") : void 0
51007
51038
  );
51008
51039
  return;
@@ -54533,7 +54564,7 @@ var init_registry = __esm({
54533
54564
  "../packages/manifest/schema-contract/registry.mjs"() {
54534
54565
  "use strict";
54535
54566
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
54536
- cliVersion: "0.81.1",
54567
+ cliVersion: "0.81.2",
54537
54568
  projectFileUploadBatchSize: 32,
54538
54569
  documentRecords: {
54539
54570
  member: {
@@ -77377,7 +77408,7 @@ function readNeoScriptRuntimeRow(ctx, valueId) {
77377
77408
  }
77378
77409
  function inspectNeoScriptValueReference(ctx, value, collection, index) {
77379
77410
  let id2 = findKnownRowIdByValueReference(value, ctx);
77380
- if (id2 === null && collection !== void 0 && index !== void 0 && typeof value === "string" && (findKnownRowIdByValueReference(collection, ctx) !== null || Array.isArray(collection) && typeof index === "number" && ctx.__unorderedListProjections?.referenceEntryIndexesByArray.get(collection)?.has(index) || typeof collection === "object" && collection !== null && typeof index === "string" && ctx.__unorderedListProjections?.referenceEntryKeysByRecord.get(collection)?.has(index))) {
77411
+ if (id2 === null && collection !== void 0 && index !== void 0 && typeof value === "string" && isReferenceEntry(collectionReferences(collection, ctx), index)) {
77381
77412
  id2 = value;
77382
77413
  }
77383
77414
  if (id2 === null) return null;
@@ -79038,15 +79069,9 @@ function evalActionListenerInstruction(ins, scope, ctx, options) {
79038
79069
  }
79039
79070
  let destination;
79040
79071
  const target = ins.target.pointer;
79041
- const currentValue = target.type === "keyOf" /* keyOf */ ? evalKeyOf(
79042
- target.keyOf,
79043
- scope,
79044
- ctx,
79045
- target.optional === true,
79046
- (resolved) => {
79047
- destination = resolved;
79048
- }
79049
- ) : evalPointer(target, scope, ctx);
79072
+ const currentValue = target.type === "keyOf" /* keyOf */ ? evalKeyOf(target, scope, ctx, (resolved) => {
79073
+ destination = resolved;
79074
+ }) : evalPointer(target, scope, ctx);
79050
79075
  const current = actionListenersOf(currentValue, () => `'${operator}' target`);
79051
79076
  const identity2 = nsActionListenerIdentity(listener);
79052
79077
  const present = current.some(
@@ -79117,38 +79142,26 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
79117
79142
  );
79118
79143
  }
79119
79144
  receiver[index] = referenceValueId;
79120
- setCollectionReferenceProvenance(receiver, index, true, ctx);
79145
+ recordWrittenEntry(receiver, index, true, ctx);
79121
79146
  invalidateEvaluatorIndexes(ctx, receiver);
79122
79147
  return;
79123
79148
  }
79124
- if (ctx.__unorderedListProjections?.referenceEntryIndexesByArray.has(
79125
- receiver
79126
- ) === true) {
79127
- receiver[index] = value;
79128
- setCollectionReferenceProvenance(receiver, index, false, ctx);
79129
- invalidateEvaluatorIndexes(ctx, receiver);
79149
+ if (collectionReferences(receiver, ctx) === 0 /* RowIds */ && replaceEntryRowValue(
79150
+ receiver,
79151
+ receiver[index],
79152
+ value,
79153
+ targetTypeInfo,
79154
+ ctx
79155
+ ))
79130
79156
  return;
79131
- }
79132
- const existing2 = receiver[index];
79133
- if (typeof existing2 === "string") {
79134
- const row = evalValueById(
79135
- ctx,
79136
- existing2,
79137
- ctx.__runtimeSessionValues,
79138
- ctx.__valueOverlay
79139
- );
79140
- if (row !== null) {
79141
- replaceRowValue(row, value, receiver, ctx);
79142
- updateUnorderedListProjectionAfterAssignment(row, value, ctx);
79143
- return;
79144
- }
79145
- }
79146
79157
  receiver[index] = value;
79158
+ recordWrittenEntry(receiver, index, false, ctx);
79147
79159
  invalidateEvaluatorIndexes(ctx, receiver);
79148
79160
  return;
79149
79161
  }
79150
79162
  const object2 = objectArg(receiver, "Assignment target");
79151
79163
  const stringKey = String(key);
79164
+ const field = target.memberId !== void 0;
79152
79165
  if (referenceValueId !== null) {
79153
79166
  const parentId = findKnownRowIdByValueReference(receiver, ctx);
79154
79167
  if (parentId !== null) {
@@ -79163,26 +79176,41 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
79163
79176
  );
79164
79177
  }
79165
79178
  object2[stringKey] = referenceValueId;
79179
+ if (!field) recordWrittenEntry(object2, stringKey, true, ctx);
79166
79180
  invalidateEvaluatorIndexes(ctx, receiver);
79167
79181
  return;
79168
79182
  }
79169
- const existing = object2[stringKey];
79170
- if (typeof existing === "string") {
79171
- const row = evalValueById(
79172
- ctx,
79173
- existing,
79174
- ctx.__runtimeSessionValues,
79175
- ctx.__valueOverlay
79176
- );
79177
- if (row !== null) {
79178
- replaceRowValue(row, value, receiver, ctx);
79179
- updateUnorderedListProjectionAfterAssignment(row, value, ctx);
79180
- return;
79181
- }
79182
- }
79183
+ if (collectionReferences(object2, ctx) === 0 /* RowIds */ && replaceEntryRowValue(object2, object2[stringKey], value, targetTypeInfo, ctx))
79184
+ return;
79183
79185
  object2[stringKey] = value;
79186
+ if (!field) recordWrittenEntry(object2, stringKey, false, ctx);
79184
79187
  invalidateEvaluatorIndexes(ctx, receiver);
79185
79188
  }
79189
+ function replaceEntryRowValue(receiver, existing, value, targetTypeInfo, ctx) {
79190
+ if (typeof existing !== "string") return false;
79191
+ const row = evalValueById(
79192
+ ctx,
79193
+ existing,
79194
+ ctx.__runtimeSessionValues,
79195
+ ctx.__valueOverlay
79196
+ );
79197
+ if (row === null) return false;
79198
+ keepAssignedCollectionValues(value, targetTypeInfo, ctx);
79199
+ replaceRowValue(row, value, receiver, ctx);
79200
+ updateUnorderedListProjectionAfterAssignment(row, value, ctx);
79201
+ return true;
79202
+ }
79203
+ function keepAssignedCollectionValues(value, targetTypeInfo, ctx) {
79204
+ const cache = unorderedListProjectionCache(ctx);
79205
+ if (Array.isArray(value) && (targetTypeInfo.type === 6 /* List */ || targetTypeInfo.type === 28 /* Set */)) {
79206
+ if (!cache.referenceEntryIndexesByArray.has(value))
79207
+ cache.referenceEntryIndexesByArray.set(value, /* @__PURE__ */ new Set());
79208
+ return;
79209
+ }
79210
+ if (targetTypeInfo.type === 5 /* Dictionary */ && typeof value === "object" && value !== null && !cache.referenceEntryKeysByRecord.has(value)) {
79211
+ cache.referenceEntryKeysByRecord.set(value, /* @__PURE__ */ new Set());
79212
+ }
79213
+ }
79186
79214
  function replaceRowValue(row, value, receiver, ctx) {
79187
79215
  const indexes3 = ctx.__indexes;
79188
79216
  if (indexes3 === void 0 || ctx.__runtimeSessionValues?.get(row.id) !== row || !indexes3.indexedRowIds.has(row.id)) {
@@ -79620,9 +79648,11 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
79620
79648
  );
79621
79649
  }
79622
79650
  const unorderedEntriesBeforeMutation = unorderedContainerValueId === null || !Array.isArray(targetValue) || ins.mutation === "Add" /* Add */ ? null : [...targetValue];
79623
- if ((ins.mutation === "Add" /* Add */ || ins.mutation === "Insert" /* Insert */) && !isLookupSet) {
79651
+ const writesEntry = (ins.mutation === "Add" /* Add */ || ins.mutation === "Insert" /* Insert */) && !isLookupSet;
79652
+ let attachedValueId = null;
79653
+ if (writesEntry) {
79624
79654
  const attachedValue = isArrayCollection(targetValue) && ins.mutation !== "Insert" /* Insert */ ? args[0] : args[1];
79625
- const attachedValueId = findKnownRowIdByValueReference(attachedValue, ctx);
79655
+ attachedValueId = findKnownRowIdByValueReference(attachedValue, ctx);
79626
79656
  const parentId = findKnownRowIdByValueReference(targetValue, ctx);
79627
79657
  if (attachedValueId !== null && parentId !== null) {
79628
79658
  ctx.assertCollectionEntryAttachable?.(
@@ -79659,6 +79689,23 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
79659
79689
  removedIndex,
79660
79690
  ctx
79661
79691
  );
79692
+ if (writesEntry && !(targetValue instanceof RuntimeSet)) {
79693
+ const writtenAsRowId = attachedValueId !== null || unorderedContainerValueId !== null;
79694
+ if (Array.isArray(targetValue))
79695
+ recordWrittenEntry(
79696
+ targetValue,
79697
+ removedIndex ?? targetValue.length - 1,
79698
+ writtenAsRowId,
79699
+ ctx
79700
+ );
79701
+ else
79702
+ recordWrittenEntry(
79703
+ objectArg(targetValue, "Dictionary Add target"),
79704
+ String(args[0]),
79705
+ writtenAsRowId,
79706
+ ctx
79707
+ );
79708
+ }
79662
79709
  if (unorderedEntriesBeforeMutation !== null && Array.isArray(targetValue)) {
79663
79710
  detachRemovedUnorderedScalarEntries(
79664
79711
  unorderedEntriesBeforeMutation,
@@ -79860,9 +79907,10 @@ function runtimeSet(array3, reference2, enumEntries, ctx) {
79860
79907
  const existing = sets.get(array3);
79861
79908
  if (existing !== void 0) return existing;
79862
79909
  const set = new RuntimeSet(array3, reference2, enumEntries);
79910
+ const references = collectionReferences(array3, ctx);
79863
79911
  for (let index = 0; index < array3.length; index++) {
79864
79912
  const raw = array3[index];
79865
- const resolves = collectionEntryUsesReferenceResolution(array3, index, ctx);
79913
+ const resolves = isReferenceEntry(references, index);
79866
79914
  const value = resolves ? resolveValueIfId(raw, ctx) : raw;
79867
79915
  const key = runtimeSetKey(value, set, ctx);
79868
79916
  set.add(key, enumEntries ? key : raw, !enumEntries && resolves);
@@ -79871,9 +79919,9 @@ function runtimeSet(array3, reference2, enumEntries, ctx) {
79871
79919
  (ctx.__dirtyRuntimeSets ??= /* @__PURE__ */ new Set()).add(set);
79872
79920
  return set;
79873
79921
  }
79874
- function storedSetEntryMatch(raw, entryMember, ctx) {
79922
+ function storedSetEntryMatch(raw, reference2, entryMember, ctx) {
79875
79923
  const byIdentity = entryMember.kind === 7 /* Class */;
79876
- const row = byIdentity || typeof raw !== "string" ? null : evalValueById(ctx, raw, ctx.__runtimeSessionValues, ctx.__valueOverlay);
79924
+ const row = byIdentity || !reference2 || typeof raw !== "string" ? null : evalValueById(ctx, raw, ctx.__runtimeSessionValues, ctx.__valueOverlay);
79877
79925
  const valueId = byIdentity && typeof raw === "string" ? raw : row?.id ?? null;
79878
79926
  const entry = row === null ? { id: "", value: raw } : { id: row.id, value: row.value };
79879
79927
  const key = byIdentity ? valueId ?? referenceIdOf(raw, ctx) : setEntryKey(entryMember, entry);
@@ -79884,8 +79932,14 @@ function storedSetEntries(set, entryMember, ctx) {
79884
79932
  const existing = indexes3.get(set);
79885
79933
  if (existing !== void 0) return existing;
79886
79934
  const entries = /* @__PURE__ */ new Map();
79887
- for (const raw of set) {
79888
- const match = storedSetEntryMatch(raw, entryMember, ctx);
79935
+ const references = collectionReferences(set, ctx);
79936
+ for (let index = 0; index < set.length; index++) {
79937
+ const match = storedSetEntryMatch(
79938
+ set[index],
79939
+ isReferenceEntry(references, index),
79940
+ entryMember,
79941
+ ctx
79942
+ );
79889
79943
  if (match !== null && !entries.has(match.key)) {
79890
79944
  entries.set(match.key, match);
79891
79945
  }
@@ -79897,7 +79951,13 @@ function syncStoredSetEntries(set, mutation, removed, entryMember, ctx) {
79897
79951
  const entries = ctx.__setEntryIndexes?.get(set);
79898
79952
  if (entries === void 0) return;
79899
79953
  if (entryMember !== null && mutation === "Add" /* Add */) {
79900
- const added = storedSetEntryMatch(set[set.length - 1], entryMember, ctx);
79954
+ const index = set.length - 1;
79955
+ const added = storedSetEntryMatch(
79956
+ set[index],
79957
+ isReferenceEntry(collectionReferences(set, ctx), index),
79958
+ entryMember,
79959
+ ctx
79960
+ );
79901
79961
  if (added !== null) entries.set(added.key, added);
79902
79962
  return;
79903
79963
  }
@@ -79963,6 +80023,7 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
79963
80023
  return null;
79964
80024
  case "Remove" /* Remove */:
79965
80025
  if (Array.isArray(targetValue)) {
80026
+ const references = resolveRemovalEntries ? collectionReferences(targetValue, ctx) : recordedReferenceEntries(targetValue, ctx) ?? 1 /* Values */;
79966
80027
  let index = -1;
79967
80028
  for (let candidate = 0; candidate < targetValue.length; candidate += 1) {
79968
80029
  const entry = targetValue[candidate];
@@ -79973,9 +80034,8 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
79973
80034
  }
79974
80035
  continue;
79975
80036
  }
79976
- const referenceEntry = ctx.__unorderedListProjections?.referenceEntryIndexesByArray.get(targetValue)?.has(candidate) === true;
79977
80037
  if (jsEqual(
79978
- resolveRemovalEntries || referenceEntry ? resolveCollectionEntry(targetValue, entry, candidate, ctx) : entry,
80038
+ typeof entry === "string" && isReferenceEntry(references, candidate) ? resolveValueIfId(entry, ctx) : entry,
79979
80039
  args[0]
79980
80040
  )) {
79981
80041
  index = candidate;
@@ -80008,13 +80068,6 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
80008
80068
  return null;
80009
80069
  }
80010
80070
  }
80011
- function setCollectionReferenceProvenance(targetValue, index, reference2, ctx) {
80012
- const cache = ctx.__unorderedListProjections;
80013
- const indexes3 = cache?.referenceEntryIndexesByArray.get(targetValue);
80014
- if (cache === void 0 || indexes3 === void 0) return;
80015
- if (reference2) indexes3.add(index);
80016
- else indexes3.delete(index);
80017
- }
80018
80071
  function updateCollectionReferenceProvenance(targetValue, mutation, removedIndex, ctx) {
80019
80072
  if (!Array.isArray(targetValue)) return;
80020
80073
  const cache = ctx.__unorderedListProjections;
@@ -80288,7 +80341,7 @@ function evalPointerCore(pointer, scope, ctx, resultUsage = "value") {
80288
80341
  case "staticMember" /* staticMember */:
80289
80342
  return evalStaticMember(pointer.memberId, ctx);
80290
80343
  case "keyOf" /* keyOf */:
80291
- return evalKeyOf(pointer.keyOf, scope, ctx, pointer.optional === true);
80344
+ return evalKeyOf(pointer, scope, ctx);
80292
80345
  case "operation" /* operation */:
80293
80346
  return evalOperation(pointer.operation, scope, ctx);
80294
80347
  case "function" /* function */:
@@ -80938,15 +80991,9 @@ function readActionWithOwner(pointer, scope, ctx) {
80938
80991
  return { action: evalPointer(pointer, scope, ctx), owner: null };
80939
80992
  }
80940
80993
  let owner = null;
80941
- const action = evalKeyOf(
80942
- pointer.keyOf,
80943
- scope,
80944
- ctx,
80945
- pointer.optional === true,
80946
- (destination) => {
80947
- owner = destination.receiver;
80948
- }
80949
- );
80994
+ const action = evalKeyOf(pointer, scope, ctx, (destination) => {
80995
+ owner = destination.receiver;
80996
+ });
80950
80997
  return { action, owner };
80951
80998
  }
80952
80999
  function actionPointerLabel(pointer, ctx) {
@@ -81863,7 +81910,9 @@ function isRuntimeSpriteValue(value) {
81863
81910
  const sliceIndex = value.sliceIndex;
81864
81911
  return typeof sliceIndex === "number" && Number.isInteger(sliceIndex) && sliceIndex >= 0;
81865
81912
  }
81866
- function evalKeyOf(keyOf, scope, ctx, optional2 = false, onDestination) {
81913
+ function evalKeyOf(pointer, scope, ctx, onDestination) {
81914
+ const { keyOf } = pointer;
81915
+ const optional2 = pointer.optional === true;
81867
81916
  const receiver = evalPointer(keyOf.pointer, scope, ctx);
81868
81917
  if (optional2 && (receiver === null || receiver === void 0)) {
81869
81918
  return null;
@@ -81924,7 +81973,7 @@ function evalKeyOf(keyOf, scope, ctx, optional2 = false, onDestination) {
81924
81973
  if (dispatched.kind === "ok") return dispatched.value;
81925
81974
  if (Object.prototype.hasOwnProperty.call(receiver, k)) {
81926
81975
  const at3 = receiver[k];
81927
- return resolveValueIfId(at3, ctx);
81976
+ return typeof at3 === "string" && (pointer.memberId !== void 0 || isReferenceEntry(collectionReferences(receiver, ctx), k)) ? resolveValueIfId(at3, ctx) : at3;
81928
81977
  }
81929
81978
  const expanded = virtualExpandedRecordForReceiver(receiver, ctx);
81930
81979
  if (expanded !== null && Object.prototype.hasOwnProperty.call(expanded, k)) {
@@ -82656,7 +82705,7 @@ function evaluateSystemNative(memberId, receiver, args, ctx, typeArguments) {
82656
82705
  shift,
82657
82706
  accepts
82658
82707
  );
82659
- return { handled: true, value };
82708
+ return { handled: true, value: referenceEntryList(value, ctx) };
82660
82709
  }
82661
82710
  if (memberId === NEO_OBJECT_GRID_MEMBER_IDS.GetTiles) {
82662
82711
  const value = index.tiles(
@@ -82666,7 +82715,7 @@ function evaluateSystemNative(memberId, receiver, args, ctx, typeArguments) {
82666
82715
  shift,
82667
82716
  accepts
82668
82717
  );
82669
- return { handled: true, value };
82718
+ return { handled: true, value: referenceEntryList(value, ctx) };
82670
82719
  }
82671
82720
  const tile = index.tile(
82672
82721
  placement,
@@ -83275,7 +83324,17 @@ function evalDeclaredListIndex(info, scope, ctx) {
83275
83324
  collectionIndexes.set(cacheKey, index);
83276
83325
  }
83277
83326
  if (info.keyPointer === void 0) {
83278
- return Object.fromEntries(index);
83327
+ const view = Object.fromEntries(index);
83328
+ if (info.unique) {
83329
+ unorderedListProjectionCache(ctx).referenceEntryKeysByRecord.set(
83330
+ view,
83331
+ new Set(index.keys())
83332
+ );
83333
+ } else {
83334
+ for (const bucket of index.values())
83335
+ if (Array.isArray(bucket)) referenceEntryList(bucket, ctx);
83336
+ }
83337
+ return view;
83279
83338
  }
83280
83339
  const key = evalPointer(info.keyPointer, scope, ctx);
83281
83340
  if (typeof key !== "string") {
@@ -83287,7 +83346,12 @@ function evalDeclaredListIndex(info, scope, ctx) {
83287
83346
  if (info.unique) {
83288
83347
  return typeof hit === "string" ? resolveValueIfId(hit, ctx) : null;
83289
83348
  }
83290
- return Array.isArray(hit) ? [...hit] : [];
83349
+ return referenceEntryList(Array.isArray(hit) ? [...hit] : [], ctx);
83350
+ }
83351
+ function referenceEntryList(list, ctx) {
83352
+ const indexes3 = unorderedListProjectionCache(ctx).referenceEntryIndexesByArray;
83353
+ if (!indexes3.has(list)) indexes3.set(list, new Set(list.keys()));
83354
+ return list;
83291
83355
  }
83292
83356
  function prepareCollectionCallback(callback, parentScope, ctx, isList, returnContract, onPredicateMatch) {
83293
83357
  const metrics = ctx.__collectionCallbackPreparationMetrics;
@@ -83851,7 +83915,7 @@ function evalFunction(fn, scope, ctx) {
83851
83915
  if (fn.info.reference === true) {
83852
83916
  return referenceIndexOf(c, target, ctx) !== null;
83853
83917
  }
83854
- const targetReferenceId = typeof target === "string" ? target : findKnownRowIdByValueReference(target, ctx);
83918
+ const targetReferenceId = typeof target === "string" ? null : findKnownRowIdByValueReference(target, ctx);
83855
83919
  let containsResolvedEntry = false;
83856
83920
  iterateCollection(c, ctx, (entry, _key, valueId) => {
83857
83921
  if (valueId !== null && valueId === targetReferenceId || jsEqual(entry, target)) {
@@ -83872,7 +83936,7 @@ function evalFunction(fn, scope, ctx) {
83872
83936
  const index = referenceIndexOf(collection, target, ctx);
83873
83937
  return index === null ? -1 : numberArg(index, "IndexOf index");
83874
83938
  }
83875
- const targetReferenceId = typeof target === "string" ? target : findKnownRowIdByValueReference(target, ctx);
83939
+ const targetReferenceId = typeof target === "string" ? null : findKnownRowIdByValueReference(target, ctx);
83876
83940
  let found = -1;
83877
83941
  iterateCollection(collection, ctx, (entry, key, valueId) => {
83878
83942
  if (valueId !== null && valueId === targetReferenceId || jsEqual(entry, target)) {
@@ -85014,6 +85078,8 @@ function evaluateDeclaredConstructorArguments(info, record7, scope, ctx) {
85014
85078
  );
85015
85079
  }
85016
85080
  const value = byName.get(parameter4.name);
85081
+ if (parameter4.type === 9 /* Lookup */ && Array.isArray(value))
85082
+ return referenceEntryList(value, ctx);
85017
85083
  if (typeof value !== "number") return value;
85018
85084
  if (parameter4.type === 4 /* Float */) return Math.fround(value);
85019
85085
  if (parameter4.type !== 20 /* Decimal */) return value;
@@ -87967,14 +88033,10 @@ function collectionLength(c) {
87967
88033
  }
87968
88034
  function snapshotCollectionMembership(collection, ctx) {
87969
88035
  const membership = [];
87970
- const valid = forEachRawCollectionEntry(collection, (entry) => {
88036
+ const valid = forEachRawCollectionEntry(collection, ctx, (entry) => {
87971
88037
  membership.push({
87972
88038
  raw: entry.raw,
87973
- resolveAsReference: collectionEntryUsesReferenceResolution(
87974
- collection,
87975
- entry.key,
87976
- ctx
87977
- )
88039
+ resolveAsReference: entry.valueId !== null
87978
88040
  });
87979
88041
  return 0 /* Continue */;
87980
88042
  });
@@ -87983,7 +88045,7 @@ function snapshotCollectionMembership(collection, ctx) {
87983
88045
  "NeoScript foreach requires a present collection."
87984
88046
  );
87985
88047
  }
87986
- function forEachRawCollectionEntry(c, callback) {
88048
+ function forEachRawCollectionEntry(c, ctx, callback) {
87987
88049
  if (c instanceof RuntimeSet) {
87988
88050
  for (const [key, entry] of c.membership().entries()) {
87989
88051
  if (callback({
@@ -87995,35 +88057,34 @@ function forEachRawCollectionEntry(c, callback) {
87995
88057
  }
87996
88058
  return true;
87997
88059
  }
88060
+ if (typeof c !== "object" || c === null) return false;
88061
+ const references = collectionReferences(c, ctx);
87998
88062
  if (Array.isArray(c)) {
87999
88063
  for (let key = 0; key < c.length; key += 1) {
88000
88064
  const raw = c[key];
88001
88065
  const control = callback({
88002
88066
  raw,
88003
88067
  key,
88004
- valueId: typeof raw === "string" ? raw : null
88068
+ valueId: typeof raw === "string" && isReferenceEntry(references, key) ? raw : null
88005
88069
  });
88006
88070
  if (control === 1 /* Break */) break;
88007
88071
  }
88008
88072
  return true;
88009
88073
  }
88010
- if (typeof c === "object" && c !== null) {
88011
- for (const [key, raw] of Object.entries(c)) {
88012
- const control = callback({
88013
- raw,
88014
- key,
88015
- valueId: typeof raw === "string" ? raw : null
88016
- });
88017
- if (control === 1 /* Break */) break;
88018
- }
88019
- return true;
88074
+ for (const [key, raw] of Object.entries(c)) {
88075
+ const control = callback({
88076
+ raw,
88077
+ key,
88078
+ valueId: typeof raw === "string" && isReferenceEntry(references, key) ? raw : null
88079
+ });
88080
+ if (control === 1 /* Break */) break;
88020
88081
  }
88021
- return false;
88082
+ return true;
88022
88083
  }
88023
88084
  function collectionEntries(c, ctx) {
88024
88085
  const entries = [];
88025
- forEachRawCollectionEntry(c, ({ raw, key }) => {
88026
- entries.push(resolveCollectionEntry(c, raw, key, ctx));
88086
+ forEachRawCollectionEntry(c, ctx, ({ raw, valueId }) => {
88087
+ entries.push(valueId === null ? raw : resolveValueIfId(valueId, ctx));
88027
88088
  return 0 /* Continue */;
88028
88089
  });
88029
88090
  return entries;
@@ -88031,7 +88092,7 @@ function collectionEntries(c, ctx) {
88031
88092
  function referenceIndexOf(c, target, ctx) {
88032
88093
  const targetId = target === null || target === void 0 ? null : referenceIdOf(target, ctx);
88033
88094
  let found = null;
88034
- forEachRawCollectionEntry(c, ({ raw, key }) => {
88095
+ forEachRawCollectionEntry(c, ctx, ({ raw, key }) => {
88035
88096
  if (raw === target || targetId !== null && raw !== null && raw !== void 0 && referenceIdOf(raw, ctx) === targetId) {
88036
88097
  found = key;
88037
88098
  return 1 /* Break */;
@@ -88041,26 +88102,61 @@ function referenceIndexOf(c, target, ctx) {
88041
88102
  return found;
88042
88103
  }
88043
88104
  function iterateCollection(c, ctx, callback) {
88044
- forEachRawCollectionEntry(c, ({ raw, key, valueId }) => {
88045
- const effectiveValueId = collectionEntryUsesReferenceResolution(c, key, ctx) ? valueId : null;
88046
- return callback(
88047
- resolveCollectionEntry(c, raw, key, ctx),
88105
+ forEachRawCollectionEntry(
88106
+ c,
88107
+ ctx,
88108
+ ({ raw, key, valueId }) => callback(
88109
+ valueId === null ? raw : resolveValueIfId(valueId, ctx),
88048
88110
  key,
88049
- effectiveValueId
88050
- );
88051
- });
88111
+ valueId
88112
+ )
88113
+ );
88052
88114
  }
88053
88115
  function resolveCollectionEntry(collection, raw, key, ctx) {
88054
- return collectionEntryUsesReferenceResolution(collection, key, ctx) ? resolveValueIfId(raw, ctx) : raw;
88116
+ return typeof raw === "string" && isReferenceEntry(collectionReferences(collection, ctx), key) ? resolveValueIfId(raw, ctx) : raw;
88055
88117
  }
88056
- function collectionEntryUsesReferenceResolution(collection, key, ctx) {
88057
- if (collection instanceof RuntimeSet && typeof key === "number")
88058
- return collection.membership()[key]?.reference === true;
88059
- if (!Array.isArray(collection) || typeof key !== "number") return true;
88060
- const referenceIndexes = ctx.__unorderedListProjections?.referenceEntryIndexesByArray.get(
88061
- collection
88062
- );
88063
- return referenceIndexes === void 0 || referenceIndexes.has(key);
88118
+ function recordedReferenceEntries(collection, ctx) {
88119
+ const cache = ctx.__unorderedListProjections;
88120
+ if (Array.isArray(collection))
88121
+ return cache?.referenceEntryIndexesByArray.get(collection);
88122
+ if (typeof collection === "object" && collection !== null)
88123
+ return cache?.referenceEntryKeysByRecord.get(collection);
88124
+ return void 0;
88125
+ }
88126
+ function collectionReferences(collection, ctx) {
88127
+ return recordedReferenceEntries(collection, ctx) ?? (findKnownRowIdByValueReference(collection, ctx) === null ? 1 /* Values */ : 0 /* RowIds */);
88128
+ }
88129
+ function isReferenceEntry(references, key) {
88130
+ if (references === 0 /* RowIds */) return true;
88131
+ if (references === 1 /* Values */) return false;
88132
+ return references.has(key);
88133
+ }
88134
+ function recordWrittenEntry(collection, key, reference2, ctx) {
88135
+ const references = collectionReferences(collection, ctx);
88136
+ if (typeof references !== "object") {
88137
+ if (reference2 === (references === 0 /* RowIds */)) return;
88138
+ const written = Array.isArray(collection) ? collection[Number(key)] : collection[String(key)];
88139
+ if (!reference2 && typeof written !== "string") return;
88140
+ }
88141
+ const rowIds = references === 0 /* RowIds */;
88142
+ const cache = unorderedListProjectionCache(ctx);
88143
+ if (Array.isArray(collection)) {
88144
+ let indexes3 = cache.referenceEntryIndexesByArray.get(collection);
88145
+ if (indexes3 === void 0) {
88146
+ indexes3 = new Set(rowIds ? collection.keys() : []);
88147
+ cache.referenceEntryIndexesByArray.set(collection, indexes3);
88148
+ }
88149
+ if (reference2) indexes3.add(Number(key));
88150
+ else indexes3.delete(Number(key));
88151
+ return;
88152
+ }
88153
+ let keys = cache.referenceEntryKeysByRecord.get(collection);
88154
+ if (keys === void 0) {
88155
+ keys = new Set(rowIds ? Object.keys(collection) : []);
88156
+ cache.referenceEntryKeysByRecord.set(collection, keys);
88157
+ }
88158
+ if (reference2) keys.add(String(key));
88159
+ else keys.delete(String(key));
88064
88160
  }
88065
88161
  var DELEGATE_LEXICAL_THIS, DELEGATE_LEXICAL_ROOT, DELEGATE_LEXICAL_TYPE_ARGUMENTS, NonCatchableNSGetterRuntimeError, NativeFunctionDelegateUnavailableError, CorruptNeoScriptIRError, NeoScriptWallClockTimeoutError, liveListIndexesByProject, evaluatorOwnershipCachesByBase, MAX_CONSTRUCTION_DEPTH, resolutionCacheByMembers, NO_SCHEMA_REVISION, LazyValueOverlay, READONLY_FOREACH_BINDING_ERROR, READONLY_CATCH_BINDING_ERROR, DIALOGUE_CONTEXT_PARAMETER_ID, FORWARDING_TYPE_ARGUMENTS, constantDeclarationRoots, NS_MATH_OP_NAMES, DOUBLE_INTEGRAL_MAGNITUDE, EMPTY_SUPPLIED_CONSTRUCTOR_FIELDS, variantResolutionCopiesByOverlay;
88066
88162
  var init_evaluateNSGetter = __esm({
@@ -94307,6 +94403,28 @@ function createTypedValueNormalizer(reader, document, childrenByContainerId, par
94307
94403
  }
94308
94404
  return normalizeLiteral(value);
94309
94405
  };
94406
+ const bindingTypes = /* @__PURE__ */ new Map();
94407
+ const bindingType = (memberId) => {
94408
+ const member = memberById2(memberId);
94409
+ if (member === void 0) return memberId;
94410
+ try {
94411
+ return genericBindingTypeInfo(member, /* @__PURE__ */ new Map(), document.members);
94412
+ } catch {
94413
+ return memberId;
94414
+ }
94415
+ };
94416
+ const normalizeGenericBindings = (bindings) => {
94417
+ const result = /* @__PURE__ */ Object.create(null);
94418
+ for (const [paramId, memberId] of Object.entries(bindings)) {
94419
+ let type = bindingTypes.get(memberId);
94420
+ if (type === void 0) {
94421
+ type = bindingType(memberId);
94422
+ bindingTypes.set(memberId, type);
94423
+ }
94424
+ result[paramId] = type;
94425
+ }
94426
+ return result;
94427
+ };
94310
94428
  const normalizeTypedRow = (valueId, typeInfo, placement, parentEnv = /* @__PURE__ */ new Map()) => {
94311
94429
  const row = reader.row(valueId, typeInfo, placement);
94312
94430
  if (row === void 0) return valueId;
@@ -94388,7 +94506,7 @@ function createTypedValueNormalizer(reader, document, childrenByContainerId, par
94388
94506
  const normalized = {
94389
94507
  ...rowIdentities?.has(valueId) ? { id: valueId } : {},
94390
94508
  ...typeof row.classId === "string" ? { classId: row.classId } : {},
94391
- ...row.genericBindings === void 0 ? {} : { genericBindings: row.genericBindings },
94509
+ ...row.genericBindings === void 0 ? {} : { genericBindings: normalizeGenericBindings(row.genericBindings) },
94392
94510
  value,
94393
94511
  ...carriesSemanticConstructorArguments(row) ? {
94394
94512
  constructorArgs: normalizeConstructorArgs(
@@ -94425,7 +94543,7 @@ function createTypedValueNormalizer(reader, document, childrenByContainerId, par
94425
94543
  const normalized = {
94426
94544
  ...rowIdentities?.has(valueId) ? { id: valueId } : {},
94427
94545
  ...typeof row.classId === "string" ? { classId: row.classId } : {},
94428
- ...row.genericBindings === void 0 ? {} : { genericBindings: row.genericBindings },
94546
+ ...row.genericBindings === void 0 ? {} : { genericBindings: normalizeGenericBindings(row.genericBindings) },
94429
94547
  // The containing Class schema proves this is an owned row edge, but an
94430
94548
  // unresolved generic member does not prove anything about strings in
94431
94549
  // the row's payload. Keep those strings literal instead of guessing
@@ -94777,10 +94895,15 @@ var init_effective_value_reader = __esm({
94777
94895
  return row;
94778
94896
  if (this.resolvedRoots.has(valueId)) return row;
94779
94897
  if (this.mode(valueId) === "partial") return row;
94898
+ if (this.context.overrideRows === "constructed" && this.overrides.has(valueId) && !this.graph.valuesById.has(valueId))
94899
+ return row;
94780
94900
  const schema = this.schema(classId);
94781
- if (schema.every(
94782
- (entry) => Object.prototype.hasOwnProperty.call(row.value, entry.schemaKey)
94783
- ))
94901
+ const record7 = row.value;
94902
+ if (schema.every((entry) => {
94903
+ if (Object.hasOwn(record7, entry.schemaKey)) return true;
94904
+ const member2 = this.memberForId(entry.memberId);
94905
+ return member2 !== null && !memberKindOwnsStoredValue(member2.kind);
94906
+ }))
94784
94907
  return row;
94785
94908
  this.resolvedRoots.add(valueId);
94786
94909
  const member = this.placementFor(valueId) ?? this.graph.ownerForValue(valueId) ?? {
@@ -94977,6 +95100,8 @@ var init_effective_value_reader = __esm({
94977
95100
  {
94978
95101
  ...this.context,
94979
95102
  containerMembership: options.containerMembership ?? this.context.containerMembership,
95103
+ // Describes this reader's overrides, not a fork's.
95104
+ overrideRows: void 0,
94980
95105
  ...options.readTracking === void 0 ? {} : { readTracking: options.readTracking }
94981
95106
  },
94982
95107
  this,
@@ -138894,7 +139019,7 @@ function classValueBody(context, member, value, visited, targetTyped, outerEnvir
138894
139019
  context,
138895
139020
  value.id,
138896
139021
  replayConstruction,
138897
- concreteClassMemberForReplay(member, environment)
139022
+ concreteClassMemberForReplay(context, member, environment)
138898
139023
  );
138899
139024
  const replayRoot = replayRows === null || typeof value.id !== "string" ? void 0 : replayRows.get(value.id);
138900
139025
  const graph = replayRows === null || typeof value.id !== "string" ? null : context.readEffectiveValues().withRowOverrides(
@@ -138941,7 +139066,11 @@ function classValueBody(context, member, value, visited, targetTyped, outerEnvir
138941
139066
  if (!context.values.has(childId)) {
138942
139067
  const reader = context.readEffectiveValues();
138943
139068
  if (reader.row(childId) === void 0) {
138944
- const placement = concreteClassMemberForReplay(member, environment);
139069
+ const placement = concreteClassMemberForReplay(
139070
+ context,
139071
+ member,
139072
+ environment
139073
+ );
138945
139074
  if (!isAnyMemberBase(placement))
138946
139075
  throw new Error(
138947
139076
  `Stored class ${name} has no typed member placement.`
@@ -139217,22 +139346,23 @@ function storedConstructionReplayRows(context, valueId, code, member) {
139217
139346
  context.constructionReplays.set(valueId, replay);
139218
139347
  return replay;
139219
139348
  }
139220
- function concreteClassMemberForReplay(member, environment) {
139349
+ function concreteClassMemberForReplay(context, member, environment) {
139221
139350
  if (numberField(member, "kind") !== 7 /* Class */) return member;
139222
139351
  const classArguments2 = isObjectRecord2(member.classArguments) ? member.classArguments : {};
139352
+ const parameters = context.manifestClasses.get(stringField2(member, "classId"))?.genericParameters ?? [];
139223
139353
  let changed = false;
139224
- const concreteArguments = Object.fromEntries(
139225
- Object.entries(classArguments2).map(([genericParamId, binding]) => {
139226
- const forwardedParamId = isObjectRecord2(binding) && (binding.kind === void 0 || binding.kind === 0 /* Generic */) && typeof binding.genericParamId === "string" ? binding.genericParamId : null;
139227
- const bindingMemberId = environment.get(genericParamId) ?? (forwardedParamId === null ? void 0 : environment.get(forwardedParamId));
139228
- if (bindingMemberId === void 0) return [genericParamId, binding];
139229
- changed = true;
139230
- return [
139231
- genericParamId,
139232
- { kind: 1 /* Member */, memberId: bindingMemberId }
139233
- ];
139234
- })
139235
- );
139354
+ const concreteArguments = { ...classArguments2 };
139355
+ for (const { id: genericParamId } of parameters) {
139356
+ const binding = classArguments2[genericParamId];
139357
+ const forwardedParamId = isObjectRecord2(binding) && (binding.kind === void 0 || binding.kind === 0 /* Generic */) && typeof binding.genericParamId === "string" ? binding.genericParamId : null;
139358
+ const bindingMemberId = environment.get(genericParamId) ?? (forwardedParamId === null ? void 0 : environment.get(forwardedParamId));
139359
+ if (bindingMemberId === void 0) continue;
139360
+ changed = true;
139361
+ concreteArguments[genericParamId] = {
139362
+ kind: 1 /* Member */,
139363
+ memberId: bindingMemberId
139364
+ };
139365
+ }
139236
139366
  return changed ? { ...member, classArguments: concreteArguments } : member;
139237
139367
  }
139238
139368
  function storedLookupIdentityIds(values, reader) {
@@ -139959,6 +140089,19 @@ function storedTypedRowSource(context, type, valueId, environment, visited, writ
139959
140089
  `Stored ${type.kind} constructor argument references missing value row ${valueId}.`
139960
140090
  );
139961
140091
  }
140092
+ if (type.kind === "generic" && typeof row.classId !== "string") {
140093
+ return storedTypedRowSource(
140094
+ context,
140095
+ storedGenericArgumentType(context, type, environment),
140096
+ valueId,
140097
+ environment,
140098
+ visited,
140099
+ writeIdentity,
140100
+ partial,
140101
+ constructorOwnsGraph,
140102
+ cloneAggregateArguments
140103
+ );
140104
+ }
139962
140105
  if (cloneAggregateArguments) {
139963
140106
  const settled = type.kind === "generic" ? storedGenericArgumentType(context, type, environment) : type;
139964
140107
  if (settled.kind === "class" || settled.kind === "interface") {
@@ -139983,8 +140126,8 @@ function storedTypedRowSource(context, type, valueId, environment, visited, writ
139983
140126
  visited.add(valueId);
139984
140127
  try {
139985
140128
  if (type.kind === "class" || type.kind === "interface" || type.kind === "generic") {
139986
- const classId = type.kind === "class" ? type.classId : typeof row.classId === "string" ? row.classId : null;
139987
- if (classId === null) {
140129
+ const classId = type.kind === "class" ? type.classId : row.classId;
140130
+ if (typeof classId !== "string") {
139988
140131
  throw new Error(
139989
140132
  `Stored ${type.kind} constructor argument ${valueId} has no concrete class.`
139990
140133
  );
@@ -201632,7 +201775,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
201632
201775
  async function main() {
201633
201776
  const args = parseArgs(process.argv.slice(2));
201634
201777
  if (args.command === "--version") {
201635
- console.log("0.81.1");
201778
+ console.log("0.81.2");
201636
201779
  return;
201637
201780
  }
201638
201781
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {