@neocompose/cli 0.38.3 → 0.38.4

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
@@ -9133,19 +9133,6 @@ function bindConstructorArgumentNames(className, declared, argumentNames, pos) {
9133
9133
  return parameter4.name;
9134
9134
  });
9135
9135
  }
9136
- function callMatchesDeclaredOverloadNames(declared, expression) {
9137
- if (declared.length === 0) return false;
9138
- if (callHasPositionalArguments(expression)) return false;
9139
- const names = expression.args.map(
9140
- (_, index) => expression.argumentNames?.[index] ?? ""
9141
- );
9142
- const callKey = neoScriptArgumentNameSetKey(names);
9143
- return declared.some(
9144
- (candidate) => neoScriptArgumentNameSetKey(
9145
- candidate.parameters.map((parameter4) => parameter4.name)
9146
- ) === callKey
9147
- );
9148
- }
9149
9136
  function scopeVariable(name, value, sourceType, writability, ownership, writeRoot, readonlyBinding) {
9150
9137
  return {
9151
9138
  name,
@@ -11827,11 +11814,8 @@ var init_strict_resolver = __esm({
11827
11814
  const declaredTarget = this.project.typeByName.get(className);
11828
11815
  const declared = declaredTarget?.declaredConstructors ?? [];
11829
11816
  const requiredConstructor = neoScriptRequiredConstructor(declaredTarget);
11830
- if (requiredConstructor === null && !callMatchesDeclaredOverloadNames(declared, expression)) {
11831
- this.rejectConstructorProjectionInConstructionBody(expression);
11832
- }
11833
- const projectionCall = requiredConstructor === null && declaredTarget?.constructorSignature !== void 0 && (expression.argumentNames === void 0 && callHasPositionalArguments(expression) || expression.argumentNames !== void 0 && declaredTarget.constructorSignature.namedProjections !== void 0);
11834
- if (declared.length > 0 && !projectionCall) {
11817
+ const generatedPositionalCall = requiredConstructor === null && declaredTarget?.constructorSignature !== void 0 && expression.argumentNames === void 0 && callHasPositionalArguments(expression);
11818
+ if (declared.length > 0 && !generatedPositionalCall) {
11835
11819
  return this.resolveDeclaredConstructor(
11836
11820
  className,
11837
11821
  expression,
@@ -11840,13 +11824,13 @@ var init_strict_resolver = __esm({
11840
11824
  expected
11841
11825
  );
11842
11826
  }
11843
- if (expression.argumentNames && !projectionCall) {
11827
+ if (expression.argumentNames && !generatedPositionalCall) {
11844
11828
  throw new CompileError(
11845
11829
  "Named constructor arguments require a declaration-aware project source context.",
11846
11830
  expression.pos
11847
11831
  );
11848
11832
  }
11849
- if (expression.initializer && expression.initializer.length > 0 && !projectionCall && this.context.storedConstructionReplay !== true) {
11833
+ if (expression.initializer && expression.initializer.length > 0 && !generatedPositionalCall && this.context.storedConstructionReplay !== true) {
11850
11834
  throw new CompileError(
11851
11835
  "Object initializers are available to project source construction and are not executable NeoScript constructors.",
11852
11836
  expression.pos
@@ -14089,26 +14073,11 @@ var init_strict_resolver = __esm({
14089
14073
  )
14090
14074
  }));
14091
14075
  const argumentsList2 = expression.args;
14092
- const namedProjections = signature.namedProjections;
14093
14076
  if (expression.argumentNames !== void 0) {
14094
- if (namedProjections === void 0) {
14095
- throw new CompileError(
14096
- `Class '${className}' exposes no named constructor projection.`,
14097
- pos
14098
- );
14099
- }
14100
- if (argumentsList2.length !== namedProjections.length) {
14101
- throw new CompileError(
14102
- `${className} constructor requires ${namedProjections.length} named argument${namedProjections.length === 1 ? "" : "s"} but got ${argumentsList2.length}.`,
14103
- pos
14104
- );
14105
- }
14106
- if (expression.argumentNames.length !== argumentsList2.length) {
14107
- throw new CompileError(
14108
- `${className} constructor projection requires every argument to be named.`,
14109
- pos
14110
- );
14111
- }
14077
+ throw new CompileError(
14078
+ "Named constructor arguments require a declaration-aware project source context.",
14079
+ pos
14080
+ );
14112
14081
  }
14113
14082
  const requiredCount = signature.parameters.filter(
14114
14083
  (parameter4) => parameter4.required
@@ -14126,30 +14095,10 @@ var init_strict_resolver = __esm({
14126
14095
  );
14127
14096
  }
14128
14097
  const fields = argumentsList2.map((argument2, index) => {
14129
- const projectionName = expression.argumentNames?.[index];
14130
- const projection = projectionName === void 0 ? void 0 : namedProjections?.find(
14131
- (candidate) => candidate.name === projectionName
14132
- );
14133
- if (projectionName !== void 0 && projection === void 0) {
14134
- throw new CompileError(
14135
- `Class '${className}' has no constructor projection named '${projectionName}'.`,
14136
- argument2.pos
14137
- );
14138
- }
14139
- if (projection !== void 0 && expression.argumentNames?.findIndex(
14140
- (candidate) => candidate === projection.name
14141
- ) !== index) {
14142
- throw new CompileError(
14143
- `Constructor argument '${projection.name}' is supplied more than once.`,
14144
- argument2.pos
14145
- );
14146
- }
14147
- const parameter4 = projection === void 0 ? parameters[index] : parameters.find(
14148
- (candidate) => candidate.memberId === projection.memberId
14149
- );
14098
+ const parameter4 = parameters[index];
14150
14099
  if (!parameter4) {
14151
14100
  throw new Error(
14152
- projection === void 0 ? `NeoScript constructor ${className} lost parameter ${index + 1} after argument-count validation.` : `NeoScript constructor ${className} projection '${projection.name}' names missing member '${projection.memberId}'.`
14101
+ `NeoScript constructor ${className} lost parameter ${index + 1} after argument-count validation.`
14153
14102
  );
14154
14103
  }
14155
14104
  const value = this.resolveExpression(
@@ -14169,16 +14118,6 @@ var init_strict_resolver = __esm({
14169
14118
  valuePointer: value.pointer
14170
14119
  };
14171
14120
  });
14172
- if (namedProjections !== void 0 && expression.argumentNames !== void 0) {
14173
- for (const projection of namedProjections) {
14174
- if (!expression.argumentNames.includes(projection.name)) {
14175
- throw new CompileError(
14176
- `${className} constructor is missing named argument '${projection.name}'.`,
14177
- pos
14178
- );
14179
- }
14180
- }
14181
- }
14182
14121
  fields.push(
14183
14122
  ...this.resolveCallSiteInitializerFields(schemaClass2, expression, scope)
14184
14123
  );
@@ -14225,22 +14164,6 @@ var init_strict_resolver = __esm({
14225
14164
  typeId: schemaClass2.id
14226
14165
  };
14227
14166
  }
14228
- /**
14229
- * P43 §7.1. P29's `new T(id: "…")` projection names a class-default row,
14230
- * which is exactly the wrong identity inside a construction body: member
14231
- * initializers have already run, so the body holds its own rows.
14232
- */
14233
- rejectConstructorProjectionInConstructionBody(expression) {
14234
- if (!isNeoScriptConstructionDocumentKind(this.context.kind)) return;
14235
- const idIndex = (expression.argumentNames ?? []).findIndex(
14236
- (name) => name === "id"
14237
- );
14238
- if (idIndex < 0) return;
14239
- throw new CompileError(
14240
- `A constructor projection \`new(id: \u2026)\` names a class-default row, so it cannot be used in a ${this.context.kind} body. Bind the resolved value instead, for example \`Child = iris\`.`,
14241
- expression.pos
14242
- );
14243
- }
14244
14167
  /**
14245
14168
  * P43 §6.1. Construction through the class's author-declared constructors.
14246
14169
  * Arguments are named (§6.1.1 resolves overloads by name set first), and
@@ -19518,7 +19441,7 @@ var init_project_schema_contract_generated = __esm({
19518
19441
  "../packages/neoscript-language/src/project-schema-contract.generated.ts"() {
19519
19442
  "use strict";
19520
19443
  PROJECT_SCHEMA_MANIFEST_FORMAT_VERSION = 3;
19521
- PROJECT_SCHEMA_MANIFEST_CONTRACT_VERSION = "3.14";
19444
+ PROJECT_SCHEMA_MANIFEST_CONTRACT_VERSION = "3.15";
19522
19445
  PROJECT_FILE_UPLOAD_BATCH_SIZE = 32;
19523
19446
  NEO_PROJECT_SOURCE_RECORD_CONTRACT = {
19524
19447
  "recordFields": {
@@ -19588,7 +19511,6 @@ var init_project_schema_contract_generated = __esm({
19588
19511
  "allowedStorageKeys",
19589
19512
  "genericParams",
19590
19513
  "extendsGenericBindings",
19591
- "constructorProjections",
19592
19514
  "constructorIds",
19593
19515
  "requiredConstructorId",
19594
19516
  "targetMemberId"
@@ -22779,7 +22701,7 @@ function resolveInvokedConstructor(declaration, call, diagnostics) {
22779
22701
  return true;
22780
22702
  }
22781
22703
  if (declaration.constructors.length === 0) {
22782
- return call.argumentNames.length > 0;
22704
+ return false;
22783
22705
  }
22784
22706
  if (call.argumentNames.length === 0) {
22785
22707
  return declaration.constructors.some(
@@ -35831,7 +35753,6 @@ var init_document_contracts = __esm({
35831
35753
  "allowedStorageKeys",
35832
35754
  "genericParams",
35833
35755
  "extendsGenericBindings",
35834
- "constructorProjections",
35835
35756
  "constructorIds",
35836
35757
  "requiredConstructorId",
35837
35758
  "targetMemberId"
@@ -35849,7 +35770,6 @@ var init_document_contracts = __esm({
35849
35770
  allowedStorageKeys: "nullIsAbsent",
35850
35771
  genericParams: "nullOrEmptyArrayIsAbsent",
35851
35772
  extendsGenericBindings: "nullOrEmptyObjectIsAbsent",
35852
- constructorProjections: "nullOrEmptyArrayIsAbsent",
35853
35773
  constructorIds: "nullOrEmptyArrayIsAbsent",
35854
35774
  requiredConstructorId: "nullIsAbsent"
35855
35775
  }
@@ -38739,27 +38659,6 @@ function schemaClassFromDocument(record3, context) {
38739
38659
  selectionSpan: source.selectionSpan
38740
38660
  };
38741
38661
  });
38742
- const constructorProjections = optionalArray(data.constructorProjections).map(
38743
- (entry, index) => {
38744
- const projection = requireRecordValue(
38745
- entry,
38746
- record3,
38747
- `constructorProjections[${index}]`
38748
- );
38749
- return {
38750
- parameterName: requiredStringValue(
38751
- projection.parameterName,
38752
- record3,
38753
- `constructorProjections[${index}].parameterName`
38754
- ),
38755
- memberId: requiredStringValue(
38756
- projection.memberId,
38757
- record3,
38758
- `constructorProjections[${index}].memberId`
38759
- )
38760
- };
38761
- }
38762
- );
38763
38662
  const constructorIds = optionalStringArray(data.constructorIds);
38764
38663
  const requiredConstructorId2 = optionalStringOrNull(
38765
38664
  data.requiredConstructorId
@@ -38790,7 +38689,6 @@ function schemaClassFromDocument(record3, context) {
38790
38689
  "extendsGenericBindings"
38791
38690
  ),
38792
38691
  targetMemberId: optionalStringOrNull(data.targetMemberId),
38793
- ...constructorProjections.length === 0 ? {} : { constructorProjections },
38794
38692
  ...constructorIds.length === 0 ? {} : { constructorIds },
38795
38693
  ...requiredConstructorId2 === null ? {} : { requiredConstructorId: requiredConstructorId2 }
38796
38694
  };
@@ -38821,7 +38719,6 @@ function schemaClassToDocument(schemaClass2) {
38821
38719
  ...parameter4.constraint === null ? {} : { constraint: parameter4.constraint }
38822
38720
  })),
38823
38721
  extendsGenericBindings: schemaClass2.extendsGenericBindings,
38824
- constructorProjections: schemaClass2.constructorProjections,
38825
38722
  constructorIds: schemaClass2.constructorIds,
38826
38723
  requiredConstructorId: schemaClass2.requiredConstructorId,
38827
38724
  targetMemberId: schemaClass2.targetMemberId
@@ -40256,7 +40153,6 @@ function assertNeoSchemaClass(value, path) {
40256
40153
  [
40257
40154
  "docsText",
40258
40155
  "isSealed",
40259
- "constructorProjections",
40260
40156
  "constructorIds",
40261
40157
  "requiredConstructorId",
40262
40158
  "allowedStorageKeys"
@@ -40296,18 +40192,6 @@ function assertNeoSchemaClass(value, path) {
40296
40192
  if (type.requiredConstructorId !== void 0) {
40297
40193
  nonEmptyString(type.requiredConstructorId, `${path}.requiredConstructorId`);
40298
40194
  }
40299
- if (type.constructorProjections !== void 0) {
40300
- arrayOf(
40301
- type.constructorProjections,
40302
- `${path}.constructorProjections`,
40303
- assertClassConstructorProjection
40304
- );
40305
- }
40306
- }
40307
- function assertClassConstructorProjection(value, path) {
40308
- const projection = objectAt(value, path, ["parameterName", "memberId"]);
40309
- nonEmptyString(projection.parameterName, `${path}.parameterName`);
40310
- nonEmptyString(projection.memberId, `${path}.memberId`);
40311
40195
  }
40312
40196
  function assertGenericParameter(value, path) {
40313
40197
  const parameter4 = objectAt(value, path, [
@@ -44275,23 +44159,20 @@ function isGenericBindingsRecord(value) {
44275
44159
  if (Array.isArray(value)) return false;
44276
44160
  return Object.values(value).every(isGenericBinding);
44277
44161
  }
44162
+ function hasRetiredConstructorProjectionsTombstone(value) {
44163
+ return value !== null && typeof value === "object" && Object.hasOwn(value, RETIRED_CONSTRUCTOR_PROJECTIONS_FIELD);
44164
+ }
44278
44165
  function isNeoSchemaClassBase(value) {
44166
+ if (hasRetiredConstructorProjectionsTombstone(value)) {
44167
+ return false;
44168
+ }
44279
44169
  const v = value;
44280
44170
  return typeof v?.name === "string" && isValidDocsText(v.docsText) && isClassSchema(v?.schema) && isOptionalSchemaKeyOrder(v?.schemaKeyOrder) && (v.implementsInterfaceIds === void 0 || v.implementsInterfaceIds === null || Array.isArray(v.implementsInterfaceIds) && v.implementsInterfaceIds.every(
44281
44171
  (interfaceId) => typeof interfaceId === "string" && interfaceId.length > 0
44282
- )) && typeof v?.hiddenInMemberSelector === "boolean" && typeof v?.isAbstract === "boolean" && (v.isSealed === void 0 || typeof v.isSealed === "boolean") && (v.allowedStorage === void 0 || v.allowedStorage === null || isEffectiveMemberStorage(v.allowedStorage)) && (v.allowedStorageKeys === void 0 || v.allowedStorageKeys === null || Array.isArray(v.allowedStorageKeys) && v.allowedStorageKeys.every((key) => typeof key === "string")) && (v.genericParams === void 0 || v.genericParams === null || Array.isArray(v.genericParams) && v.genericParams.every(isGenericParamDeclaration)) && (v.extendsGenericBindings === void 0 || v.extendsGenericBindings === null || isGenericBindingsRecord(v.extendsGenericBindings)) && (v.constructorProjections === void 0 || v.constructorProjections === null || Array.isArray(v.constructorProjections) && v.constructorProjections.every(isNeoClassConstructorProjection) && v.system?.kind === SystemProtectionKind.WorldAuthoring) && (v.constructorIds === void 0 || v.constructorIds === null || Array.isArray(v.constructorIds) && v.constructorIds.every(
44172
+ )) && typeof v?.hiddenInMemberSelector === "boolean" && typeof v?.isAbstract === "boolean" && (v.isSealed === void 0 || typeof v.isSealed === "boolean") && (v.allowedStorage === void 0 || v.allowedStorage === null || isEffectiveMemberStorage(v.allowedStorage)) && (v.allowedStorageKeys === void 0 || v.allowedStorageKeys === null || Array.isArray(v.allowedStorageKeys) && v.allowedStorageKeys.every((key) => typeof key === "string")) && (v.genericParams === void 0 || v.genericParams === null || Array.isArray(v.genericParams) && v.genericParams.every(isGenericParamDeclaration)) && (v.extendsGenericBindings === void 0 || v.extendsGenericBindings === null || isGenericBindingsRecord(v.extendsGenericBindings)) && (v.constructorIds === void 0 || v.constructorIds === null || Array.isArray(v.constructorIds) && v.constructorIds.every(
44283
44173
  (constructorId) => typeof constructorId === "string" && constructorId.length > 0
44284
44174
  ) && new Set(v.constructorIds).size === v.constructorIds.length) && (v.requiredConstructorId === void 0 || v.requiredConstructorId === null || typeof v.requiredConstructorId === "string" && v.requiredConstructorId.length > 0 && (v.constructorIds ?? []).length === 0) && (v.targetMemberId === void 0 || v.targetMemberId === null || typeof v.targetMemberId === "string" && v.targetMemberId.length > 0) && (v.system === void 0 || v.system === null || isSystemMetadata(v.system));
44285
44175
  }
44286
- function isNeoClassConstructorProjection(value) {
44287
- if (value === null || typeof value !== "object" || Array.isArray(value)) {
44288
- return false;
44289
- }
44290
- const projection = value;
44291
- return Object.keys(projection).every(
44292
- (key) => key === "parameterName" || key === "memberId"
44293
- ) && typeof projection.parameterName === "string" && projection.parameterName.length > 0 && typeof projection.memberId === "string" && projection.memberId.length > 0;
44294
- }
44295
44176
  function resolveAllowedStorage(classId, classes, draft) {
44296
44177
  const visited = /* @__PURE__ */ new Set();
44297
44178
  const lookup = (id2) => draft && draft.id === id2 ? draft : classes.find((candidate) => candidate.id === id2);
@@ -44360,12 +44241,14 @@ function isNeoSchemaClassProps(value) {
44360
44241
  function isNeoSchemaClass(value) {
44361
44242
  return isNeoSchemaClassProps(value);
44362
44243
  }
44244
+ var RETIRED_CONSTRUCTOR_PROJECTIONS_FIELD;
44363
44245
  var init_classes = __esm({
44364
44246
  "../src/models/classes/classes.ts"() {
44365
44247
  "use strict";
44366
44248
  init_core();
44367
44249
  init_docs_text2();
44368
44250
  init_member_storage();
44251
+ RETIRED_CONSTRUCTOR_PROJECTIONS_FIELD = "constructorProjections";
44369
44252
  }
44370
44253
  });
44371
44254
 
@@ -50268,6 +50151,85 @@ function recordStorageKeyDeclaration(sink, valueId, member) {
50268
50151
  if (declaration === STORAGE_KEY_INHERIT) return;
50269
50152
  sink.set(valueId, declaration);
50270
50153
  }
50154
+ function createDefaultValueResolutionCache() {
50155
+ return {
50156
+ memberByIdIndex: null,
50157
+ instanceEnvironmentByKey: /* @__PURE__ */ new Map(),
50158
+ materializationPlanByClassAndEnvironment: /* @__PURE__ */ new Map(),
50159
+ resolvedMemberById: /* @__PURE__ */ new Map(),
50160
+ storedSchemaByClassId: /* @__PURE__ */ new Map(),
50161
+ validatedInitializerContainers: /* @__PURE__ */ new WeakSet()
50162
+ };
50163
+ }
50164
+ function withIndexedDefaultValueDocument(document, options = {}) {
50165
+ const cache = options.cache ?? createDefaultValueResolutionCache();
50166
+ if (cache.memberByIdIndex === null && options.memberById === void 0 && document.memberById === void 0) {
50167
+ cache.memberByIdIndex = new Map(
50168
+ document.members.map((member) => [member.id, member])
50169
+ );
50170
+ }
50171
+ const indexed = {
50172
+ ...document,
50173
+ memberById: (id2) => options.memberById?.(id2) ?? document.memberById?.(id2) ?? cache.memberByIdIndex?.get(id2) ?? null,
50174
+ resolvedMember: (member) => {
50175
+ const memberId = "id" in member ? member.id : void 0;
50176
+ if (typeof memberId !== "string") {
50177
+ return resolveMember2(member, document.members);
50178
+ }
50179
+ const cached = cache.resolvedMemberById.get(memberId);
50180
+ if (cached !== void 0) return cached;
50181
+ const resolved = resolveMember2(member, document.members);
50182
+ cache.resolvedMemberById.set(memberId, resolved);
50183
+ return resolved;
50184
+ },
50185
+ storedInstanceSchema: (classId) => {
50186
+ const cached = cache.storedSchemaByClassId.get(classId);
50187
+ if (cached !== void 0) return cached;
50188
+ const schema = mergeStoredInstanceSchema(
50189
+ classId,
50190
+ document.classes,
50191
+ document.members
50192
+ );
50193
+ cache.storedSchemaByClassId.set(classId, schema);
50194
+ return schema;
50195
+ },
50196
+ instanceEnv: (classId, classArguments2) => {
50197
+ const key = `${classId}:${JSON.stringify(classArguments2 ?? null)}`;
50198
+ const cached = cache.instanceEnvironmentByKey.get(key);
50199
+ if (cached !== void 0) return cached;
50200
+ const environment = resolveInstanceEnv(
50201
+ classId,
50202
+ classArguments2,
50203
+ document.classes
50204
+ );
50205
+ cache.instanceEnvironmentByKey.set(key, environment);
50206
+ return environment;
50207
+ },
50208
+ isInitValueContent: (value) => {
50209
+ if (typeof value !== "object" || value === null) return false;
50210
+ if (cache.validatedInitializerContainers.has(value)) return true;
50211
+ if (!isInitValueContent(value)) return false;
50212
+ cache.validatedInitializerContainers.add(value);
50213
+ return true;
50214
+ },
50215
+ createValueRow: options.createValueRow ?? document.createValueRow
50216
+ };
50217
+ indexed.storedInstanceMaterializationPlan = (classId, environment) => {
50218
+ let byEnvironment = cache.materializationPlanByClassAndEnvironment.get(classId);
50219
+ const cached = byEnvironment?.get(environment);
50220
+ if (cached !== void 0) return cached;
50221
+ const plan = buildDefaultClassMaterializationPlan(
50222
+ indexed,
50223
+ classId,
50224
+ environment
50225
+ );
50226
+ byEnvironment ??= /* @__PURE__ */ new WeakMap();
50227
+ byEnvironment.set(environment, plan);
50228
+ cache.materializationPlanByClassAndEnvironment.set(classId, byEnvironment);
50229
+ return plan;
50230
+ };
50231
+ return indexed;
50232
+ }
50271
50233
  function documentHasInitValueContent(document, value) {
50272
50234
  return document.isInitValueContent?.(value) ?? isInitValueContent(value);
50273
50235
  }
@@ -59713,7 +59675,6 @@ function lowerClass(context, declaration) {
59713
59675
  extendsClassId,
59714
59676
  declaration.baseTypes[0].arguments
59715
59677
  ) : base?.extendsGenericBindings ?? {},
59716
- ...base?.constructorProjections === void 0 ? {} : { constructorProjections: base.constructorProjections },
59717
59678
  // P43 §6.3/§6.4: declaration order is the only ordering state, and a
59718
59679
  // constructor carries no schema key, so it never enters schemaKeyOrder.
59719
59680
  ...declaration.constructors.length === 0 ? {} : {
@@ -63260,8 +63221,7 @@ function classToLanguageType(schemaClass2, context) {
63260
63221
  }
63261
63222
  function constructorSignature(schemaClass2, members, context, genericEnvironment) {
63262
63223
  if (schemaClass2.isAbstract) return {};
63263
- const projections = inheritedConstructorProjections(schemaClass2, context);
63264
- if (projections.length === 0 && !isClosedClass(schemaClass2.id, context.vm.classes)) {
63224
+ if (!isClosedClass(schemaClass2.id, context.vm.classes)) {
63265
63225
  return {};
63266
63226
  }
63267
63227
  if (resolveAllowedStorage(schemaClass2.id, context.vm.classes) === "immutable" /* Immutable */) {
@@ -63282,9 +63242,7 @@ function constructorSignature(schemaClass2, members, context, genericEnvironment
63282
63242
  defaultValue: "defaultValue" in resolved ? resolved.defaultValue : void 0
63283
63243
  };
63284
63244
  } catch {
63285
- return projections.some(
63286
- (projection) => projection.memberId === memberId
63287
- ) ? { required: true } : null;
63245
+ return null;
63288
63246
  }
63289
63247
  }
63290
63248
  );
@@ -63310,43 +63268,11 @@ function constructorSignature(schemaClass2, members, context, genericEnvironment
63310
63268
  defaultValue: "defaultValue" in resolved ? resolved.defaultValue : void 0
63311
63269
  };
63312
63270
  } catch {
63313
- if (projections.some((projection) => projection.memberId === memberId)) {
63314
- return { required: true };
63315
- }
63316
63271
  return null;
63317
63272
  }
63318
63273
  }
63319
63274
  );
63320
- return {
63321
- constructorSignature: {
63322
- ...signature,
63323
- ...projections.length === 0 ? {} : {
63324
- namedProjections: projections.map((projection) => ({
63325
- name: projection.parameterName,
63326
- memberId: projection.memberId
63327
- }))
63328
- }
63329
- }
63330
- };
63331
- }
63332
- function inheritedConstructorProjections(schemaClass2, context) {
63333
- const classesById2 = new Map(
63334
- context.vm.classes.map((candidate) => [candidate.id, candidate])
63335
- );
63336
- const projections = [];
63337
- const claimed = /* @__PURE__ */ new Set();
63338
- const visited = /* @__PURE__ */ new Set();
63339
- let current = schemaClass2;
63340
- while (current !== void 0 && !visited.has(current.id)) {
63341
- visited.add(current.id);
63342
- for (const projection of current.constructorProjections ?? []) {
63343
- if (claimed.has(projection.parameterName)) continue;
63344
- claimed.add(projection.parameterName);
63345
- projections.push(projection);
63346
- }
63347
- current = current.extendsClassId ? classesById2.get(current.extendsClassId) : void 0;
63348
- }
63349
- return projections;
63275
+ return { constructorSignature: signature };
63350
63276
  }
63351
63277
  function declaredConstructors(schemaClass2, context) {
63352
63278
  const requiredConstructorId2 = schemaClass2.requiredConstructorId;
@@ -64467,7 +64393,7 @@ var init_neoscript_language_context_adapter = __esm({
64467
64393
  init_project_root_members();
64468
64394
  init_project_file_registry();
64469
64395
  init_analyzer_types();
64470
- NEOSCRIPT_COMPILER_ADAPTER_REVISION = 2;
64396
+ NEOSCRIPT_COMPILER_ADAPTER_REVISION = 3;
64471
64397
  UNKNOWN_TYPE2 = {
64472
64398
  kind: "primitive",
64473
64399
  name: "unknown"
@@ -65932,7 +65858,11 @@ function resolveSemanticOwnerMembersForValues(document, targetValueIds, addition
65932
65858
  }
65933
65859
  return result;
65934
65860
  }
65935
- const graph = new MaterializedValueGraphContext(document);
65861
+ const graph = new MaterializedValueGraphContext(
65862
+ document,
65863
+ new Map(document.values.map((value) => [value.id, value])),
65864
+ new Map((additionalRoots ?? []).map((root) => [root.valueId, root.member]))
65865
+ );
65936
65866
  const allValueIds = new Set(graph.valuesById.keys());
65937
65867
  const semanticRoots = [
65938
65868
  ...additionalRoots ?? []
@@ -65994,7 +65924,7 @@ function resolveSemanticOwnerMembersForValues(document, targetValueIds, addition
65994
65924
  }
65995
65925
  return result;
65996
65926
  }
65997
- function createTypedValueNormalizer(rows, document, childrenByContainerId, parameterTypesForRow, memberById2, memberTypeInfo) {
65927
+ function createTypedValueNormalizer(rows, document, childrenByContainerId, parameterTypesForRow, memberById2, memberTypeInfo, genericEnvironmentForRow) {
65998
65928
  const visiting = /* @__PURE__ */ new Set();
65999
65929
  const normalizeLiteral = (value) => {
66000
65930
  if (Array.isArray(value)) return value.map(normalizeLiteral);
@@ -66047,7 +65977,7 @@ function createTypedValueNormalizer(rows, document, childrenByContainerId, param
66047
65977
  ...typeof row.classId === "string" ? { classId: row.classId } : {},
66048
65978
  ...row.genericBindings === void 0 ? {} : { genericBindings: row.genericBindings },
66049
65979
  value,
66050
- ...isLiteralValueContent(row) && row.constructorArgs !== void 0 && row.constructorArgs !== null ? {
65980
+ ...carriesSemanticConstructorArguments(row) ? {
66051
65981
  constructorArgs: normalizeConstructorArgs(row.constructorArgs, row)
66052
65982
  } : {}
66053
65983
  };
@@ -66067,18 +65997,24 @@ function createTypedValueNormalizer(rows, document, childrenByContainerId, param
66067
65997
  // the row's payload. Keep those strings literal instead of guessing
66068
65998
  // that UUID-shaped values are further row references.
66069
65999
  value: normalizeLiteral(row.value),
66070
- ...isLiteralValueContent(row) && row.constructorArgs !== void 0 && row.constructorArgs !== null ? {
66000
+ ...carriesSemanticConstructorArguments(row) ? {
66071
66001
  constructorArgs: normalizeConstructorArgs(row.constructorArgs, row)
66072
66002
  } : {}
66073
66003
  };
66074
66004
  visiting.delete(valueId);
66075
66005
  return normalized;
66076
66006
  };
66007
+ function carriesSemanticConstructorArguments(row) {
66008
+ if (!isLiteralValueContent(row)) return false;
66009
+ const constructorArgs = row.constructorArgs;
66010
+ if (constructorArgs === void 0 || constructorArgs === null) return false;
66011
+ return typeof row.instanceConstructorId === "string" || Object.keys(constructorArgs).length > 0;
66012
+ }
66077
66013
  const normalizeClassValue = (row, typeInfo) => {
66078
66014
  if (!isStringRecord4(row.value)) return normalizeLiteral(row.value);
66079
66015
  const effectiveClassId = row.classId ?? (typeInfo.type === 7 /* Class */ ? typeInfo.classId : void 0);
66080
66016
  if (effectiveClassId === void 0) return normalizeLiteral(row.value);
66081
- const env = rowGenericEnvironment(document, row);
66017
+ const env = genericEnvironmentForRow(row);
66082
66018
  const merged = mergeStoredInstanceSchema(
66083
66019
  effectiveClassId,
66084
66020
  document.classes,
@@ -66213,8 +66149,12 @@ function collectSoftOwnedConstructorArgumentValueIds(index, ownerValueId, preser
66213
66149
  }
66214
66150
  return collected;
66215
66151
  }
66216
- function rowGenericEnvironment(document, row) {
66217
- const env = typeof row.classId === "string" ? resolveInstanceEnv(row.classId, void 0, document.classes) : /* @__PURE__ */ new Map();
66152
+ function rowGenericEnvironment(document, row, contextualRootMember) {
66153
+ const env = typeof row.classId === "string" ? resolveInstanceEnv(
66154
+ row.classId,
66155
+ contextualRootMember !== void 0 && isMemberClassBase(contextualRootMember) ? contextualRootMember.classArguments : void 0,
66156
+ document.classes
66157
+ ) : /* @__PURE__ */ new Map();
66218
66158
  for (const [paramId, binding] of envFromStamp(row.genericBindings)) {
66219
66159
  env.set(paramId, binding);
66220
66160
  }
@@ -66299,6 +66239,7 @@ var init_constructor_argument_ownership = __esm({
66299
66239
  classesById;
66300
66240
  membersById;
66301
66241
  constructorsById;
66242
+ contextualRootMembersByValueId;
66302
66243
  parameterTypesByValueId = /* @__PURE__ */ new Map();
66303
66244
  settleConstructorParameter;
66304
66245
  aggregateTypeByTargetValueId = /* @__PURE__ */ new Map();
@@ -66306,9 +66247,10 @@ var init_constructor_argument_ownership = __esm({
66306
66247
  ownership;
66307
66248
  constructor(document, rows = new Map(
66308
66249
  document.values.map((value) => [value.id, value])
66309
- )) {
66250
+ ), contextualRootMembersByValueId = /* @__PURE__ */ new Map()) {
66310
66251
  this.valuesById = rows;
66311
66252
  this.document = { ...document, values: [...rows.values()] };
66253
+ this.contextualRootMembersByValueId = contextualRootMembersByValueId;
66312
66254
  this.classesById = new Map(
66313
66255
  document.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
66314
66256
  );
@@ -66367,7 +66309,7 @@ var init_constructor_argument_ownership = __esm({
66367
66309
  if (constructor2 === void 0 || constructor2.classId !== root.classId) {
66368
66310
  return result;
66369
66311
  }
66370
- const env = rowGenericEnvironment(this.document, root);
66312
+ const env = this.genericEnvironmentForRow(root);
66371
66313
  for (let index = 0; index < constructor2.argumentTypes.length; index += 1) {
66372
66314
  const parameterId = constructorActionParameterId(constructor2, index);
66373
66315
  const rawTypeInfo = constructor2.argumentTypes[index];
@@ -66427,7 +66369,7 @@ var init_constructor_argument_ownership = __esm({
66427
66369
  ...settled,
66428
66370
  member: substituteMember(
66429
66371
  member,
66430
- rowGenericEnvironment(this.document, owner),
66372
+ this.genericEnvironmentForRow(owner),
66431
66373
  this.document.members
66432
66374
  )
66433
66375
  };
@@ -66487,7 +66429,8 @@ var init_constructor_argument_ownership = __esm({
66487
66429
  return resolved;
66488
66430
  },
66489
66431
  (memberId) => this.membersById.get(memberId),
66490
- (member, env) => this.memberTypeInfo(member, env)
66432
+ (member, env) => this.memberTypeInfo(member, env),
66433
+ (row) => this.genericEnvironmentForRow(row)
66491
66434
  );
66492
66435
  }
66493
66436
  ownerForValue(valueId) {
@@ -66577,7 +66520,8 @@ var init_constructor_argument_ownership = __esm({
66577
66520
  this.childrenByContainerId,
66578
66521
  (row) => this.constructorParameterTypes(row),
66579
66522
  (memberId) => this.membersById.get(memberId),
66580
- (member, env) => this.memberTypeInfo(member, env)
66523
+ (member, env) => this.memberTypeInfo(member, env),
66524
+ (row) => this.genericEnvironmentForRow(row)
66581
66525
  );
66582
66526
  return this.typedNormalizer;
66583
66527
  }
@@ -66599,6 +66543,13 @@ var init_constructor_argument_ownership = __esm({
66599
66543
  }
66600
66544
  return rawTypeInfo;
66601
66545
  }
66546
+ genericEnvironmentForRow(row) {
66547
+ return rowGenericEnvironment(
66548
+ this.document,
66549
+ row,
66550
+ this.contextualRootMembersByValueId.get(row.id)
66551
+ );
66552
+ }
66602
66553
  memberTypeInfo(rawMember, env) {
66603
66554
  try {
66604
66555
  const member = substituteMember(rawMember, env, this.document.members);
@@ -68265,12 +68216,8 @@ function evaluatorResolutionCache(ctx) {
68265
68216
  compiledFunctionByMemberId: /* @__PURE__ */ new Map(),
68266
68217
  compiledGetterByMemberId: /* @__PURE__ */ new Map(),
68267
68218
  compiledSetterByMemberId: /* @__PURE__ */ new Map(),
68268
- resolvedMemberById: /* @__PURE__ */ new Map(),
68269
- storedInstanceSchemaByClassId: /* @__PURE__ */ new Map(),
68270
- instanceEnvByKey: /* @__PURE__ */ new Map(),
68219
+ defaultValueResolutionCache: createDefaultValueResolutionCache(),
68271
68220
  validatedConstructorDescriptorByInfo: /* @__PURE__ */ new WeakMap(),
68272
- validatedInitValueContents: /* @__PURE__ */ new WeakSet(),
68273
- storedInstanceMaterializationPlanByClassAndEnv: /* @__PURE__ */ new Map(),
68274
68221
  effectiveStorageResolver: void 0
68275
68222
  };
68276
68223
  resolutionCacheByMembers.set(members, {
@@ -68283,37 +68230,31 @@ function evaluatorResolutionCache(ctx) {
68283
68230
  return cache;
68284
68231
  }
68285
68232
  function cachedResolvedMember(member, ctx) {
68286
- const memberId = member.id;
68287
- if (typeof memberId !== "string") {
68288
- return resolveMember2(member, ctx.vm.members);
68289
- }
68290
- const cache = evaluatorResolutionCache(ctx).resolvedMemberById;
68291
- const cached = cache.get(memberId);
68292
- if (cached !== void 0) return cached;
68293
- const resolved = resolveMember2(member, ctx.vm.members);
68294
- cache.set(memberId, resolved);
68295
- return resolved;
68233
+ return evaluatorDefaultValueDocument(ctx).resolvedMember(member);
68296
68234
  }
68297
68235
  function cachedStoredInstanceSchema(classId, ctx) {
68298
- const cache = evaluatorResolutionCache(ctx).storedInstanceSchemaByClassId;
68299
- const cached = cache.get(classId);
68300
- if (cached !== void 0) return cached;
68301
- const merged = mergeStoredInstanceSchema(
68236
+ return evaluatorDefaultValueDocument(ctx).storedInstanceSchema(classId);
68237
+ }
68238
+ function cachedStoredInstanceMaterializationPlan(classId, instanceEnv, ctx) {
68239
+ return evaluatorDefaultValueDocument(ctx).storedInstanceMaterializationPlan(
68302
68240
  classId,
68303
- ctx.vm.classes,
68304
- ctx.vm.members
68241
+ instanceEnv
68305
68242
  );
68306
- cache.set(classId, merged);
68307
- return merged;
68308
68243
  }
68309
- function cachedStoredInstanceMaterializationPlan(classId, instanceEnv, ctx) {
68310
- const cache = evaluatorResolutionCache(
68311
- ctx
68312
- ).storedInstanceMaterializationPlanByClassAndEnv;
68313
- let byEnvironment = cache.get(classId);
68314
- const cached = byEnvironment?.get(instanceEnv);
68315
- if (cached !== void 0) return cached;
68316
- const plan = buildDefaultClassMaterializationPlan(
68244
+ function cachedInstanceEnv(classId, classArguments2, ctx) {
68245
+ return evaluatorDefaultValueDocument(ctx).instanceEnv(
68246
+ classId,
68247
+ classArguments2
68248
+ );
68249
+ }
68250
+ function cachedIsInitValueContent(value, ctx) {
68251
+ return evaluatorDefaultValueDocument(ctx).isInitValueContent(value);
68252
+ }
68253
+ function evaluatorDefaultValueDocument(ctx) {
68254
+ if (ctx.__defaultValueDocument !== void 0) {
68255
+ return ctx.__defaultValueDocument;
68256
+ }
68257
+ const document = withIndexedDefaultValueDocument(
68317
68258
  {
68318
68259
  project: ctx.vm.project,
68319
68260
  members: ctx.vm.members,
@@ -68322,37 +68263,13 @@ function cachedStoredInstanceMaterializationPlan(classId, instanceEnv, ctx) {
68322
68263
  values: ctx.vm.values,
68323
68264
  memberById: ctx.vm.databaseVM?.memberById,
68324
68265
  valueById: ctx.vm.databaseVM?.valueById,
68325
- resolvedMember: (member) => cachedResolvedMember(member, ctx),
68326
- storedInstanceSchema: (nestedClassId) => cachedStoredInstanceSchema(nestedClassId, ctx),
68327
- instanceEnv: (nestedClassId, classArguments2) => cachedInstanceEnv(nestedClassId, classArguments2, ctx),
68328
- isInitValueContent: (value) => cachedIsInitValueContent(value, ctx),
68329
68266
  projectFiles: ctx.vm.projectFiles ?? [],
68330
68267
  textureTemplates: ctx.vm.textureTemplates ?? []
68331
68268
  },
68332
- classId,
68333
- instanceEnv
68269
+ { cache: evaluatorResolutionCache(ctx).defaultValueResolutionCache }
68334
68270
  );
68335
- byEnvironment ??= /* @__PURE__ */ new WeakMap();
68336
- byEnvironment.set(instanceEnv, plan);
68337
- cache.set(classId, byEnvironment);
68338
- return plan;
68339
- }
68340
- function cachedInstanceEnv(classId, classArguments2, ctx) {
68341
- const key = `${classId}:${JSON.stringify(classArguments2 ?? null)}`;
68342
- const cache = evaluatorResolutionCache(ctx).instanceEnvByKey;
68343
- const cached = cache.get(key);
68344
- if (cached !== void 0) return cached;
68345
- const resolved = resolveInstanceEnv(classId, classArguments2, ctx.vm.classes);
68346
- cache.set(key, resolved);
68347
- return resolved;
68348
- }
68349
- function cachedIsInitValueContent(value, ctx) {
68350
- if (typeof value !== "object" || value === null) return false;
68351
- const cache = evaluatorResolutionCache(ctx).validatedInitValueContents;
68352
- if (cache.has(value)) return true;
68353
- if (!isInitValueContent(value)) return false;
68354
- cache.add(value);
68355
- return true;
68271
+ ctx.__defaultValueDocument = document;
68272
+ return document;
68356
68273
  }
68357
68274
  function sessionCreationCheckpoint(ctx) {
68358
68275
  if (ctx.__sessionCreationStrategy === "snapshot") {
@@ -71691,7 +71608,7 @@ function evalKeyOf(keyOf, scope, ctx, optional = false, memberId, onReceiver) {
71691
71608
  if (dispatched.kind === "ok") return dispatched.value;
71692
71609
  if (!dispatched.matchedMember && memberId !== void 0) {
71693
71610
  const member = evalMemberById(ctx.vm, memberId);
71694
- const defaultValue = readOnlyDeclarationDefault(member, memberId, ctx);
71611
+ const defaultValue = readOnlyDeclarationDefault(member, ctx);
71695
71612
  if (defaultValue.matched) return defaultValue.value;
71696
71613
  }
71697
71614
  if (Object.prototype.hasOwnProperty.call(receiver, k)) {
@@ -71714,8 +71631,6 @@ function dispatchSchemaMember(receiver, schemaKey, ctx) {
71714
71631
  }
71715
71632
  const member = resolveRuntimeSchemaMember(receiver, schemaKey, ctx);
71716
71633
  if (!member) return { kind: "no-info", matchedMember: false };
71717
- const defaultValue = readOnlyDeclarationDefault(member, member.id, ctx);
71718
- if (defaultValue.matched) return { kind: "ok", value: defaultValue.value };
71719
71634
  if (member.kind === 10 /* NSProperty */) {
71720
71635
  if (!resolveCompiledGetter(member.id, ctx)) {
71721
71636
  return { kind: "no-info", matchedMember: true };
@@ -71725,6 +71640,8 @@ function dispatchSchemaMember(receiver, schemaKey, ctx) {
71725
71640
  value: dispatchNSGetterById(member.id, receiver, ctx)
71726
71641
  };
71727
71642
  }
71643
+ const defaultValue = readOnlyDeclarationDefault(member, ctx);
71644
+ if (defaultValue.matched) return { kind: "ok", value: defaultValue.value };
71728
71645
  if (!Object.prototype.hasOwnProperty.call(receiver, schemaKey)) {
71729
71646
  const expanded = virtualExpandedRecordForReceiver(receiver, ctx);
71730
71647
  if (expanded !== null && Object.prototype.hasOwnProperty.call(expanded, schemaKey)) {
@@ -71756,13 +71673,11 @@ function virtualExpandedRecordForReceiver(receiver, ctx) {
71756
71673
  }
71757
71674
  return record3;
71758
71675
  }
71759
- function readOnlyDeclarationDefault(member, memberId, ctx) {
71676
+ function readOnlyDeclarationDefault(member, ctx) {
71760
71677
  const readOnly = member?.isReadOnly;
71761
71678
  if (readOnly !== true) return { matched: false };
71762
71679
  if (member?.defaultValue === void 0 || member.defaultValue === null) {
71763
- throw new NSGetterRuntimeError(
71764
- `Read-only member '${member?.name ?? memberId}' has no declaration default.`
71765
- );
71680
+ return { matched: false };
71766
71681
  }
71767
71682
  let value = member.defaultValue.value;
71768
71683
  if (isMemberString(member) && member.localizable !== false && typeof value === "string") {
@@ -74113,7 +74028,7 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
74113
74028
  return (member, init, sourceValueId) => {
74114
74029
  const memberId = Reflect.get(member, "id");
74115
74030
  const effectiveMemberId = typeof memberId === "string" ? memberId : null;
74116
- const scopeMemberId = indexes.initializerScopeMemberIds.get(init) ?? effectiveMemberId;
74031
+ const scopeMemberId = indexes.initializerScopeMemberIds.get(init) ?? (typeof sourceValueId !== "string" ? void 0 : indexes.initializerScopeMemberIdsByValueId.get(sourceValueId)) ?? effectiveMemberId;
74117
74032
  const compiled = ensureInitializerCompiled({
74118
74033
  init,
74119
74034
  member,
@@ -74184,6 +74099,7 @@ function constructorInitializerIndexes(ctx) {
74184
74099
  }
74185
74100
  function buildConstructorInitializerIndexes(vm) {
74186
74101
  const initializerScopeMemberIds = /* @__PURE__ */ new WeakMap();
74102
+ const initializerScopeMemberIdsByValueId = /* @__PURE__ */ new Map();
74187
74103
  const initializerByValueId = /* @__PURE__ */ new Map();
74188
74104
  for (const row of vm.values) {
74189
74105
  const initializer = Reflect.get(row, "init");
@@ -74214,6 +74130,7 @@ function buildConstructorInitializerIndexes(vm) {
74214
74130
  );
74215
74131
  if (typeof rootOwnerId === "string") {
74216
74132
  initializerScopeMemberIds.set(initializer, rootOwnerId);
74133
+ initializerScopeMemberIdsByValueId.set(valueId, rootOwnerId);
74217
74134
  }
74218
74135
  }
74219
74136
  const declaringClassIdsByMemberId = /* @__PURE__ */ new Map();
@@ -74233,6 +74150,7 @@ function buildConstructorInitializerIndexes(vm) {
74233
74150
  }
74234
74151
  return {
74235
74152
  initializerScopeMemberIds,
74153
+ initializerScopeMemberIdsByValueId,
74236
74154
  declaringClassIdsByMemberId,
74237
74155
  memberById: memberById2,
74238
74156
  containerMemberIdByEntryId
@@ -74460,6 +74378,12 @@ function recordConstructorGroupDependency(valueId, destination, ctx) {
74460
74378
  }
74461
74379
  function encodeRequiredConstructorArgument(args) {
74462
74380
  const trackedId = findKnownRowIdByValueReference(args.value, args.ctx);
74381
+ const replayedAggregateId = trackedId === null && args.ctx.storedConstructionReplay === true && typeof args.value === "string" && evalValueById(
74382
+ args.ctx,
74383
+ args.value,
74384
+ args.ctx.__runtimeSessionValues,
74385
+ args.ctx.__valueOverlay
74386
+ ) !== null ? args.value : null;
74463
74387
  const adoptTracked = (id2, suffix) => {
74464
74388
  if (constructorGroupForRow(id2, args.ctx) !== null) {
74465
74389
  assertOwnedValueAttachable(
@@ -74482,18 +74406,20 @@ function encodeRequiredConstructorArgument(args) {
74482
74406
  }
74483
74407
  if (args.typeInfo.type === 7 /* Class */ || args.typeInfo.type === 22 /* Interface */) {
74484
74408
  if (args.value === null || args.value === void 0) return null;
74485
- if (trackedId === null) {
74409
+ const aggregateId2 = trackedId ?? replayedAggregateId;
74410
+ if (aggregateId2 === null) {
74486
74411
  throw new NSGetterRuntimeError(
74487
74412
  `Constructor aggregate argument '${args.parameterId}' has no backing value row.`
74488
74413
  );
74489
74414
  }
74490
- return adoptTracked(trackedId, "root");
74415
+ return adoptTracked(aggregateId2, "root");
74491
74416
  }
74492
74417
  if (args.typeInfo.type !== 6 /* List */ && args.typeInfo.type !== 5 /* Dictionary */) {
74493
74418
  return cloneConstructorLiteralValue(args.value);
74494
74419
  }
74495
74420
  if (args.value === null || args.value === void 0) return null;
74496
- if (trackedId !== null) return adoptTracked(trackedId, "root");
74421
+ const aggregateId = trackedId ?? replayedAggregateId;
74422
+ if (aggregateId !== null) return adoptTracked(aggregateId, "root");
74497
74423
  const collectionType = args.typeInfo;
74498
74424
  const registerRow = (value, containerId) => {
74499
74425
  const row2 = buildNewValue(args.ctx.vm.project.id, { value });
@@ -75121,10 +75047,10 @@ function evalVariantApply(info, scope, ctx) {
75121
75047
  graph,
75122
75048
  ctx
75123
75049
  );
75124
- const applyValueId = graph.root.Apply;
75125
- if (typeof applyValueId === "string" && applyValueId.length > 0) {
75050
+ const applyValue = graph.root.Apply;
75051
+ if (applyValue !== void 0 && applyValue !== null) {
75126
75052
  invokeVariantClosure({
75127
- closureValueId: applyValueId,
75053
+ closureValueId: applyValue,
75128
75054
  ctx,
75129
75055
  label: `Variant '${graph.name}' Apply`,
75130
75056
  lexicalThis: null,
@@ -76739,6 +76665,32 @@ var init_stored_value_placement_index = __esm({
76739
76665
  });
76740
76666
 
76741
76667
  // ../src/database/virtual-instance-values.ts
76668
+ function buildVirtualInstanceMaterializedIndex(args) {
76669
+ const rowsById = new Map(
76670
+ (args.materializedRows ?? args.document.values).map((row) => [row.id, row])
76671
+ );
76672
+ const rows = [...rowsById.values()];
76673
+ return {
76674
+ rows,
76675
+ rowsById,
76676
+ graph: new MaterializedValueGraphContext(
76677
+ { ...args.document, values: rows },
76678
+ rowsById
76679
+ ),
76680
+ unorderedEntryIdsByContainerId: buildUnorderedListMembershipIndex(rows),
76681
+ constructorsById: new Map(
76682
+ (args.document.constructors ?? []).map((constructor2) => [
76683
+ constructor2.id,
76684
+ constructor2
76685
+ ])
76686
+ ),
76687
+ resolveConstructorSettlement: createConstructorSettlementResolver({
76688
+ classes: args.document.classes,
76689
+ constructors: args.document.constructors ?? [],
76690
+ members: args.document.members
76691
+ })
76692
+ };
76693
+ }
76742
76694
  function firstListInParameterType(typeInfo, depth = 0) {
76743
76695
  if (typeof typeInfo !== "object" || typeInfo === null) return null;
76744
76696
  if (depth > CONSTRUCTOR_TYPE_WALK_DEPTH_LIMIT) return "depth-limit";
@@ -77018,21 +76970,26 @@ function resolveVirtualInstanceGraph(args) {
77018
76970
  const unattributable = firstUnattributableExpansionMember(expansion);
77019
76971
  if (unattributable !== null) recorder.recordGlobalRead(unattributable);
77020
76972
  }
77021
- const materializedById = new Map(
77022
- (args.materializedRows ?? args.document.values).map((row) => [row.id, row])
76973
+ const materializedById = args.materializedIndex?.rowsById ?? new Map(
76974
+ (args.materializedRows ?? args.document.values).map((row) => [
76975
+ row.id,
76976
+ row
76977
+ ])
77023
76978
  );
77024
- const materializedRows = [...materializedById.values()];
77025
- const materializedGraph = args.materializedGraph ?? new MaterializedValueGraphContext(
77026
- { ...args.document, values: materializedRows },
76979
+ const materializedRows = args.materializedIndex?.rows ?? [
76980
+ ...materializedById.values()
76981
+ ];
76982
+ const materializedGraph = args.materializedGraph ?? args.materializedIndex?.graph ?? new MaterializedValueGraphContext(
76983
+ { ...args.document, values: [...materializedRows] },
77027
76984
  materializedById
77028
76985
  );
77029
- const constructorsById = new Map(
76986
+ const constructorsById = args.materializedIndex?.constructorsById ?? new Map(
77030
76987
  (args.document.constructors ?? []).map((constructor2) => [
77031
76988
  constructor2.id,
77032
76989
  constructor2
77033
76990
  ])
77034
76991
  );
77035
- const resolveConstructorSettlement = createConstructorSettlementResolver({
76992
+ const resolveConstructorSettlement = args.materializedIndex?.resolveConstructorSettlement ?? createConstructorSettlementResolver({
77036
76993
  classes: args.document.classes,
77037
76994
  constructors: args.document.constructors ?? [],
77038
76995
  members: args.document.members
@@ -77062,7 +77019,7 @@ function resolveVirtualInstanceGraph(args) {
77062
77019
  }
77063
77020
  return result;
77064
77021
  };
77065
- const materializedUnorderedEntryIdsByContainerId = buildUnorderedListMembershipIndex(materializedRows);
77022
+ const materializedUnorderedEntryIdsByContainerId = args.materializedIndex?.unorderedEntryIdsByContainerId ?? buildUnorderedListMembershipIndex(materializedRows);
77066
77023
  const readMaterializedRow = (valueId) => {
77067
77024
  recorder?.recordValueRead(valueId);
77068
77025
  return materializedById.get(valueId) ?? null;
@@ -77348,6 +77305,9 @@ function reportFrameResolutionDisagreement(args) {
77348
77305
  }
77349
77306
  function resolvedStoredInstanceRows(args) {
77350
77307
  const rows = new Map(args.document.values.map((row) => [row.id, row]));
77308
+ const materializedIndex = buildVirtualInstanceMaterializedIndex({
77309
+ document: args.document
77310
+ });
77351
77311
  const queue = [{ root: args.instanceRoot, member: args.rootMember }];
77352
77312
  const resolvedRootIds = /* @__PURE__ */ new Set();
77353
77313
  const resolvedFrameByValueId = /* @__PURE__ */ new Map();
@@ -77366,7 +77326,7 @@ function resolvedStoredInstanceRows(args) {
77366
77326
  rootMember: next.member,
77367
77327
  expandedRoot: expanded.root,
77368
77328
  expandedRows: expanded.rows,
77369
- materializedRows: args.document.values
77329
+ materializedIndex
77370
77330
  });
77371
77331
  for (const [id2, row] of graph.rowsById) {
77372
77332
  const priorFrame = resolvedFrameByValueId.get(id2);
@@ -77940,7 +77900,9 @@ function sparsifyConstructedInstance(args) {
77940
77900
  values: materializedRows
77941
77901
  };
77942
77902
  const materializedGraph = new MaterializedValueGraphContext(
77943
- constructionDocument
77903
+ constructionDocument,
77904
+ new Map(materializedRows.map((row) => [row.id, row])),
77905
+ /* @__PURE__ */ new Map([[args.constructed.root.id, args.rootMember]])
77944
77906
  );
77945
77907
  const graph = resolveVirtualInstanceGraph({
77946
77908
  document: args.document,
@@ -78788,7 +78750,12 @@ function createHeadlessVirtualInstanceResolver(args) {
78788
78750
  values: document.values
78789
78751
  }).placementByValueId;
78790
78752
  const rawById = new Map(document.values.map((row) => [row.id, row]));
78791
- const resolverDocumentOnce = () => composeResolverDocument(document, args.resolverLookups());
78753
+ let resolverDocumentCache = null;
78754
+ const resolverDocumentOnce = () => resolverDocumentCache ??= composeResolverDocument(
78755
+ document,
78756
+ args.resolverLookups()
78757
+ );
78758
+ let materializedIndex = null;
78792
78759
  const graphRowsByRootId = /* @__PURE__ */ new Map();
78793
78760
  const graphByValueId = /* @__PURE__ */ new Map();
78794
78761
  const failedRootIds = /* @__PURE__ */ new Set();
@@ -78813,6 +78780,10 @@ function createHeadlessVirtualInstanceResolver(args) {
78813
78780
  }
78814
78781
  try {
78815
78782
  const resolverDocument = resolverDocumentOnce();
78783
+ materializedIndex ??= buildVirtualInstanceMaterializedIndex({
78784
+ document: resolverDocument,
78785
+ materializedRows: document.values
78786
+ });
78816
78787
  const expanded = expandStoredInstance({
78817
78788
  document: resolverDocument,
78818
78789
  instanceRoot,
@@ -78824,7 +78795,7 @@ function createHeadlessVirtualInstanceResolver(args) {
78824
78795
  rootMember: member,
78825
78796
  expandedRoot: expanded.root,
78826
78797
  expandedRows: expanded.rows,
78827
- materializedRows: document.values
78798
+ materializedIndex
78828
78799
  });
78829
78800
  graphRowsByRootId.set(rootId, graph.rowsById);
78830
78801
  for (const [id2, row] of graph.rowsById) {
@@ -79007,9 +78978,10 @@ function buildInitializerRootValueWithLookups(document, lookups) {
79007
78978
  }
79008
78979
  function evaluateMemberInitializer(args) {
79009
78980
  const databaseVM = initializerEvaluatorLookups(args.document);
79010
- const compileMemberId = databaseVM.constructorInitializerIndexes?.initializerScopeMemberIds.get(
79011
- args.init
79012
- );
78981
+ const initializerIndexes = databaseVM.constructorInitializerIndexes;
78982
+ const compileMemberId = initializerIndexes?.initializerScopeMemberIds.get(args.init) ?? (args.sourceValueId === null || args.sourceValueId === void 0 ? void 0 : initializerIndexes?.initializerScopeMemberIdsByValueId.get(
78983
+ args.sourceValueId
78984
+ ));
79013
78985
  const compiled = ensureInitializerCompiled({
79014
78986
  init: args.init,
79015
78987
  member: args.member,
@@ -84439,7 +84411,6 @@ function isWorldAnimationStructuralMember(memberId, members) {
84439
84411
  }
84440
84412
  function assertAnimationClipDocumentValid(document) {
84441
84413
  const context = new AnimationValidationContext(document);
84442
- context.validateConstructorProjections();
84443
84414
  context.validateSegments();
84444
84415
  for (const member of document.members) {
84445
84416
  if (!isMemberClass(member)) continue;
@@ -84458,7 +84429,6 @@ var init_animation_clips = __esm({
84458
84429
  init_inheritance();
84459
84430
  init_generics();
84460
84431
  init_world_system_classes();
84461
- init_core_types();
84462
84432
  init_member_kinds();
84463
84433
  init_structured_leaf_fields();
84464
84434
  init_effective_storage();
@@ -84501,60 +84471,6 @@ var init_animation_clips = __esm({
84501
84471
  memberById;
84502
84472
  valueById;
84503
84473
  storage;
84504
- validateConstructorProjections() {
84505
- for (const schemaClass2 of this.document.classes) {
84506
- const projections = schemaClass2.constructorProjections ?? [];
84507
- if (projections.length === 0) continue;
84508
- if (schemaClass2.system?.kind !== SystemProtectionKind.WorldAuthoring) {
84509
- throw new Error(
84510
- `Class "${schemaClass2.name}" can declare constructor projections only when it is a locked world system class.`
84511
- );
84512
- }
84513
- const parameterNames = /* @__PURE__ */ new Set();
84514
- const memberIds = /* @__PURE__ */ new Set();
84515
- const effectiveMemberIds = this.effectiveSchemaMemberIds(schemaClass2);
84516
- for (const projection of projections) {
84517
- if (parameterNames.has(projection.parameterName)) {
84518
- throw new Error(
84519
- `Class "${schemaClass2.name}" has duplicate constructor parameter "${projection.parameterName}".`
84520
- );
84521
- }
84522
- if (memberIds.has(projection.memberId)) {
84523
- throw new Error(
84524
- `Class "${schemaClass2.name}" projects multiple constructor parameters onto member "${projection.memberId}".`
84525
- );
84526
- }
84527
- if (!effectiveMemberIds.has(projection.memberId)) {
84528
- throw new Error(
84529
- `Class "${schemaClass2.name}" constructor parameter "${projection.parameterName}" references member "${projection.memberId}", which is neither in its schema nor inherited.`
84530
- );
84531
- }
84532
- parameterNames.add(projection.parameterName);
84533
- memberIds.add(projection.memberId);
84534
- }
84535
- }
84536
- }
84537
- /**
84538
- * Every member id a class resolves under a schema key — its own, then each
84539
- * ancestor's.
84540
- *
84541
- * A projection may name an inherited member: P48 §2.1 moved `Child` onto
84542
- * `NeoAnimationTrackBase`, and `new NeoAnimationChildTrack(id: "…")` still
84543
- * projects onto that one member from a class that no longer declares it.
84544
- */
84545
- effectiveSchemaMemberIds(schemaClass2) {
84546
- const memberIds = /* @__PURE__ */ new Set();
84547
- const visited = /* @__PURE__ */ new Set();
84548
- let current = schemaClass2;
84549
- while (current !== void 0 && !visited.has(current.id)) {
84550
- visited.add(current.id);
84551
- for (const memberId of Object.values(current.schema)) {
84552
- memberIds.add(memberId);
84553
- }
84554
- current = current.extendsClassId === void 0 ? void 0 : this.classById.get(current.extendsClassId);
84555
- }
84556
- return memberIds;
84557
- }
84558
84474
  classHasWorldKind(classId, worldKind) {
84559
84475
  const visited = /* @__PURE__ */ new Set();
84560
84476
  let current = this.classById.get(classId);
@@ -86031,17 +85947,26 @@ function syntheticMember(fields) {
86031
85947
  function variantOwnershipRoots(args) {
86032
85948
  const empty = { roots: [], bindingMembers: [] };
86033
85949
  if (args.variants.length === 0) return empty;
86034
- const plainVariantClass = args.classes.find(
86035
- (schemaClass2) => schemaClass2.system?.worldKind === NeoWorldSystemClassKind.Variant
85950
+ const classById = new Map(
85951
+ args.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
85952
+ );
85953
+ const classByVariantKind = /* @__PURE__ */ new Map();
85954
+ for (const schemaClass2 of args.classes) {
85955
+ const worldKind = schemaClass2.system?.worldKind;
85956
+ if (worldKind !== NeoWorldSystemClassKind.Variant && worldKind !== NeoWorldSystemClassKind.LookupVariant) {
85957
+ continue;
85958
+ }
85959
+ classByVariantKind.set(worldKind, schemaClass2);
85960
+ }
85961
+ const plainVariantClass = classByVariantKind.get(
85962
+ NeoWorldSystemClassKind.Variant
86036
85963
  );
86037
85964
  if (plainVariantClass === void 0) return empty;
86038
85965
  const valueById = new Map(args.values.map((value) => [value.id, value]));
86039
85966
  const folderById = new Map(
86040
85967
  (args.variantFolders ?? []).map((folder) => [folder.id, folder])
86041
85968
  );
86042
- const memberById2 = new Map(
86043
- (args.members ?? []).map((member) => [member.id, member])
86044
- );
85969
+ let memberById2 = null;
86045
85970
  const roots = [];
86046
85971
  const bindingMembers = [];
86047
85972
  for (const variant of args.variants) {
@@ -86049,11 +85974,9 @@ function variantOwnershipRoots(args) {
86049
85974
  if (root === void 0) continue;
86050
85975
  const lookupFolder = variant.folderId == null ? void 0 : folderById.get(variant.folderId);
86051
85976
  const inferredVariantKind = lookupFolder?.binding == null ? NeoWorldSystemClassKind.Variant : NeoWorldSystemClassKind.LookupVariant;
86052
- const variantClass = args.classes.find(
86053
- (schemaClass2) => schemaClass2.id === root.classId && (schemaClass2.system?.worldKind === NeoWorldSystemClassKind.Variant || schemaClass2.system?.worldKind === NeoWorldSystemClassKind.LookupVariant)
86054
- ) ?? args.classes.find(
86055
- (schemaClass2) => schemaClass2.system?.worldKind === inferredVariantKind
86056
- ) ?? plainVariantClass;
85977
+ const stampedClass = typeof root.classId === "string" ? classById.get(root.classId) : void 0;
85978
+ const stampedKind = stampedClass?.system?.worldKind;
85979
+ const variantClass = (stampedKind === NeoWorldSystemClassKind.Variant || stampedKind === NeoWorldSystemClassKind.LookupVariant ? stampedClass : void 0) ?? classByVariantKind.get(inferredVariantKind) ?? plainVariantClass;
86057
85980
  const parameterId = variantClass.genericParams?.[0]?.id;
86058
85981
  if (parameterId === void 0) continue;
86059
85982
  const stampedTargetMemberId = readStampedTargetMemberId(root, parameterId);
@@ -86080,7 +86003,12 @@ function variantOwnershipRoots(args) {
86080
86003
  })
86081
86004
  );
86082
86005
  const lookupParameterId = variantClass.genericParams?.[1]?.id;
86083
- const lookupCollection = lookupFolder?.binding == null ? void 0 : memberById2.get(lookupFolder.binding.collectionMemberId);
86006
+ if (lookupFolder?.binding != null && memberById2 === null) {
86007
+ memberById2 = new Map(
86008
+ (args.members ?? []).map((member) => [member.id, member])
86009
+ );
86010
+ }
86011
+ const lookupCollection = lookupFolder?.binding == null ? void 0 : memberById2?.get(lookupFolder.binding.collectionMemberId);
86084
86012
  const lookupBinding = lookupParameterId !== void 0 && isMemberListBase(lookupCollection) ? {
86085
86013
  [lookupParameterId]: {
86086
86014
  kind: "member",
@@ -86118,14 +86046,37 @@ function withVariantOwnershipRoots(document, variants) {
86118
86046
  classes: document.classes,
86119
86047
  members: document.members
86120
86048
  });
86121
- if (bindingMembers.length === 0) return { document, roots };
86049
+ const rootMembersByValueId = new Map(
86050
+ roots.map((root) => [root.valueId, root.member])
86051
+ );
86052
+ if (bindingMembers.length === 0) {
86053
+ return { document, roots, rootMembersByValueId };
86054
+ }
86122
86055
  return {
86123
86056
  document: {
86124
86057
  ...document,
86125
86058
  members: [...document.members, ...bindingMembers]
86126
86059
  },
86127
- roots
86060
+ roots,
86061
+ rootMembersByValueId
86062
+ };
86063
+ }
86064
+ function createVariantMaterializedValueGraphContext(document, variants, rows = new Map(
86065
+ document.values.map((value) => [value.id, value])
86066
+ )) {
86067
+ const scopedDocument = {
86068
+ ...document,
86069
+ values: [...rows.values()]
86128
86070
  };
86071
+ const scope = withVariantOwnershipRoots(
86072
+ scopedDocument,
86073
+ variants.filter((variant) => rows.has(variant.valueId))
86074
+ );
86075
+ return new MaterializedValueGraphContext(
86076
+ scope.document,
86077
+ rows,
86078
+ scope.rootMembersByValueId
86079
+ );
86129
86080
  }
86130
86081
  function collectVariantGraphValueIds(args) {
86131
86082
  const collected = /* @__PURE__ */ new Set();
@@ -88956,6 +88907,11 @@ function readMember(value) {
88956
88907
  function readClass(value) {
88957
88908
  if (!isRecord6(value)) throw new Error("Class record is not an object.");
88958
88909
  if (typeof value.id !== "string") throw new Error("Class id is invalid.");
88910
+ if (hasRetiredConstructorProjectionsTombstone(value)) {
88911
+ throw new Error(
88912
+ `Class "${value.id}" cannot declare retired field "constructorProjections".`
88913
+ );
88914
+ }
88959
88915
  if (typeof value.name !== "string") {
88960
88916
  throw new Error(`Class "${value.id}" name is invalid.`);
88961
88917
  }
@@ -90725,26 +90681,6 @@ function assertOpaqueConstructorValid(declaredConstructor) {
90725
90681
  assertOpaqueConstructorBaseClauseValid(declaredConstructor);
90726
90682
  return argumentTypes;
90727
90683
  }
90728
- function assertOpaqueConstructorProjectionsDisjoint(declaredConstructor, owner) {
90729
- const projections = owner.constructorProjections;
90730
- if (projections === void 0 || projections === null) return;
90731
- if (!Array.isArray(projections)) {
90732
- throw new Error(`Class "${owner.id}" constructorProjections are invalid.`);
90733
- }
90734
- const projected = new Set(
90735
- projections.filter(
90736
- (projection) => isRecord6(projection) && typeof projection.parameterName === "string"
90737
- ).map((projection) => projection.parameterName.toLowerCase())
90738
- );
90739
- if (projected.size === 0) return;
90740
- for (const argument2 of declaredConstructor.argumentTypes) {
90741
- if (!isRecord6(argument2) || typeof argument2.name !== "string") continue;
90742
- if (!projected.has(argument2.name.toLowerCase())) continue;
90743
- throw new Error(
90744
- `Constructor "${declaredConstructor.id}" declares parameter "${argument2.name}", which is also a constructor projection argument on class "${owner.id}"; a call site could not tell the two apart.`
90745
- );
90746
- }
90747
- }
90748
90684
  function assertOpaqueRequiredConstructorValid(schemaClass2, constructorsById) {
90749
90685
  const requiredConstructorId2 = schemaClass2.requiredConstructorId;
90750
90686
  if (requiredConstructorId2 === void 0 || requiredConstructorId2 === null) {
@@ -90813,7 +90749,6 @@ function assertOpaqueConstructorsValid(constructors, classesById2) {
90813
90749
  `Class "${owner.id}" names constructor "${declaredConstructor.id}" as its required constructor and also lists it in constructorIds; the required constructor is not a declared member.`
90814
90750
  );
90815
90751
  }
90816
- assertOpaqueConstructorProjectionsDisjoint(declaredConstructor, owner);
90817
90752
  const siblings = constructorsByClassId.get(declaredConstructor.classId) ?? [];
90818
90753
  siblings.push(declaredConstructor);
90819
90754
  constructorsByClassId.set(declaredConstructor.classId, siblings);
@@ -91075,6 +91010,7 @@ var init_projectInterfaceValidation = __esm({
91075
91010
  "use strict";
91076
91011
  init_projectVariantValidation();
91077
91012
  init_src();
91013
+ init_classes();
91078
91014
  NEO_OBJECT_WORLD_KIND = "object";
91079
91015
  READ_ONLY_SYNTHETIC_VALUE_ID_PREFIX2 = "__neo_readonly_default:";
91080
91016
  REJECTED_OPAQUE_CONSTRUCTOR_KEYS = [
@@ -94939,7 +94875,10 @@ function attachPreparedValuePlacements(prepared, document) {
94939
94875
  (change) => change.recordKind === "value" && change.operation === "create"
94940
94876
  );
94941
94877
  if (creates.length === 0) return;
94942
- const materializedGraph = new MaterializedValueGraphContext(document);
94878
+ const materializedGraph = createVariantMaterializedValueGraphContext(
94879
+ document,
94880
+ document.variants ?? []
94881
+ );
94943
94882
  const constructorEdges = [];
94944
94883
  for (const edges of materializedGraph.edgesByOwnerValueId.values()) {
94945
94884
  for (const edge of edges) {
@@ -95010,7 +94949,11 @@ function attachPreparedConstructorAggregateEdges(prepared, document) {
95010
94949
  }
95011
94950
  }
95012
94951
  }
95013
- const graph = needsGraph ? new MaterializedValueGraphContext(document, changedValueRows) : null;
94952
+ const graph = !needsGraph ? null : createVariantMaterializedValueGraphContext(
94953
+ document,
94954
+ document.variants ?? [],
94955
+ changedValueRows
94956
+ );
95014
94957
  for (const change of valueChanges) {
95015
94958
  change.constructorAggregateEdges = [
95016
94959
  ...graph?.edgesByOwnerValueId.get(change.recordId) ?? []
@@ -95066,13 +95009,16 @@ function materializePreparedInstanceInitializers(args) {
95066
95009
  const existingValueById = new Map(
95067
95010
  args.document.values.map((value) => [value.id, value])
95068
95011
  );
95069
- let currentGraph = null;
95070
- const requireCurrentGraph = () => currentGraph ??= new MaterializedValueGraphContext(args.document);
95071
95012
  const rootKinds = /* @__PURE__ */ new Map();
95072
95013
  const materializationScope = withVariantOwnershipRoots(
95073
95014
  compiledDocument,
95074
95015
  compiledDocument.variants ?? []
95075
95016
  );
95017
+ let currentGraph = null;
95018
+ const requireCurrentGraph = () => currentGraph ??= createVariantMaterializedValueGraphContext(
95019
+ materializationScope.document,
95020
+ materializationScope.document.variants ?? []
95021
+ );
95076
95022
  const owners = resolveSemanticOwnerMembersForValues(
95077
95023
  materializationScope.document,
95078
95024
  new Set(sites.keys()),
@@ -95106,7 +95052,11 @@ function materializePreparedInstanceInitializers(args) {
95106
95052
  });
95107
95053
  if (existingConstructedRoot) {
95108
95054
  if (!isLiteralValueContent(materialized.root) || existingRoot.classId !== materialized.root.classId || !replayedCreationDataMatches({
95109
- currentDocument: args.document,
95055
+ // The synthetic variant binding members are part of the ownership
95056
+ // scope that compiled and evaluated this initializer. Stored replay
95057
+ // closes its generic slot from the same ephemeral member id, so its
95058
+ // expansion must read that scoped document too.
95059
+ currentDocument: materializationScope.document,
95110
95060
  currentGraph: requireCurrentGraph(),
95111
95061
  currentRoot: existingRoot,
95112
95062
  rootMember: member,
@@ -95253,7 +95203,10 @@ function reconcileInitializerMaterializationTransport(args) {
95253
95203
  allServerIds.add(change.recordId);
95254
95204
  }
95255
95205
  }
95256
- const graph = new MaterializedValueGraphContext(args.document);
95206
+ const graph = createVariantMaterializedValueGraphContext(
95207
+ args.document,
95208
+ args.document.variants ?? []
95209
+ );
95257
95210
  const serverOwners = graph.ownersForValues(allServerIds);
95258
95211
  for (const sourceValueId of serverRootIds) {
95259
95212
  const local = roots.get(sourceValueId);
@@ -95346,12 +95299,14 @@ function constructorArgumentsSemanticallyEqual(args) {
95346
95299
  const replayRows = new Map(args.currentGraph.valuesById);
95347
95300
  replayRows.set(args.replayRoot.id, args.replayRoot);
95348
95301
  for (const row of args.replayCreated) replayRows.set(row.id, row);
95349
- const currentNormalized = new MaterializedValueGraphContext(
95302
+ const currentNormalized = createVariantMaterializedValueGraphContext(
95350
95303
  args.currentDocument,
95304
+ args.currentDocument.variants ?? [],
95351
95305
  currentRows
95352
95306
  ).normalizeConstructorArguments(args.current, args.currentRoot);
95353
- const replayNormalized = new MaterializedValueGraphContext(
95307
+ const replayNormalized = createVariantMaterializedValueGraphContext(
95354
95308
  args.currentDocument,
95309
+ args.currentDocument.variants ?? [],
95355
95310
  replayRows
95356
95311
  ).normalizeConstructorArguments(args.replay, args.replayRoot);
95357
95312
  return canonicallyEqual2(currentNormalized, replayNormalized);
@@ -101351,7 +101306,7 @@ function classBelongsToAnimationFamily(classes, classId) {
101351
101306
  function prospectiveAnimationDocumentV4(records2) {
101352
101307
  const candidates = [...records2];
101353
101308
  const hasAnimationSchema = candidates.some(
101354
- (record3) => record3.recordKind === "class" && (Array.isArray(record3.data.constructorProjections) || declaresAnimationWorldKind(record3.data.system))
101309
+ (record3) => record3.recordKind === "class" && declaresAnimationWorldKind(record3.data.system)
101355
101310
  );
101356
101311
  if (!hasAnimationSchema) return null;
101357
101312
  const memberRecords = new Map(
@@ -104998,14 +104953,6 @@ function lowerRowBackedDefault(context, member, backed, baseData3, binding) {
104998
104953
  const assignmentSlices = objectInitializerSlices(binding.initializer);
104999
104954
  for (const assignment of expression.initializer ?? []) {
105000
104955
  const childMember = classMemberByName(context, classId, assignment.name);
105001
- if (inheritedLegacyConstructorProjections(
105002
- context.classes,
105003
- schemaClass2.id
105004
- ).some((projection) => projection.memberId === childMember.id)) {
105005
- throw new Error(
105006
- `Default value ${binding.label}.${assignment.name} is constructor-projected and must be set through its named constructor argument.`
105007
- );
105008
- }
105009
104956
  const childValueMember = recursivePartialMember(member, childMember);
105010
104957
  const childSlice = assignmentSlices.get(assignment.name);
105011
104958
  const existingId = isObjectRecord2(baseBody) ? baseBody[assignment.name] : void 0;
@@ -105645,14 +105592,6 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
105645
105592
  effectiveClass.id,
105646
105593
  assignment.name
105647
105594
  );
105648
- if (!partial && inheritedLegacyConstructorProjections(
105649
- context.classes,
105650
- effectiveClass.id
105651
- ).some((projection) => projection.memberId === childMember.id)) {
105652
- throw new Error(
105653
- `Class value ${path}.${assignment.name} is constructor-projected and must be set through its named constructor argument.`
105654
- );
105655
- }
105656
105595
  const childPath = `${path}.${assignment.name}`;
105657
105596
  const childId = lowerSeedChild(
105658
105597
  context,
@@ -106417,14 +106356,6 @@ function lowerClassValue(context, member, expression, base, source, outerEnviron
106417
106356
  }
106418
106357
  for (const assignment of expression.initializer ?? []) {
106419
106358
  const childMember = classMemberByName(context, classId, assignment.name);
106420
- if (!partial && inheritedLegacyConstructorProjections(
106421
- context.classes,
106422
- schemaClass2.id
106423
- ).some((projection) => projection.memberId === childMember.id)) {
106424
- throw new Error(
106425
- `Class value ${String(base.id)}.${assignment.name} is constructor-projected and must be set through its named constructor argument.`
106426
- );
106427
- }
106428
106359
  const childId = baseBody[assignment.name];
106429
106360
  if (typeof childId !== "string") {
106430
106361
  const symbolId2 = sourceValueSymbol(context, assignment.value);
@@ -106750,24 +106681,10 @@ function classInheritanceChain(classes, classId) {
106750
106681
  }
106751
106682
  return chain;
106752
106683
  }
106753
- function inheritedLegacyConstructorProjections(classes, classId) {
106754
- const resolved = [];
106755
- const claimed = /* @__PURE__ */ new Set();
106756
- for (const schemaClass2 of classInheritanceChain(classes, classId)) {
106757
- for (const projection of schemaClass2.constructorProjections ?? []) {
106758
- if (claimed.has(projection.parameterName)) continue;
106759
- claimed.add(projection.parameterName);
106760
- resolved.push(projection);
106761
- }
106762
- }
106763
- return resolved;
106764
- }
106765
106684
  function effectiveConstructorProjections(classes, constructors, members, classId) {
106766
106685
  const schemaClass2 = classes.get(classId);
106767
106686
  const requiredId = schemaClass2?.requiredConstructorId;
106768
- if (schemaClass2 === void 0 || requiredId === void 0) {
106769
- return inheritedLegacyConstructorProjections(classes, classId);
106770
- }
106687
+ if (schemaClass2 === void 0 || requiredId === void 0) return [];
106771
106688
  const required2 = constructors.get(requiredId);
106772
106689
  if (required2 === void 0) return [];
106773
106690
  const projected = requiredConstructorProjectionMap(
@@ -107015,7 +106932,10 @@ function inferAnimationChildOverrideLowerEnvironment(context, schemaClass2, expr
107015
106932
  return inherited;
107016
106933
  }
107017
106934
  const parameter4 = schemaClass2.genericParameters[0];
107018
- const parameterName = schemaClass2.constructorProjections?.[0]?.parameterName ?? requiredConstructorFirstParameterName(context, schemaClass2);
106935
+ const parameterName = requiredConstructorFirstParameterName(
106936
+ context,
106937
+ schemaClass2
106938
+ );
107019
106939
  if (parameter4 === void 0 || parameterName === null) return inherited;
107020
106940
  const argumentIndex = expression.argumentNames?.findIndex(
107021
106941
  (name) => name === parameterName
@@ -120632,8 +120552,8 @@ var init_registry2 = __esm({
120632
120552
  "use strict";
120633
120553
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
120634
120554
  formatVersion: 3,
120635
- contractVersion: "3.14",
120636
- cliVersion: "0.38.3",
120555
+ contractVersion: "3.15",
120556
+ cliVersion: "0.38.4",
120637
120557
  projectFileUploadBatchSize: 32,
120638
120558
  documentRecords: {
120639
120559
  member: {
@@ -120739,7 +120659,6 @@ var init_registry2 = __esm({
120739
120659
  "allowedStorageKeys",
120740
120660
  "genericParams",
120741
120661
  "extendsGenericBindings",
120742
- "constructorProjections",
120743
120662
  "constructorIds",
120744
120663
  "requiredConstructorId",
120745
120664
  "targetMemberId"
@@ -120757,7 +120676,6 @@ var init_registry2 = __esm({
120757
120676
  allowedStorageKeys: "nullIsAbsent",
120758
120677
  genericParams: "nullOrEmptyArrayIsAbsent",
120759
120678
  extendsGenericBindings: "nullOrEmptyObjectIsAbsent",
120760
- constructorProjections: "nullOrEmptyArrayIsAbsent",
120761
120679
  constructorIds: "nullOrEmptyArrayIsAbsent",
120762
120680
  requiredConstructorId: "nullIsAbsent"
120763
120681
  }
@@ -127360,7 +127278,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
127360
127278
  async function main() {
127361
127279
  const args = parseArgs(process.argv.slice(2));
127362
127280
  if (args.command === "--version") {
127363
- console.log("0.38.3");
127281
+ console.log("0.38.4");
127364
127282
  return;
127365
127283
  }
127366
127284
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {