@neocompose/cli 0.77.0 → 0.77.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/neo.mjs +1282 -533
- package/dist/test-worker.mjs +517 -268
- package/package.json +1 -1
- package/skills/neocompose-cli/SKILL.md +1 -1
- package/skills/neocompose-cli/references/cli-development.md +1 -1
- package/skills/neocompose-cli/references/declarations-and-construction.md +21 -2
- package/skills/neocompose-cli/references/neoscript.md +9 -0
package/dist/test-worker.mjs
CHANGED
|
@@ -1461,36 +1461,36 @@ function isNeoSchemaClass(value) {
|
|
|
1461
1461
|
}
|
|
1462
1462
|
|
|
1463
1463
|
// ../packages/models/src/members/member-kind-enum.ts
|
|
1464
|
-
var MemberKind = /* @__PURE__ */ ((
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
return
|
|
1464
|
+
var MemberKind = /* @__PURE__ */ ((MemberKind7) => {
|
|
1465
|
+
MemberKind7[MemberKind7["Null"] = 0] = "Null";
|
|
1466
|
+
MemberKind7[MemberKind7["Bool"] = 1] = "Bool";
|
|
1467
|
+
MemberKind7[MemberKind7["Int"] = 2] = "Int";
|
|
1468
|
+
MemberKind7[MemberKind7["String"] = 3] = "String";
|
|
1469
|
+
MemberKind7[MemberKind7["Float"] = 4] = "Float";
|
|
1470
|
+
MemberKind7[MemberKind7["Dictionary"] = 5] = "Dictionary";
|
|
1471
|
+
MemberKind7[MemberKind7["List"] = 6] = "List";
|
|
1472
|
+
MemberKind7[MemberKind7["Class"] = 7] = "Class";
|
|
1473
|
+
MemberKind7[MemberKind7["Enum"] = 8] = "Enum";
|
|
1474
|
+
MemberKind7[MemberKind7["Lookup"] = 9] = "Lookup";
|
|
1475
|
+
MemberKind7[MemberKind7["NSProperty"] = 10] = "NSProperty";
|
|
1476
|
+
MemberKind7[MemberKind7["Sprite"] = 11] = "Sprite";
|
|
1477
|
+
MemberKind7[MemberKind7["Audio"] = 12] = "Audio";
|
|
1478
|
+
MemberKind7[MemberKind7["Function"] = 13] = "Function";
|
|
1479
|
+
MemberKind7[MemberKind7["Vector2"] = 14] = "Vector2";
|
|
1480
|
+
MemberKind7[MemberKind7["Vector2Int"] = 15] = "Vector2Int";
|
|
1481
|
+
MemberKind7[MemberKind7["Vector3"] = 16] = "Vector3";
|
|
1482
|
+
MemberKind7[MemberKind7["Vector3Int"] = 17] = "Vector3Int";
|
|
1483
|
+
MemberKind7[MemberKind7["DialogueLookup"] = 18] = "DialogueLookup";
|
|
1484
|
+
MemberKind7[MemberKind7["Color"] = 19] = "Color";
|
|
1485
|
+
MemberKind7[MemberKind7["Decimal"] = 20] = "Decimal";
|
|
1486
|
+
MemberKind7[MemberKind7["Generic"] = 21] = "Generic";
|
|
1487
|
+
MemberKind7[MemberKind7["Interface"] = 22] = "Interface";
|
|
1488
|
+
MemberKind7[MemberKind7["NSFunction"] = 23] = "NSFunction";
|
|
1489
|
+
MemberKind7[MemberKind7["FunctionRef"] = 24] = "FunctionRef";
|
|
1490
|
+
MemberKind7[MemberKind7["NSDelegate"] = 25] = "NSDelegate";
|
|
1491
|
+
MemberKind7[MemberKind7["NSAction"] = 26] = "NSAction";
|
|
1492
|
+
MemberKind7[MemberKind7["Variant"] = 27] = "Variant";
|
|
1493
|
+
return MemberKind7;
|
|
1494
1494
|
})(MemberKind || {});
|
|
1495
1495
|
|
|
1496
1496
|
// ../packages/models/src/members/member-kind-taxonomy.ts
|
|
@@ -4046,6 +4046,13 @@ function isNSVoidBody(value) {
|
|
|
4046
4046
|
function parameterHasDefault(argument2) {
|
|
4047
4047
|
return argument2.defaultValue !== void 0;
|
|
4048
4048
|
}
|
|
4049
|
+
function unnamedArgumentTypes(argumentTypes) {
|
|
4050
|
+
return argumentTypes.map((argument2) => {
|
|
4051
|
+
const { name, ...typeInfo } = argument2;
|
|
4052
|
+
void name;
|
|
4053
|
+
return typeInfo;
|
|
4054
|
+
});
|
|
4055
|
+
}
|
|
4049
4056
|
function hasAnyParameterDefault(argumentTypes) {
|
|
4050
4057
|
return argumentTypes.some(parameterHasDefault);
|
|
4051
4058
|
}
|
|
@@ -4124,6 +4131,15 @@ function typeInfosInvariantlyEqual(left, right) {
|
|
|
4124
4131
|
if (left.keyEnumId !== right.keyEnumId) return false;
|
|
4125
4132
|
return typeInfosInvariantlyEqual(left.entryTypeInfo, right.entryTypeInfo);
|
|
4126
4133
|
}
|
|
4134
|
+
if (left.type === 25 /* NSDelegate */ && right.type === 25 /* NSDelegate */) {
|
|
4135
|
+
if (!typeInfosInvariantlyEqual(left.returnTypeInfo, right.returnTypeInfo)) {
|
|
4136
|
+
return false;
|
|
4137
|
+
}
|
|
4138
|
+
if (left.argumentTypes.length !== right.argumentTypes.length) return false;
|
|
4139
|
+
return left.argumentTypes.every(
|
|
4140
|
+
(argument2, index) => typeInfosInvariantlyEqual(argument2, right.argumentTypes[index])
|
|
4141
|
+
);
|
|
4142
|
+
}
|
|
4127
4143
|
if (left.type === 26 /* NSAction */ && right.type === 26 /* NSAction */) {
|
|
4128
4144
|
if (left.argumentTypes.length !== right.argumentTypes.length) return false;
|
|
4129
4145
|
return left.argumentTypes.every(
|
|
@@ -8632,12 +8648,6 @@ function resolveParamAtChainIndex(chain, declarerIndex, paramId) {
|
|
|
8632
8648
|
}
|
|
8633
8649
|
return { kind: "unbound", paramId: cursor };
|
|
8634
8650
|
}
|
|
8635
|
-
function isClosedClass(classId, classes, draft) {
|
|
8636
|
-
for (const entry of resolveGenericEnv(classId, classes, draft).values()) {
|
|
8637
|
-
if (entry.kind === "unbound") return false;
|
|
8638
|
-
}
|
|
8639
|
-
return true;
|
|
8640
|
-
}
|
|
8641
8651
|
function resolveInstanceEnv(effectiveClassId, classArguments2, classes) {
|
|
8642
8652
|
const env = resolveGenericEnv(effectiveClassId, classes);
|
|
8643
8653
|
if (classArguments2 === void 0 || classArguments2 === null) {
|
|
@@ -8649,6 +8659,10 @@ function resolveInstanceEnv(effectiveClassId, classArguments2, classes) {
|
|
|
8649
8659
|
if (existing !== void 0 && existing.kind !== "unbound") continue;
|
|
8650
8660
|
env.set(paramId, { kind: "member", memberId: arg.memberId });
|
|
8651
8661
|
}
|
|
8662
|
+
closeForwardedGenericParams(env);
|
|
8663
|
+
return env;
|
|
8664
|
+
}
|
|
8665
|
+
function closeForwardedGenericParams(env) {
|
|
8652
8666
|
for (const [paramId, entry] of env) {
|
|
8653
8667
|
if (entry.kind !== "unbound") continue;
|
|
8654
8668
|
const seen = /* @__PURE__ */ new Set([paramId]);
|
|
@@ -8664,7 +8678,6 @@ function resolveInstanceEnv(effectiveClassId, classArguments2, classes) {
|
|
|
8664
8678
|
targetParamId = target.paramId;
|
|
8665
8679
|
}
|
|
8666
8680
|
}
|
|
8667
|
-
return env;
|
|
8668
8681
|
}
|
|
8669
8682
|
function firstUnboundParamId(env) {
|
|
8670
8683
|
for (const entry of env.values()) {
|
|
@@ -9098,10 +9111,13 @@ function typeInfoFromArgumentSignature(signature) {
|
|
|
9098
9111
|
...dictionarySignature.keyEnumId === void 0 ? {} : { keyEnumId: dictionarySignature.keyEnumId }
|
|
9099
9112
|
};
|
|
9100
9113
|
}
|
|
9114
|
+
if (signature.type === 25 /* NSDelegate */) {
|
|
9115
|
+
return signature;
|
|
9116
|
+
}
|
|
9101
9117
|
const typeInfo = { type: signature.type, required: signature.required };
|
|
9102
9118
|
if (!isNSTypeInfo(typeInfo)) {
|
|
9103
9119
|
throw new Error(
|
|
9104
|
-
`substituteMember: generic binding kind ${signature.type} cannot appear in a NeoScript callable type.`
|
|
9120
|
+
`substituteMember: generic binding kind ${MemberKind[signature.type] ?? signature.type} cannot appear in a NeoScript callable type.`
|
|
9105
9121
|
);
|
|
9106
9122
|
}
|
|
9107
9123
|
return typeInfo;
|
|
@@ -9191,6 +9207,20 @@ function typeArgumentSignatureOfMember(member, env, members, seen = /* @__PURE__
|
|
|
9191
9207
|
entry: entrySignature(resolved.entryMemberId, env, members, seen)
|
|
9192
9208
|
};
|
|
9193
9209
|
}
|
|
9210
|
+
if (isMemberDelegateBase(resolved)) {
|
|
9211
|
+
return {
|
|
9212
|
+
type: 25 /* NSDelegate */,
|
|
9213
|
+
required,
|
|
9214
|
+
returnTypeInfo: substituteNestedTypeInfo(
|
|
9215
|
+
resolved.returnTypeInfo,
|
|
9216
|
+
env,
|
|
9217
|
+
members
|
|
9218
|
+
),
|
|
9219
|
+
argumentTypes: unnamedArgumentTypes(resolved.argumentTypes).map(
|
|
9220
|
+
(argument2) => substituteNestedTypeInfo(argument2, env, members)
|
|
9221
|
+
)
|
|
9222
|
+
};
|
|
9223
|
+
}
|
|
9194
9224
|
if (isMemberStringBase(resolved)) {
|
|
9195
9225
|
return {
|
|
9196
9226
|
type: 3 /* String */,
|
|
@@ -9278,6 +9308,12 @@ function signaturesEqual(a, b) {
|
|
|
9278
9308
|
if (ad.keyEnumId !== bd.keyEnumId) return false;
|
|
9279
9309
|
return signaturesEqual(ad.entry, bd.entry);
|
|
9280
9310
|
}
|
|
9311
|
+
if (a.type === 25 /* NSDelegate */ && b.type === 25 /* NSDelegate */) {
|
|
9312
|
+
return typeInfosInvariantlyEqual(
|
|
9313
|
+
a,
|
|
9314
|
+
b
|
|
9315
|
+
);
|
|
9316
|
+
}
|
|
9281
9317
|
return true;
|
|
9282
9318
|
}
|
|
9283
9319
|
function constructedSlotAccepts(slotMember, valueClassId, contextEnv, classes, members) {
|
|
@@ -9732,6 +9768,14 @@ function suppliedValueSettlesConstruction(member, value, context, path) {
|
|
|
9732
9768
|
}
|
|
9733
9769
|
return valueSettlesConstruction(member, { value }, context, path);
|
|
9734
9770
|
}
|
|
9771
|
+
function genericParameterName(parameterId, classes) {
|
|
9772
|
+
for (const neoClass of classes) {
|
|
9773
|
+
for (const parameter3 of neoClass.genericParams ?? []) {
|
|
9774
|
+
if (parameter3.id === parameterId) return parameter3.name;
|
|
9775
|
+
}
|
|
9776
|
+
}
|
|
9777
|
+
return void 0;
|
|
9778
|
+
}
|
|
9735
9779
|
function resolveConstructionTypeArguments(typeArguments, document2) {
|
|
9736
9780
|
if (typeArguments === void 0) return void 0;
|
|
9737
9781
|
const bindings = {};
|
|
@@ -9756,8 +9800,10 @@ function resolveConstructionTypeArguments(typeArguments, document2) {
|
|
|
9756
9800
|
}
|
|
9757
9801
|
}
|
|
9758
9802
|
if (binding === void 0) {
|
|
9803
|
+
const parameter3 = genericParameterName(parameterId, document2.classes) ?? parameterId;
|
|
9804
|
+
const kind = typeof typeInfo.type === "number" ? MemberKind[typeInfo.type] : typeInfo.type;
|
|
9759
9805
|
throw new Error(
|
|
9760
|
-
`Construction type argument "${
|
|
9806
|
+
`Construction type argument "${parameter3}" (${kind}) has no matching type descriptor in the document.`
|
|
9761
9807
|
);
|
|
9762
9808
|
}
|
|
9763
9809
|
bindings[parameterId] = {
|
|
@@ -12943,10 +12989,10 @@ function compiledConstructionTypeMembers(members, bodies, projectId) {
|
|
|
12943
12989
|
} else if (type.type === 25 /* NSDelegate */) {
|
|
12944
12990
|
return {
|
|
12945
12991
|
returnTypeInfo: type.returnTypeInfo,
|
|
12946
|
-
argumentTypes: type.argumentTypes
|
|
12992
|
+
argumentTypes: namedArguments(type.argumentTypes)
|
|
12947
12993
|
};
|
|
12948
12994
|
} else if (type.type === 26 /* NSAction */) {
|
|
12949
|
-
return { argumentTypes: type.argumentTypes };
|
|
12995
|
+
return { argumentTypes: namedArguments(type.argumentTypes) };
|
|
12950
12996
|
} else if (type.type === 22 /* Interface */ || type.type === 9 /* Lookup */ || type.type === 18 /* DialogueLookup */) {
|
|
12951
12997
|
return null;
|
|
12952
12998
|
} else {
|
|
@@ -12977,6 +13023,12 @@ function compiledConstructionTypeMembers(members, bodies, projectId) {
|
|
|
12977
13023
|
for (const body of bodies) visit(body);
|
|
12978
13024
|
return created;
|
|
12979
13025
|
}
|
|
13026
|
+
function namedArguments(argumentTypes) {
|
|
13027
|
+
return argumentTypes.map((type, index) => ({
|
|
13028
|
+
...type,
|
|
13029
|
+
name: `p${index + 1}`
|
|
13030
|
+
}));
|
|
13031
|
+
}
|
|
12980
13032
|
function withCompiledConstructionTypes(document2, body) {
|
|
12981
13033
|
const members = document2.members;
|
|
12982
13034
|
const projectId = getField(document2.project, "id");
|
|
@@ -13923,6 +13975,132 @@ function changeListenerWriteEdit(write) {
|
|
|
13923
13975
|
return write.operation === "clear" ? { kind: "replace", targets: [] } : { kind: write.operation, target: write.listener };
|
|
13924
13976
|
}
|
|
13925
13977
|
|
|
13978
|
+
// ../packages/models/src/classes/constructor-parameter-settlement.ts
|
|
13979
|
+
function createConstructorSettlementResolver(view) {
|
|
13980
|
+
const classesById = new Map(
|
|
13981
|
+
view.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
13982
|
+
);
|
|
13983
|
+
const membersById = new Map(
|
|
13984
|
+
view.members.map((member) => [member.id, member])
|
|
13985
|
+
);
|
|
13986
|
+
const constructorsById = new Map(
|
|
13987
|
+
(view.constructors ?? []).map((constructor) => [
|
|
13988
|
+
constructor.id,
|
|
13989
|
+
constructor
|
|
13990
|
+
])
|
|
13991
|
+
);
|
|
13992
|
+
const directResultByClassAndParameter = /* @__PURE__ */ new Map();
|
|
13993
|
+
const recordedResultByConstructorAndParameter = /* @__PURE__ */ new Map();
|
|
13994
|
+
const directSettlement = (classId, parameterName) => {
|
|
13995
|
+
const cacheKey = `${classId}\0${parameterName}`;
|
|
13996
|
+
if (directResultByClassAndParameter.has(cacheKey)) {
|
|
13997
|
+
return directResultByClassAndParameter.get(cacheKey) ?? null;
|
|
13998
|
+
}
|
|
13999
|
+
const visited = /* @__PURE__ */ new Set();
|
|
14000
|
+
let currentId = classId;
|
|
14001
|
+
while (currentId !== null && !visited.has(currentId)) {
|
|
14002
|
+
visited.add(currentId);
|
|
14003
|
+
const schemaClass2 = classesById.get(currentId);
|
|
14004
|
+
if (schemaClass2 === void 0) break;
|
|
14005
|
+
for (const [schemaKey, memberId] of Object.entries(
|
|
14006
|
+
schemaClass2.schema ?? {}
|
|
14007
|
+
)) {
|
|
14008
|
+
if (typeof memberId !== "string") continue;
|
|
14009
|
+
const member = membersById.get(memberId);
|
|
14010
|
+
const defaultRecord = asRecord(member?.defaultValue);
|
|
14011
|
+
const initRecord = asRecord(defaultRecord?.init);
|
|
14012
|
+
if (initRecord !== null && typeof initRecord.code === "string" && initRecord.code.trim() === parameterName) {
|
|
14013
|
+
const result = { schemaKey, memberId };
|
|
14014
|
+
directResultByClassAndParameter.set(cacheKey, result);
|
|
14015
|
+
return result;
|
|
14016
|
+
}
|
|
14017
|
+
}
|
|
14018
|
+
currentId = schemaClass2.extendsClassId ?? null;
|
|
14019
|
+
}
|
|
14020
|
+
directResultByClassAndParameter.set(cacheKey, null);
|
|
14021
|
+
return null;
|
|
14022
|
+
};
|
|
14023
|
+
const memberIdForSchemaKey = (classId, schemaKey) => {
|
|
14024
|
+
const visited = /* @__PURE__ */ new Set();
|
|
14025
|
+
let currentId = classId;
|
|
14026
|
+
while (currentId !== null && !visited.has(currentId)) {
|
|
14027
|
+
visited.add(currentId);
|
|
14028
|
+
const schemaClass2 = classesById.get(currentId);
|
|
14029
|
+
if (schemaClass2 === void 0) return null;
|
|
14030
|
+
const memberId = schemaClass2.schema?.[schemaKey];
|
|
14031
|
+
if (typeof memberId === "string") return memberId;
|
|
14032
|
+
currentId = schemaClass2.extendsClassId ?? null;
|
|
14033
|
+
}
|
|
14034
|
+
return null;
|
|
14035
|
+
};
|
|
14036
|
+
const recordedSettlement = (classId, parameterName, constructorId, resolving) => {
|
|
14037
|
+
const cacheKey = `${classId}\0${constructorId}\0${parameterName}`;
|
|
14038
|
+
if (recordedResultByConstructorAndParameter.has(cacheKey)) {
|
|
14039
|
+
return recordedResultByConstructorAndParameter.get(cacheKey) ?? null;
|
|
14040
|
+
}
|
|
14041
|
+
if (resolving.has(cacheKey)) return null;
|
|
14042
|
+
const constructor = constructorsById.get(constructorId);
|
|
14043
|
+
if (constructor?.classId !== classId) {
|
|
14044
|
+
recordedResultByConstructorAndParameter.set(cacheKey, null);
|
|
14045
|
+
return null;
|
|
14046
|
+
}
|
|
14047
|
+
const direct = directSettlement(classId, parameterName);
|
|
14048
|
+
if (direct !== null) {
|
|
14049
|
+
recordedResultByConstructorAndParameter.set(cacheKey, direct);
|
|
14050
|
+
return direct;
|
|
14051
|
+
}
|
|
14052
|
+
const schemaClass2 = classesById.get(classId);
|
|
14053
|
+
const baseClassId = schemaClass2?.extendsClassId;
|
|
14054
|
+
if (typeof baseClassId !== "string") {
|
|
14055
|
+
recordedResultByConstructorAndParameter.set(cacheKey, null);
|
|
14056
|
+
return null;
|
|
14057
|
+
}
|
|
14058
|
+
for (const field of constructor.baseInitializerFields ?? []) {
|
|
14059
|
+
const record4 = asRecord(field);
|
|
14060
|
+
if (typeof record4?.name !== "string" || typeof record4.code !== "string" || record4.code.trim() !== parameterName) {
|
|
14061
|
+
continue;
|
|
14062
|
+
}
|
|
14063
|
+
const memberId = memberIdForSchemaKey(baseClassId, record4.name);
|
|
14064
|
+
if (memberId !== null) {
|
|
14065
|
+
const result = { schemaKey: record4.name, memberId };
|
|
14066
|
+
recordedResultByConstructorAndParameter.set(cacheKey, result);
|
|
14067
|
+
return result;
|
|
14068
|
+
}
|
|
14069
|
+
}
|
|
14070
|
+
const baseConstructorId = classesById.get(baseClassId)?.requiredConstructorId;
|
|
14071
|
+
if (typeof baseConstructorId !== "string") {
|
|
14072
|
+
recordedResultByConstructorAndParameter.set(cacheKey, null);
|
|
14073
|
+
return null;
|
|
14074
|
+
}
|
|
14075
|
+
resolving.add(cacheKey);
|
|
14076
|
+
for (const argument2 of constructor.baseArguments ?? []) {
|
|
14077
|
+
const record4 = asRecord(argument2);
|
|
14078
|
+
if (typeof record4?.name !== "string" || typeof record4.code !== "string" || record4.code.trim() !== parameterName) {
|
|
14079
|
+
continue;
|
|
14080
|
+
}
|
|
14081
|
+
const result = recordedSettlement(
|
|
14082
|
+
baseClassId,
|
|
14083
|
+
record4.name,
|
|
14084
|
+
baseConstructorId,
|
|
14085
|
+
resolving
|
|
14086
|
+
);
|
|
14087
|
+
resolving.delete(cacheKey);
|
|
14088
|
+
recordedResultByConstructorAndParameter.set(cacheKey, result);
|
|
14089
|
+
return result;
|
|
14090
|
+
}
|
|
14091
|
+
resolving.delete(cacheKey);
|
|
14092
|
+
recordedResultByConstructorAndParameter.set(cacheKey, null);
|
|
14093
|
+
return null;
|
|
14094
|
+
};
|
|
14095
|
+
return (classId, parameterName, constructorId) => constructorId === void 0 ? directSettlement(classId, parameterName) : recordedSettlement(classId, parameterName, constructorId, /* @__PURE__ */ new Set());
|
|
14096
|
+
}
|
|
14097
|
+
function asRecord(value) {
|
|
14098
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
14099
|
+
return null;
|
|
14100
|
+
}
|
|
14101
|
+
return value;
|
|
14102
|
+
}
|
|
14103
|
+
|
|
13926
14104
|
// ../packages/neoscript-runtime/src/neoscript/typed-aggregate-row-references.ts
|
|
13927
14105
|
function visitTypedAggregateRowReferences(value, rawType, visitor) {
|
|
13928
14106
|
visitor.beforeVisit?.();
|
|
@@ -14013,15 +14191,12 @@ function initializerOwnerContext(document2, valueId, rootOwners, valuesById, rec
|
|
|
14013
14191
|
currentId = sourceValueId;
|
|
14014
14192
|
lexicalRoot = rootOwners.get(sourceValueId) ?? lexicalRoot;
|
|
14015
14193
|
}
|
|
14016
|
-
if (lexicalRoot === void 0) {
|
|
14194
|
+
if (lexicalRoot === void 0 || isStaticMember(lexicalRoot)) {
|
|
14017
14195
|
return { ownerClass: null, lexicalThisClass: null };
|
|
14018
14196
|
}
|
|
14019
14197
|
const lexicalRootId = getField(lexicalRoot, "id");
|
|
14020
14198
|
const ownerClass = typeof lexicalRootId === "string" ? findSchemaPlacement(lexicalRootId, document2.classes)?.ownerClass ?? null : null;
|
|
14021
|
-
return {
|
|
14022
|
-
ownerClass,
|
|
14023
|
-
lexicalThisClass: isStaticMember(lexicalRoot) === true ? null : ownerClass
|
|
14024
|
-
};
|
|
14199
|
+
return { ownerClass, lexicalThisClass: ownerClass };
|
|
14025
14200
|
}
|
|
14026
14201
|
function isRecordValue(value) {
|
|
14027
14202
|
if (value === null) return false;
|
|
@@ -21194,6 +21369,7 @@ function runtimeGenericEnvForValueRow(row, ctx, visited = /* @__PURE__ */ new Se
|
|
|
21194
21369
|
);
|
|
21195
21370
|
overlayConcreteGenericEntries(env, parentEnv);
|
|
21196
21371
|
overlayConcreteGenericEntries(env, envFromStamp(row.genericBindings));
|
|
21372
|
+
closeForwardedGenericParams(env);
|
|
21197
21373
|
return env;
|
|
21198
21374
|
}
|
|
21199
21375
|
function runtimeParentGenericEnv(row, ctx, visited, readRow) {
|
|
@@ -21434,6 +21610,18 @@ function runtimeTypeInfoForMember(rawMember, env, ctx, seen) {
|
|
|
21434
21610
|
ctx
|
|
21435
21611
|
);
|
|
21436
21612
|
}
|
|
21613
|
+
if (isMemberDelegateBase(member)) {
|
|
21614
|
+
return substituteRuntimeTypeInfo(
|
|
21615
|
+
{
|
|
21616
|
+
type: 25 /* NSDelegate */,
|
|
21617
|
+
required,
|
|
21618
|
+
returnTypeInfo: member.returnTypeInfo,
|
|
21619
|
+
argumentTypes: unnamedArgumentTypes(member.argumentTypes)
|
|
21620
|
+
},
|
|
21621
|
+
env,
|
|
21622
|
+
ctx
|
|
21623
|
+
);
|
|
21624
|
+
}
|
|
21437
21625
|
if (member.kind === 13 /* Function */ || member.kind === 23 /* NSFunction */ || member.kind === 22 /* Interface */) {
|
|
21438
21626
|
throw new NSGetterRuntimeError(
|
|
21439
21627
|
`Member '${member.name}' cannot be used as a concrete generic value type.`
|
|
@@ -21939,8 +22127,17 @@ function dispatchSchemaMember(receiver, schemaKey, ctx) {
|
|
|
21939
22127
|
return { kind: "ok", value: null };
|
|
21940
22128
|
case "declaration": {
|
|
21941
22129
|
const value = readDeclarationDefault(member, ctx);
|
|
21942
|
-
if (value.matched) return { kind: "
|
|
21943
|
-
|
|
22130
|
+
if (!value.matched) return { kind: "no-info", matchedMember: true };
|
|
22131
|
+
if (!isNSDelegateClosureValue(value.value))
|
|
22132
|
+
return { kind: "ok", value: value.value };
|
|
22133
|
+
return {
|
|
22134
|
+
kind: "ok",
|
|
22135
|
+
value: {
|
|
22136
|
+
...value.value,
|
|
22137
|
+
[DELEGATE_LEXICAL_THIS]: receiver,
|
|
22138
|
+
[DELEGATE_LEXICAL_ROOT]: ctx.rootValue
|
|
22139
|
+
}
|
|
22140
|
+
};
|
|
21944
22141
|
}
|
|
21945
22142
|
case "missing":
|
|
21946
22143
|
return { kind: "no-info", matchedMember: true };
|
|
@@ -24092,8 +24289,9 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
|
|
|
24092
24289
|
}
|
|
24093
24290
|
const genericSlot = ctx.__constructionGenericSlots?.toReversed().find((slot) => slot.classId === classId) ?? ctx.__storedConstructionReplaySlot;
|
|
24094
24291
|
const slotArguments = genericSlot?.classId === classId ? genericSlot.classArguments : void 0;
|
|
24292
|
+
const typeArguments = slotArguments === void 0 ? receiverClosedTypeArguments(info.schemaClassInfo.typeArguments, ctx) : void 0;
|
|
24095
24293
|
const descriptorCache = evaluatorValueGeneration(ctx).constructorDescriptors;
|
|
24096
|
-
const descriptorCacheKey = `${requireEveryRequiredField}:${ctx.storedConstructionReplay === true}:${JSON.stringify(slotArguments ??
|
|
24294
|
+
const descriptorCacheKey = `${requireEveryRequiredField}:${ctx.storedConstructionReplay === true}:${JSON.stringify(slotArguments ?? typeArguments ?? null)}`;
|
|
24097
24295
|
const cachedDescriptor = descriptorCache.get(info)?.get(descriptorCacheKey);
|
|
24098
24296
|
if (cachedDescriptor !== void 0) return cachedDescriptor;
|
|
24099
24297
|
const constructionDocument = {
|
|
@@ -24104,10 +24302,7 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
|
|
|
24104
24302
|
valueById: ctx.vm.databaseVM?.defaultValueById ?? ctx.vm.databaseVM?.valueById,
|
|
24105
24303
|
memberById: evaluatorDefaultValueDocument(ctx).memberById
|
|
24106
24304
|
};
|
|
24107
|
-
const classArguments2 = slotArguments ?? resolveConstructionTypeArguments(
|
|
24108
|
-
info.schemaClassInfo.typeArguments,
|
|
24109
|
-
constructionDocument
|
|
24110
|
-
);
|
|
24305
|
+
const classArguments2 = slotArguments ?? resolveConstructionTypeArguments(typeArguments, constructionDocument);
|
|
24111
24306
|
const cacheDescriptor = (descriptor) => {
|
|
24112
24307
|
const complete = {
|
|
24113
24308
|
...descriptor,
|
|
@@ -24219,6 +24414,33 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
|
|
|
24219
24414
|
}
|
|
24220
24415
|
return cacheDescriptor({ schemaClass: schemaClass2, fields, instanceEnv, classArguments: classArguments2 });
|
|
24221
24416
|
}
|
|
24417
|
+
function receiverClosedTypeArguments(typeArguments, ctx) {
|
|
24418
|
+
if (typeArguments === void 0) return void 0;
|
|
24419
|
+
let env = null;
|
|
24420
|
+
let closed = null;
|
|
24421
|
+
for (const [parameterId, typeInfo] of Object.entries(typeArguments)) {
|
|
24422
|
+
if (!typeInfoContainsGeneric(typeInfo)) continue;
|
|
24423
|
+
if (env === null) {
|
|
24424
|
+
const row = ctx.thisValueRowId ? readNeoScriptRuntimeRow(ctx, ctx.thisValueRowId) : trackedRowForValueReference(ctx.thisValue, ctx);
|
|
24425
|
+
if (row) {
|
|
24426
|
+
env = runtimeGenericEnvForValueRow(row, ctx, /* @__PURE__ */ new Set());
|
|
24427
|
+
} else if (ctx.__initializerGenericEnv !== void 0) {
|
|
24428
|
+
env = ctx.__initializerGenericEnv;
|
|
24429
|
+
} else {
|
|
24430
|
+
throw new NSGetterRuntimeError(
|
|
24431
|
+
"Cannot close a generic construction's type arguments without its Class receiver."
|
|
24432
|
+
);
|
|
24433
|
+
}
|
|
24434
|
+
}
|
|
24435
|
+
closed ??= { ...typeArguments };
|
|
24436
|
+
closed[parameterId] = substituteRuntimeTypeInfo(
|
|
24437
|
+
typeInfo,
|
|
24438
|
+
env,
|
|
24439
|
+
ctx
|
|
24440
|
+
);
|
|
24441
|
+
}
|
|
24442
|
+
return closed ?? typeArguments;
|
|
24443
|
+
}
|
|
24222
24444
|
function validateConstructorFieldSlot(args) {
|
|
24223
24445
|
const { schemaKey, ctx } = args;
|
|
24224
24446
|
const rawMember = evalMemberById(ctx.vm, args.memberId);
|
|
@@ -24446,8 +24668,7 @@ function applyConstructorFields(args) {
|
|
|
24446
24668
|
const existingId = rootRecord[schemaKey];
|
|
24447
24669
|
const existing = typeof existingId === "string" ? createdById.get(existingId) : void 0;
|
|
24448
24670
|
if (existing !== void 0 && isLiteralValueContent(existing) && !isMemberClassBase(member) && !isMemberListBase(member) && !isMemberDictionaryBase(member)) {
|
|
24449
|
-
existing
|
|
24450
|
-
existing.updatedAt = Date.now();
|
|
24671
|
+
overwriteConstructedLiteral(existing, value, ctx);
|
|
24451
24672
|
continue;
|
|
24452
24673
|
}
|
|
24453
24674
|
const materialized = materializeConstructorArgumentValue({
|
|
@@ -24462,6 +24683,14 @@ function applyConstructorFields(args) {
|
|
|
24462
24683
|
rootRecord[schemaKey] = materialized.id;
|
|
24463
24684
|
}
|
|
24464
24685
|
}
|
|
24686
|
+
function overwriteConstructedLiteral(row, value, ctx) {
|
|
24687
|
+
const references = ctx.__indexes?.rowByValueReference;
|
|
24688
|
+
if (typeof row.value === "object" && row.value !== null)
|
|
24689
|
+
references?.delete(row.value);
|
|
24690
|
+
if (typeof value === "object" && value !== null) references?.set(value, row);
|
|
24691
|
+
row.value = value;
|
|
24692
|
+
row.updatedAt = Date.now();
|
|
24693
|
+
}
|
|
24465
24694
|
function applyExplicitNullConstructorField(args) {
|
|
24466
24695
|
const { schemaKey, member } = args.validated;
|
|
24467
24696
|
if (isRequiredMember(member)) {
|
|
@@ -24472,8 +24701,7 @@ function applyExplicitNullConstructorField(args) {
|
|
|
24472
24701
|
const existingId = args.rootRecord[schemaKey];
|
|
24473
24702
|
const existing = typeof existingId === "string" ? args.createdById.get(existingId) : void 0;
|
|
24474
24703
|
if (existing !== void 0 && isLiteralValueContent(existing) && !isMemberClassBase(member) && !isMemberListBase(member) && !isMemberDictionaryBase(member)) {
|
|
24475
|
-
existing
|
|
24476
|
-
existing.updatedAt = Date.now();
|
|
24704
|
+
overwriteConstructedLiteral(existing, null, args.ctx);
|
|
24477
24705
|
return;
|
|
24478
24706
|
}
|
|
24479
24707
|
const cleared = registerConstructorArgumentRow(
|
|
@@ -25379,9 +25607,11 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
|
|
|
25379
25607
|
compileMemberId
|
|
25380
25608
|
});
|
|
25381
25609
|
const closeFrame = pushConstructionFrame(ctx, `${member.name} initializer`);
|
|
25610
|
+
const initializerCtx = ctx.thisValue === null ? ctx : bindThisValue(ctx, null);
|
|
25611
|
+
const previousGenericEnv = initializerCtx.__initializerGenericEnv;
|
|
25612
|
+
initializerCtx.__initializerGenericEnv = genericEnv;
|
|
25382
25613
|
let result;
|
|
25383
25614
|
try {
|
|
25384
|
-
const initializerCtx = ctx.thisValue === null ? ctx : bindThisValue(ctx, null);
|
|
25385
25615
|
result = evaluateNSGetterWithEffects(
|
|
25386
25616
|
compiled,
|
|
25387
25617
|
initializerCtx,
|
|
@@ -25397,6 +25627,7 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
|
|
|
25397
25627
|
error.sourceOwnerId ??= ownerId;
|
|
25398
25628
|
throw error;
|
|
25399
25629
|
} finally {
|
|
25630
|
+
initializerCtx.__initializerGenericEnv = previousGenericEnv;
|
|
25400
25631
|
closeFrame();
|
|
25401
25632
|
}
|
|
25402
25633
|
const created = result.createdSessionValues ?? [];
|
|
@@ -25596,6 +25827,21 @@ function retargetConstructorGroupDependencies(provisionalRootId, replacementRoot
|
|
|
25596
25827
|
replacementDependencies.add(dependencyRootId);
|
|
25597
25828
|
}
|
|
25598
25829
|
}
|
|
25830
|
+
function settledConstructorParameterMember(classId, parameterName, constructorId, ctx) {
|
|
25831
|
+
const cache = evaluatorResolutionCache(ctx);
|
|
25832
|
+
cache.constructorSettlement ??= createConstructorSettlementResolver({
|
|
25833
|
+
classes: ctx.vm.classes,
|
|
25834
|
+
constructors: ctx.vm.constructors,
|
|
25835
|
+
members: ctx.vm.members
|
|
25836
|
+
});
|
|
25837
|
+
const settled = cache.constructorSettlement(
|
|
25838
|
+
classId,
|
|
25839
|
+
parameterName,
|
|
25840
|
+
constructorId
|
|
25841
|
+
);
|
|
25842
|
+
if (settled === null) return void 0;
|
|
25843
|
+
return evalMemberById(ctx.vm, settled.memberId) ?? void 0;
|
|
25844
|
+
}
|
|
25599
25845
|
function encodeRequiredConstructorArgument(args) {
|
|
25600
25846
|
const trackedId = findKnownRowIdByValueReference(args.value, args.ctx);
|
|
25601
25847
|
const replayedAggregateId = trackedId === null && args.ctx.storedConstructionReplay === true && typeof args.value === "string" && evalValueById(
|
|
@@ -25641,6 +25887,14 @@ function encodeRequiredConstructorArgument(args) {
|
|
|
25641
25887
|
const aggregateId = trackedId ?? replayedAggregateId;
|
|
25642
25888
|
if (aggregateId !== null) return adoptTracked(aggregateId, "root");
|
|
25643
25889
|
const collectionType = args.typeInfo;
|
|
25890
|
+
const settled = args.member;
|
|
25891
|
+
const registerCollectionRow = (value) => {
|
|
25892
|
+
const row2 = registerRow(value);
|
|
25893
|
+
const genericBindings = settled === void 0 ? void 0 : rowGenericBindings({ ...args, member: settled });
|
|
25894
|
+
if (genericBindings !== void 0) row2.genericBindings = genericBindings;
|
|
25895
|
+
return row2;
|
|
25896
|
+
};
|
|
25897
|
+
const entryMember = settled !== void 0 && (isMemberListBase(settled) || isMemberDictionaryBase(settled)) ? evalMemberById(args.ctx.vm, settled.entryMemberId) ?? void 0 : void 0;
|
|
25644
25898
|
const registerRow = (value, containerId) => {
|
|
25645
25899
|
args.ctx.beforeValueAllocation?.();
|
|
25646
25900
|
const row2 = buildNewValue(args.ctx.vm.project.id, { value });
|
|
@@ -25672,7 +25926,8 @@ function encodeRequiredConstructorArgument(args) {
|
|
|
25672
25926
|
...args,
|
|
25673
25927
|
value,
|
|
25674
25928
|
typeInfo: entryType,
|
|
25675
|
-
parameterId: `${args.parameterId}:${suffix}
|
|
25929
|
+
parameterId: `${args.parameterId}:${suffix}`,
|
|
25930
|
+
member: entryMember
|
|
25676
25931
|
});
|
|
25677
25932
|
if (typeof nested !== "string") {
|
|
25678
25933
|
throw new NSGetterRuntimeError(
|
|
@@ -25689,7 +25944,7 @@ function encodeRequiredConstructorArgument(args) {
|
|
|
25689
25944
|
`Constructor argument '${args.parameterId}' must be a List.`
|
|
25690
25945
|
);
|
|
25691
25946
|
}
|
|
25692
|
-
const row2 =
|
|
25947
|
+
const row2 = registerCollectionRow([]);
|
|
25693
25948
|
row2.value = args.value.map(
|
|
25694
25949
|
(entry, index) => encodeEntry(entry, collectionType.entryTypeInfo, `index:${index}`)
|
|
25695
25950
|
);
|
|
@@ -25700,7 +25955,7 @@ function encodeRequiredConstructorArgument(args) {
|
|
|
25700
25955
|
`Constructor argument '${args.parameterId}' must be a Dictionary.`
|
|
25701
25956
|
);
|
|
25702
25957
|
}
|
|
25703
|
-
const row =
|
|
25958
|
+
const row = registerCollectionRow({});
|
|
25704
25959
|
row.value = Object.fromEntries(
|
|
25705
25960
|
Object.entries(args.value).map(([key, entry]) => [
|
|
25706
25961
|
key,
|
|
@@ -26533,6 +26788,14 @@ function constructDeclaredClassValueWithinFrame(descriptor, record4, info, scope
|
|
|
26533
26788
|
ownerRootId: root.id,
|
|
26534
26789
|
createdValues,
|
|
26535
26790
|
storageKeyDeclarations,
|
|
26791
|
+
// Only collection rows carry a stamp from the settled member.
|
|
26792
|
+
member: resolvedArgumentType.type === 6 /* List */ || resolvedArgumentType.type === 5 /* Dictionary */ ? settledConstructorParameterMember(
|
|
26793
|
+
classId,
|
|
26794
|
+
argumentType.name,
|
|
26795
|
+
record4.id,
|
|
26796
|
+
ctx
|
|
26797
|
+
) : void 0,
|
|
26798
|
+
genericEnv: descriptor.instanceEnv,
|
|
26536
26799
|
ctx
|
|
26537
26800
|
});
|
|
26538
26801
|
}
|
|
@@ -27877,132 +28140,6 @@ function declarationDefaultSource(id, stored, resolveGraph) {
|
|
|
27877
28140
|
return defaultSourceWithListeners(graph?.rowsById.get(id) ?? stored, graph);
|
|
27878
28141
|
}
|
|
27879
28142
|
|
|
27880
|
-
// ../packages/models/src/classes/constructor-parameter-settlement.ts
|
|
27881
|
-
function createConstructorSettlementResolver(view) {
|
|
27882
|
-
const classesById = new Map(
|
|
27883
|
-
view.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
27884
|
-
);
|
|
27885
|
-
const membersById = new Map(
|
|
27886
|
-
view.members.map((member) => [member.id, member])
|
|
27887
|
-
);
|
|
27888
|
-
const constructorsById = new Map(
|
|
27889
|
-
(view.constructors ?? []).map((constructor) => [
|
|
27890
|
-
constructor.id,
|
|
27891
|
-
constructor
|
|
27892
|
-
])
|
|
27893
|
-
);
|
|
27894
|
-
const directResultByClassAndParameter = /* @__PURE__ */ new Map();
|
|
27895
|
-
const recordedResultByConstructorAndParameter = /* @__PURE__ */ new Map();
|
|
27896
|
-
const directSettlement = (classId, parameterName) => {
|
|
27897
|
-
const cacheKey = `${classId}\0${parameterName}`;
|
|
27898
|
-
if (directResultByClassAndParameter.has(cacheKey)) {
|
|
27899
|
-
return directResultByClassAndParameter.get(cacheKey) ?? null;
|
|
27900
|
-
}
|
|
27901
|
-
const visited = /* @__PURE__ */ new Set();
|
|
27902
|
-
let currentId = classId;
|
|
27903
|
-
while (currentId !== null && !visited.has(currentId)) {
|
|
27904
|
-
visited.add(currentId);
|
|
27905
|
-
const schemaClass2 = classesById.get(currentId);
|
|
27906
|
-
if (schemaClass2 === void 0) break;
|
|
27907
|
-
for (const [schemaKey, memberId] of Object.entries(
|
|
27908
|
-
schemaClass2.schema ?? {}
|
|
27909
|
-
)) {
|
|
27910
|
-
if (typeof memberId !== "string") continue;
|
|
27911
|
-
const member = membersById.get(memberId);
|
|
27912
|
-
const defaultRecord = asRecord(member?.defaultValue);
|
|
27913
|
-
const initRecord = asRecord(defaultRecord?.init);
|
|
27914
|
-
if (initRecord !== null && typeof initRecord.code === "string" && initRecord.code.trim() === parameterName) {
|
|
27915
|
-
const result = { schemaKey, memberId };
|
|
27916
|
-
directResultByClassAndParameter.set(cacheKey, result);
|
|
27917
|
-
return result;
|
|
27918
|
-
}
|
|
27919
|
-
}
|
|
27920
|
-
currentId = schemaClass2.extendsClassId ?? null;
|
|
27921
|
-
}
|
|
27922
|
-
directResultByClassAndParameter.set(cacheKey, null);
|
|
27923
|
-
return null;
|
|
27924
|
-
};
|
|
27925
|
-
const memberIdForSchemaKey = (classId, schemaKey) => {
|
|
27926
|
-
const visited = /* @__PURE__ */ new Set();
|
|
27927
|
-
let currentId = classId;
|
|
27928
|
-
while (currentId !== null && !visited.has(currentId)) {
|
|
27929
|
-
visited.add(currentId);
|
|
27930
|
-
const schemaClass2 = classesById.get(currentId);
|
|
27931
|
-
if (schemaClass2 === void 0) return null;
|
|
27932
|
-
const memberId = schemaClass2.schema?.[schemaKey];
|
|
27933
|
-
if (typeof memberId === "string") return memberId;
|
|
27934
|
-
currentId = schemaClass2.extendsClassId ?? null;
|
|
27935
|
-
}
|
|
27936
|
-
return null;
|
|
27937
|
-
};
|
|
27938
|
-
const recordedSettlement = (classId, parameterName, constructorId, resolving) => {
|
|
27939
|
-
const cacheKey = `${classId}\0${constructorId}\0${parameterName}`;
|
|
27940
|
-
if (recordedResultByConstructorAndParameter.has(cacheKey)) {
|
|
27941
|
-
return recordedResultByConstructorAndParameter.get(cacheKey) ?? null;
|
|
27942
|
-
}
|
|
27943
|
-
if (resolving.has(cacheKey)) return null;
|
|
27944
|
-
const constructor = constructorsById.get(constructorId);
|
|
27945
|
-
if (constructor?.classId !== classId) {
|
|
27946
|
-
recordedResultByConstructorAndParameter.set(cacheKey, null);
|
|
27947
|
-
return null;
|
|
27948
|
-
}
|
|
27949
|
-
const direct = directSettlement(classId, parameterName);
|
|
27950
|
-
if (direct !== null) {
|
|
27951
|
-
recordedResultByConstructorAndParameter.set(cacheKey, direct);
|
|
27952
|
-
return direct;
|
|
27953
|
-
}
|
|
27954
|
-
const schemaClass2 = classesById.get(classId);
|
|
27955
|
-
const baseClassId = schemaClass2?.extendsClassId;
|
|
27956
|
-
if (typeof baseClassId !== "string") {
|
|
27957
|
-
recordedResultByConstructorAndParameter.set(cacheKey, null);
|
|
27958
|
-
return null;
|
|
27959
|
-
}
|
|
27960
|
-
for (const field of constructor.baseInitializerFields ?? []) {
|
|
27961
|
-
const record4 = asRecord(field);
|
|
27962
|
-
if (typeof record4?.name !== "string" || typeof record4.code !== "string" || record4.code.trim() !== parameterName) {
|
|
27963
|
-
continue;
|
|
27964
|
-
}
|
|
27965
|
-
const memberId = memberIdForSchemaKey(baseClassId, record4.name);
|
|
27966
|
-
if (memberId !== null) {
|
|
27967
|
-
const result = { schemaKey: record4.name, memberId };
|
|
27968
|
-
recordedResultByConstructorAndParameter.set(cacheKey, result);
|
|
27969
|
-
return result;
|
|
27970
|
-
}
|
|
27971
|
-
}
|
|
27972
|
-
const baseConstructorId = classesById.get(baseClassId)?.requiredConstructorId;
|
|
27973
|
-
if (typeof baseConstructorId !== "string") {
|
|
27974
|
-
recordedResultByConstructorAndParameter.set(cacheKey, null);
|
|
27975
|
-
return null;
|
|
27976
|
-
}
|
|
27977
|
-
resolving.add(cacheKey);
|
|
27978
|
-
for (const argument2 of constructor.baseArguments ?? []) {
|
|
27979
|
-
const record4 = asRecord(argument2);
|
|
27980
|
-
if (typeof record4?.name !== "string" || typeof record4.code !== "string" || record4.code.trim() !== parameterName) {
|
|
27981
|
-
continue;
|
|
27982
|
-
}
|
|
27983
|
-
const result = recordedSettlement(
|
|
27984
|
-
baseClassId,
|
|
27985
|
-
record4.name,
|
|
27986
|
-
baseConstructorId,
|
|
27987
|
-
resolving
|
|
27988
|
-
);
|
|
27989
|
-
resolving.delete(cacheKey);
|
|
27990
|
-
recordedResultByConstructorAndParameter.set(cacheKey, result);
|
|
27991
|
-
return result;
|
|
27992
|
-
}
|
|
27993
|
-
resolving.delete(cacheKey);
|
|
27994
|
-
recordedResultByConstructorAndParameter.set(cacheKey, null);
|
|
27995
|
-
return null;
|
|
27996
|
-
};
|
|
27997
|
-
return (classId, parameterName, constructorId) => constructorId === void 0 ? directSettlement(classId, parameterName) : recordedSettlement(classId, parameterName, constructorId, /* @__PURE__ */ new Set());
|
|
27998
|
-
}
|
|
27999
|
-
function asRecord(value) {
|
|
28000
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
28001
|
-
return null;
|
|
28002
|
-
}
|
|
28003
|
-
return value;
|
|
28004
|
-
}
|
|
28005
|
-
|
|
28006
28143
|
// ../packages/models/src/members/stored-value-placement-index.ts
|
|
28007
28144
|
function buildStoredValuePlacementIndex(args) {
|
|
28008
28145
|
return createStoredValuePlacementTraversal(args)();
|
|
@@ -28288,16 +28425,17 @@ function lookupEntryTypeInfo(member, collectionTypeInfo) {
|
|
|
28288
28425
|
}
|
|
28289
28426
|
|
|
28290
28427
|
// ../packages/neoscript-runtime/src/values/member-declared-type-info.ts
|
|
28291
|
-
function resolveMemberDeclaredTypeInfo(member, members, ownerClass = null) {
|
|
28428
|
+
function resolveMemberDeclaredTypeInfo(member, members, ownerClass = null, env) {
|
|
28292
28429
|
return resolveMemberDeclaredTypeInfoInternal(
|
|
28293
28430
|
member,
|
|
28294
28431
|
members,
|
|
28295
28432
|
/* @__PURE__ */ new Set(),
|
|
28296
|
-
ownerClass
|
|
28433
|
+
ownerClass,
|
|
28434
|
+
env
|
|
28297
28435
|
);
|
|
28298
28436
|
}
|
|
28299
|
-
function resolveMemberDeclaredTypeInfoInternal(member, members, seen, ownerClass) {
|
|
28300
|
-
const resolved = resolveMember(member, members);
|
|
28437
|
+
function resolveMemberDeclaredTypeInfoInternal(member, members, seen, ownerClass, env) {
|
|
28438
|
+
const resolved = env === void 0 ? resolveMember(member, members) : substituteMember(member, env, members);
|
|
28301
28439
|
const memberId = getField(resolved, "id");
|
|
28302
28440
|
if (typeof memberId === "string" && seen.has(memberId)) return null;
|
|
28303
28441
|
const nextSeen = typeof memberId === "string" ? /* @__PURE__ */ new Set([...seen, memberId]) : new Set(seen);
|
|
@@ -28306,7 +28444,14 @@ function resolveMemberDeclaredTypeInfoInternal(member, members, seen, ownerClass
|
|
|
28306
28444
|
const typeArguments = Object.fromEntries(
|
|
28307
28445
|
Object.entries(resolved.classArguments ?? {}).flatMap(
|
|
28308
28446
|
([genericParamId, binding]) => {
|
|
28309
|
-
if (!isMemberGenericBinding(binding))
|
|
28447
|
+
if (!isMemberGenericBinding(binding)) {
|
|
28448
|
+
const forwarded = genericParamTypeInfo(
|
|
28449
|
+
ownerClass,
|
|
28450
|
+
binding.genericParamId,
|
|
28451
|
+
true
|
|
28452
|
+
);
|
|
28453
|
+
return forwarded === null ? [] : [[genericParamId, forwarded]];
|
|
28454
|
+
}
|
|
28310
28455
|
const argumentMember = members.find(
|
|
28311
28456
|
(candidate) => candidate.id === binding.memberId
|
|
28312
28457
|
);
|
|
@@ -28315,7 +28460,8 @@ function resolveMemberDeclaredTypeInfoInternal(member, members, seen, ownerClass
|
|
|
28315
28460
|
argumentMember,
|
|
28316
28461
|
members,
|
|
28317
28462
|
nextSeen,
|
|
28318
|
-
ownerClass
|
|
28463
|
+
ownerClass,
|
|
28464
|
+
env
|
|
28319
28465
|
);
|
|
28320
28466
|
return argumentType === null ? [] : [[genericParamId, argumentType]];
|
|
28321
28467
|
}
|
|
@@ -28355,22 +28501,14 @@ function resolveMemberDeclaredTypeInfoInternal(member, members, seen, ownerClass
|
|
|
28355
28501
|
type: 25 /* NSDelegate */,
|
|
28356
28502
|
required: isRequiredMember(resolved),
|
|
28357
28503
|
returnTypeInfo: resolved.returnTypeInfo,
|
|
28358
|
-
argumentTypes: resolved.argumentTypes
|
|
28359
|
-
const { name, ...typeInfo } = argument2;
|
|
28360
|
-
void name;
|
|
28361
|
-
return typeInfo;
|
|
28362
|
-
})
|
|
28504
|
+
argumentTypes: unnamedArgumentTypes(resolved.argumentTypes)
|
|
28363
28505
|
};
|
|
28364
28506
|
}
|
|
28365
28507
|
if (isMemberActionBase(resolved)) {
|
|
28366
28508
|
return {
|
|
28367
28509
|
type: 26 /* NSAction */,
|
|
28368
28510
|
required: false,
|
|
28369
|
-
argumentTypes: resolved.argumentTypes
|
|
28370
|
-
const { name, ...typeInfo } = argument2;
|
|
28371
|
-
void name;
|
|
28372
|
-
return typeInfo;
|
|
28373
|
-
})
|
|
28511
|
+
argumentTypes: unnamedArgumentTypes(resolved.argumentTypes)
|
|
28374
28512
|
};
|
|
28375
28513
|
}
|
|
28376
28514
|
if (isMemberListBase(resolved) || isMemberDictionaryBase(resolved)) {
|
|
@@ -28382,7 +28520,8 @@ function resolveMemberDeclaredTypeInfoInternal(member, members, seen, ownerClass
|
|
|
28382
28520
|
entry,
|
|
28383
28521
|
members,
|
|
28384
28522
|
nextSeen,
|
|
28385
|
-
ownerClass
|
|
28523
|
+
ownerClass,
|
|
28524
|
+
env
|
|
28386
28525
|
);
|
|
28387
28526
|
if (entryTypeInfo === null) return null;
|
|
28388
28527
|
return {
|
|
@@ -28402,30 +28541,38 @@ function resolveMemberDeclaredTypeInfoInternal(member, members, seen, ownerClass
|
|
|
28402
28541
|
collection,
|
|
28403
28542
|
members,
|
|
28404
28543
|
nextSeen,
|
|
28405
|
-
ownerClass
|
|
28544
|
+
ownerClass,
|
|
28545
|
+
env
|
|
28406
28546
|
);
|
|
28407
28547
|
});
|
|
28408
28548
|
}
|
|
28409
28549
|
if (resolved.kind === 9 /* Lookup */) return null;
|
|
28410
28550
|
if (!memberKindSupportsStorage(resolved.kind)) return null;
|
|
28411
28551
|
if (isMemberGenericBase(resolved)) {
|
|
28412
|
-
|
|
28413
|
-
|
|
28414
|
-
|
|
28552
|
+
return genericParamTypeInfo(
|
|
28553
|
+
ownerClass,
|
|
28554
|
+
resolved.genericParamId,
|
|
28555
|
+
isRequiredMember(resolved)
|
|
28415
28556
|
);
|
|
28416
|
-
if (declaration === void 0) return null;
|
|
28417
|
-
return {
|
|
28418
|
-
type: 21 /* Generic */,
|
|
28419
|
-
required: isRequiredMember(resolved),
|
|
28420
|
-
ownerClassId: ownerClass.id,
|
|
28421
|
-
genericParamId: declaration.id
|
|
28422
|
-
};
|
|
28423
28557
|
}
|
|
28424
28558
|
return {
|
|
28425
28559
|
type: resolved.kind,
|
|
28426
28560
|
required: isRequiredMember(resolved)
|
|
28427
28561
|
};
|
|
28428
28562
|
}
|
|
28563
|
+
function genericParamTypeInfo(ownerClass, genericParamId, required) {
|
|
28564
|
+
if (ownerClass === null) return null;
|
|
28565
|
+
const declaration = ownerClass.genericParams?.find(
|
|
28566
|
+
(parameter3) => parameter3.id === genericParamId
|
|
28567
|
+
);
|
|
28568
|
+
if (declaration === void 0) return null;
|
|
28569
|
+
return {
|
|
28570
|
+
type: 21 /* Generic */,
|
|
28571
|
+
required,
|
|
28572
|
+
ownerClassId: ownerClass.id,
|
|
28573
|
+
genericParamId: declaration.id
|
|
28574
|
+
};
|
|
28575
|
+
}
|
|
28429
28576
|
|
|
28430
28577
|
// ../packages/neoscript-runtime/src/values/constructor-argument-ownership.ts
|
|
28431
28578
|
var MaterializedValueGraphContext = class {
|
|
@@ -31258,7 +31405,7 @@ function materializeMemberDefaultValue(args) {
|
|
|
31258
31405
|
rootOwners,
|
|
31259
31406
|
valuesById,
|
|
31260
31407
|
(id) => args.readTracking?.valueIds.add(id)
|
|
31261
|
-
).ownerClass : typeof Reflect.get(member, "id") === "string" ? findSchemaPlacement(
|
|
31408
|
+
).ownerClass : typeof Reflect.get(member, "id") === "string" && !isStaticMember(member) ? findSchemaPlacement(
|
|
31262
31409
|
String(Reflect.get(member, "id")),
|
|
31263
31410
|
args.document.classes
|
|
31264
31411
|
)?.ownerClass ?? null : null;
|
|
@@ -33597,22 +33744,25 @@ function virtualReadRecorder(reads) {
|
|
|
33597
33744
|
recordGlobalRead: reads.recordUnattributableValueRead
|
|
33598
33745
|
};
|
|
33599
33746
|
}
|
|
33600
|
-
function
|
|
33601
|
-
const databaseVM = initializerEvaluatorLookups(
|
|
33602
|
-
args.document,
|
|
33603
|
-
args.readTracking
|
|
33604
|
-
);
|
|
33747
|
+
function compileMemberInitializer(args, databaseVM = initializerEvaluatorLookups(args.document)) {
|
|
33605
33748
|
const initializerIndexes = databaseVM.constructorInitializerIndexes;
|
|
33606
33749
|
const compileMemberId = initializerIndexes?.initializerScopeMemberIds.get(args.init) ?? (args.sourceValueId === null || args.sourceValueId === void 0 ? void 0 : initializerIndexes?.initializerScopeMemberIdsByValueId.get(
|
|
33607
33750
|
args.sourceValueId
|
|
33608
33751
|
));
|
|
33609
|
-
|
|
33752
|
+
return ensureInitializerCompiled({
|
|
33610
33753
|
init: args.init,
|
|
33611
33754
|
member: args.member,
|
|
33612
33755
|
initializerCompiler: args.document.initializerCompiler,
|
|
33613
33756
|
sourceValueId: args.sourceValueId ?? null,
|
|
33614
33757
|
compileMemberId
|
|
33615
33758
|
});
|
|
33759
|
+
}
|
|
33760
|
+
function evaluateMemberInitializer(args) {
|
|
33761
|
+
const databaseVM = initializerEvaluatorLookups(
|
|
33762
|
+
args.document,
|
|
33763
|
+
args.readTracking
|
|
33764
|
+
);
|
|
33765
|
+
const compiled = compileMemberInitializer(args, databaseVM);
|
|
33616
33766
|
const ctx = {
|
|
33617
33767
|
...args.document.evaluationLimits,
|
|
33618
33768
|
debugSink: args.document.debugSink,
|
|
@@ -35107,6 +35257,25 @@ function substituteTypeParameters(member, receiver, declaring) {
|
|
|
35107
35257
|
};
|
|
35108
35258
|
return visit(member);
|
|
35109
35259
|
}
|
|
35260
|
+
function containsTypeParameter(type) {
|
|
35261
|
+
switch (type.kind) {
|
|
35262
|
+
case "typeParameter":
|
|
35263
|
+
return true;
|
|
35264
|
+
case "named":
|
|
35265
|
+
return type.typeArguments?.some(containsTypeParameter) ?? false;
|
|
35266
|
+
case "list":
|
|
35267
|
+
case "set":
|
|
35268
|
+
return containsTypeParameter(type.elementType);
|
|
35269
|
+
case "dictionary":
|
|
35270
|
+
return containsTypeParameter(type.keyType) || containsTypeParameter(type.valueType);
|
|
35271
|
+
case "delegate":
|
|
35272
|
+
return containsTypeParameter(type.returnType) || type.parameterTypes.some(containsTypeParameter);
|
|
35273
|
+
case "action":
|
|
35274
|
+
return type.parameterTypes.some(containsTypeParameter);
|
|
35275
|
+
default:
|
|
35276
|
+
return false;
|
|
35277
|
+
}
|
|
35278
|
+
}
|
|
35110
35279
|
|
|
35111
35280
|
// ../packages/neoscript-language/src/listener-annotation.ts
|
|
35112
35281
|
function inspectListenerAnnotation(annotation2, parameters) {
|
|
@@ -35824,6 +35993,18 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
35824
35993
|
}
|
|
35825
35994
|
return { fields, errors, deferredReferences: [...deferredReferences] };
|
|
35826
35995
|
}
|
|
35996
|
+
/**
|
|
35997
|
+
* P60 §2.3. A persisted delegate method group, graded exactly as the same
|
|
35998
|
+
* expression assigned to `expected` in a body.
|
|
35999
|
+
*/
|
|
36000
|
+
resolvePersistedMethodGroup(expression, expected) {
|
|
36001
|
+
const resolved = this.resolveExpression(
|
|
36002
|
+
expression,
|
|
36003
|
+
this.initialScope(),
|
|
36004
|
+
expected
|
|
36005
|
+
);
|
|
36006
|
+
this.requireAssignable(resolved.type, expected, expression.pos, "value");
|
|
36007
|
+
}
|
|
35827
36008
|
persistedListenerCompletions(receiver, expected) {
|
|
35828
36009
|
const scope = this.initialScope();
|
|
35829
36010
|
let receiverType = this.context.thisClass;
|
|
@@ -40845,7 +41026,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
40845
41026
|
resolveExecutableObjectInitializer(schemaClass2, expression, scope, expected) {
|
|
40846
41027
|
const settling = this.generatedConstructorSettlingEntries(
|
|
40847
41028
|
schemaClass2,
|
|
40848
|
-
expression
|
|
41029
|
+
expression,
|
|
41030
|
+
expected
|
|
40849
41031
|
);
|
|
40850
41032
|
const constructed = settling.length > 0 ? this.resolveClassConstructor(
|
|
40851
41033
|
schemaClass2.name,
|
|
@@ -40924,7 +41106,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
40924
41106
|
};
|
|
40925
41107
|
}
|
|
40926
41108
|
/** Block entries naming a required parameter the positional arguments skip. */
|
|
40927
|
-
generatedConstructorSettlingEntries(schemaClass2, expression) {
|
|
41109
|
+
generatedConstructorSettlingEntries(schemaClass2, expression, expected) {
|
|
40928
41110
|
const signature = schemaClass2.constructorSignature;
|
|
40929
41111
|
if (signature === void 0) return [];
|
|
40930
41112
|
const generated = isGeneratedPositionalCall(schemaClass2, expression) || (schemaClass2.declaredConstructors?.length ?? 0) === 0 && expression.argumentNames === void 0;
|
|
@@ -40932,7 +41114,11 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
40932
41114
|
const required = new Set(
|
|
40933
41115
|
requiredMembersAfterArguments(
|
|
40934
41116
|
schemaClass2,
|
|
40935
|
-
|
|
41117
|
+
closedConstructorParameters(
|
|
41118
|
+
signature.parameters,
|
|
41119
|
+
this.constructorTargetType(schemaClass2, expression, expected),
|
|
41120
|
+
schemaClass2
|
|
41121
|
+
),
|
|
40936
41122
|
expression.args.length
|
|
40937
41123
|
).map((name) => name.toLowerCase())
|
|
40938
41124
|
);
|
|
@@ -40969,9 +41155,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
40969
41155
|
}
|
|
40970
41156
|
const signature = replayingStoredConstruction ? schemaClass2.storedConstructionReplaySignature ?? schemaClass2.constructorSignature : schemaClass2.constructorSignature;
|
|
40971
41157
|
if (!signature) {
|
|
40972
|
-
const open = (schemaClass2.typeParameters?.length ?? 0) > 0;
|
|
40973
41158
|
throw new CompileError(
|
|
40974
|
-
|
|
41159
|
+
`Class '${className}' does not expose a generated public constructor.`,
|
|
40975
41160
|
pos
|
|
40976
41161
|
);
|
|
40977
41162
|
}
|
|
@@ -40980,19 +41165,11 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
40980
41165
|
expression,
|
|
40981
41166
|
expected
|
|
40982
41167
|
);
|
|
40983
|
-
const parameters =
|
|
40984
|
-
|
|
40985
|
-
|
|
40986
|
-
|
|
40987
|
-
|
|
40988
|
-
schemaClass2
|
|
40989
|
-
),
|
|
40990
|
-
parameterType: substituteTypeParameters(
|
|
40991
|
-
parameter3.parameterType,
|
|
40992
|
-
targetType,
|
|
40993
|
-
schemaClass2
|
|
40994
|
-
)
|
|
40995
|
-
}));
|
|
41168
|
+
const parameters = closedConstructorParameters(
|
|
41169
|
+
signature.parameters,
|
|
41170
|
+
targetType,
|
|
41171
|
+
schemaClass2
|
|
41172
|
+
);
|
|
40996
41173
|
const argumentsList2 = expression.args;
|
|
40997
41174
|
if (expression.argumentNames !== void 0) {
|
|
40998
41175
|
throw new CompileError(
|
|
@@ -41081,15 +41258,34 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
41081
41258
|
);
|
|
41082
41259
|
}
|
|
41083
41260
|
if (typeArguments !== void 0) {
|
|
41084
|
-
|
|
41261
|
+
const target = {
|
|
41085
41262
|
kind: "named",
|
|
41086
41263
|
typeId: schemaClass2.id,
|
|
41087
41264
|
typeArguments
|
|
41088
41265
|
};
|
|
41266
|
+
assertTypeArgumentConstraints(
|
|
41267
|
+
schemaClass2,
|
|
41268
|
+
target,
|
|
41269
|
+
expression.pos,
|
|
41270
|
+
this.project
|
|
41271
|
+
);
|
|
41272
|
+
assertDirectTypeParameterArguments(target, expression.pos, this.project);
|
|
41273
|
+
return target;
|
|
41089
41274
|
}
|
|
41090
41275
|
if (expected?.kind === "named" && expected.typeId === schemaClass2.id) {
|
|
41276
|
+
assertDirectTypeParameterArguments(
|
|
41277
|
+
expected,
|
|
41278
|
+
expression.pos,
|
|
41279
|
+
this.project
|
|
41280
|
+
);
|
|
41091
41281
|
return { ...expected, nullable: false };
|
|
41092
41282
|
}
|
|
41283
|
+
if ((schemaClass2.typeParameters?.length ?? 0) > 0) {
|
|
41284
|
+
throw new CompileError(
|
|
41285
|
+
`Cannot construct open generic Class '${schemaClass2.name}'; pass its type arguments.`,
|
|
41286
|
+
expression.pos
|
|
41287
|
+
);
|
|
41288
|
+
}
|
|
41093
41289
|
return {
|
|
41094
41290
|
kind: "named",
|
|
41095
41291
|
typeId: schemaClass2.id
|
|
@@ -43969,6 +44165,25 @@ function variable(id, type, pointer, project) {
|
|
|
43969
44165
|
function isGeneratedPositionalCall(target, expression) {
|
|
43970
44166
|
return neoScriptRequiredConstructor(target) === null && target.constructorSignature !== void 0 && expression.argumentNames === void 0 && callHasPositionalArguments(expression);
|
|
43971
44167
|
}
|
|
44168
|
+
function closedConstructorParameters(parameters, targetType, schemaClass2) {
|
|
44169
|
+
return parameters.map((parameter3) => {
|
|
44170
|
+
const valueType = substituteTypeParameters(
|
|
44171
|
+
parameter3.valueType,
|
|
44172
|
+
targetType,
|
|
44173
|
+
schemaClass2
|
|
44174
|
+
);
|
|
44175
|
+
return {
|
|
44176
|
+
...parameter3,
|
|
44177
|
+
valueType,
|
|
44178
|
+
parameterType: substituteTypeParameters(
|
|
44179
|
+
parameter3.parameterType,
|
|
44180
|
+
targetType,
|
|
44181
|
+
schemaClass2
|
|
44182
|
+
),
|
|
44183
|
+
required: parameter3.required && valueType.nullable !== true
|
|
44184
|
+
};
|
|
44185
|
+
});
|
|
44186
|
+
}
|
|
43972
44187
|
function requiredMembersAfterArguments(schemaClass2, parameters, positionalCount) {
|
|
43973
44188
|
const names = [];
|
|
43974
44189
|
for (const parameter3 of parameters.slice(positionalCount)) {
|
|
@@ -45303,6 +45518,7 @@ function resolveNeoScriptType(type, context, project) {
|
|
|
45303
45518
|
)
|
|
45304
45519
|
} : {}
|
|
45305
45520
|
};
|
|
45521
|
+
assertTypeArgumentConstraints(named, resolved, type.pos, project);
|
|
45306
45522
|
break;
|
|
45307
45523
|
}
|
|
45308
45524
|
case "list":
|
|
@@ -45335,6 +45551,31 @@ function resolveNeoScriptType(type, context, project) {
|
|
|
45335
45551
|
}
|
|
45336
45552
|
return { ...resolved, nullable: !type.required };
|
|
45337
45553
|
}
|
|
45554
|
+
function wrappedTypeParameterMessage(target, project) {
|
|
45555
|
+
for (const argument2 of target.typeArguments ?? []) {
|
|
45556
|
+
if (argument2.kind === "typeParameter") continue;
|
|
45557
|
+
if (!containsTypeParameter(argument2)) continue;
|
|
45558
|
+
return `Cannot construct '${formatType(target, project)}': type argument '${formatType(argument2, project)}' wraps a type parameter. Pass the type parameter itself or a closed type.`;
|
|
45559
|
+
}
|
|
45560
|
+
return null;
|
|
45561
|
+
}
|
|
45562
|
+
function assertDirectTypeParameterArguments(target, pos, project) {
|
|
45563
|
+
const message = wrappedTypeParameterMessage(target, project);
|
|
45564
|
+
if (message !== null) throw new CompileError(message, pos);
|
|
45565
|
+
}
|
|
45566
|
+
function assertTypeArgumentConstraints(declaring, type, pos, project) {
|
|
45567
|
+
declaring.typeParameters?.forEach((parameter3, index) => {
|
|
45568
|
+
const argument2 = type.typeArguments?.[index];
|
|
45569
|
+
const constraint = parameter3.type.kind === "typeParameter" ? parameter3.type.constraint : void 0;
|
|
45570
|
+
if (argument2 === void 0 || constraint === void 0) return;
|
|
45571
|
+
const expected = substituteTypeParameters(constraint, type, declaring);
|
|
45572
|
+
if (isNeoScriptTypeAssignable(argument2, expected, project)) return;
|
|
45573
|
+
throw new CompileError(
|
|
45574
|
+
`Type argument '${formatType(argument2, project)}' does not satisfy '${parameter3.name} extends ${formatType(expected, project)}' on '${declaring.name}'.`,
|
|
45575
|
+
pos
|
|
45576
|
+
);
|
|
45577
|
+
});
|
|
45578
|
+
}
|
|
45338
45579
|
function intersectCollectionWritability(left, right) {
|
|
45339
45580
|
if (left === right) return left;
|
|
45340
45581
|
const writable = (value) => value === "local" /* Local */ || value === "save" /* Save */ || value === "session" /* Session */ || value === "runtime" /* Runtime */;
|
|
@@ -45739,9 +45980,6 @@ function attachConstructorSignature(type, environment) {
|
|
|
45739
45980
|
type.id,
|
|
45740
45981
|
environment
|
|
45741
45982
|
);
|
|
45742
|
-
for (const binding of genericEnvironment.values()) {
|
|
45743
|
-
if (binding.kind === "unbound") return type;
|
|
45744
|
-
}
|
|
45745
45983
|
return {
|
|
45746
45984
|
...type,
|
|
45747
45985
|
...buildNeoScriptConstructionSignatures(
|
|
@@ -45754,7 +45992,7 @@ function attachConstructorSignature(type, environment) {
|
|
|
45754
45992
|
environment
|
|
45755
45993
|
);
|
|
45756
45994
|
return member ? {
|
|
45757
|
-
required: boolean(member.required, `member ${memberId}.required`),
|
|
45995
|
+
required: member.kind === "generic" || boolean(member.required, `member ${memberId}.required`),
|
|
45758
45996
|
defaultValue: member.defaultValue,
|
|
45759
45997
|
immutable: declaredStorage(
|
|
45760
45998
|
environment.members.get(memberId),
|
|
@@ -48031,9 +48269,6 @@ function classToLanguageType(schemaClass2, context) {
|
|
|
48031
48269
|
}
|
|
48032
48270
|
function constructorSignature(schemaClass2, members, context, genericEnvironment) {
|
|
48033
48271
|
if (isAbstractClass(schemaClass2)) return {};
|
|
48034
|
-
if (!isClosedClass(schemaClass2.id, context.vm.classes)) {
|
|
48035
|
-
return {};
|
|
48036
|
-
}
|
|
48037
48272
|
return buildNeoScriptConstructionSignatures(
|
|
48038
48273
|
schemaClass2.id,
|
|
48039
48274
|
members,
|
|
@@ -48041,14 +48276,16 @@ function constructorSignature(schemaClass2, members, context, genericEnvironment
|
|
|
48041
48276
|
const record4 = analyzerMemberById(context, memberId);
|
|
48042
48277
|
if (!record4) return null;
|
|
48043
48278
|
try {
|
|
48044
|
-
const
|
|
48279
|
+
const declared = resolveAnalyzerMember(context, record4);
|
|
48280
|
+
const open = isMemberGenericBase(declared) && genericEnvironment.get(declared.genericParamId)?.kind === "unbound";
|
|
48281
|
+
const resolved = open ? declared : substituteMember(
|
|
48045
48282
|
record4,
|
|
48046
48283
|
genericEnvironment,
|
|
48047
48284
|
context.vm.members,
|
|
48048
|
-
|
|
48285
|
+
declared
|
|
48049
48286
|
);
|
|
48050
48287
|
return {
|
|
48051
|
-
required: isRequiredMember(resolved),
|
|
48288
|
+
required: open || isRequiredMember(resolved),
|
|
48052
48289
|
defaultValue: "defaultValue" in resolved ? resolved.defaultValue : void 0,
|
|
48053
48290
|
immutable: declaredMemberStorage(record4.id, context.vm.members) === 1 /* Immutable */
|
|
48054
48291
|
};
|
|
@@ -49264,25 +49501,33 @@ function compileNSInitializer(code, ctx) {
|
|
|
49264
49501
|
);
|
|
49265
49502
|
}
|
|
49266
49503
|
try {
|
|
49267
|
-
const { lexicalThisClass, ...compilerContext } = ctx;
|
|
49504
|
+
const { lexicalThisClass, declaringClass, ...compilerContext } = ctx;
|
|
49505
|
+
const context = createContext(
|
|
49506
|
+
{
|
|
49507
|
+
...compilerContext,
|
|
49508
|
+
thisClass: lexicalThisClass ?? null,
|
|
49509
|
+
implicitMemberAccess: lexicalThisClass !== null,
|
|
49510
|
+
staticMember: false
|
|
49511
|
+
},
|
|
49512
|
+
{
|
|
49513
|
+
scriptKind: "initializer",
|
|
49514
|
+
returnTypeInfo: ctx.returnTypeInfo,
|
|
49515
|
+
...ctx.argumentTypes === void 0 ? {} : { functionArguments: ctx.argumentTypes },
|
|
49516
|
+
...ctx.initializerName === void 0 ? {} : { functionName: ctx.initializerName },
|
|
49517
|
+
dialogueContext: null
|
|
49518
|
+
}
|
|
49519
|
+
);
|
|
49268
49520
|
return compileStrict(
|
|
49269
49521
|
`return
|
|
49270
49522
|
${code};`,
|
|
49271
|
-
|
|
49272
|
-
|
|
49273
|
-
|
|
49274
|
-
|
|
49275
|
-
|
|
49276
|
-
|
|
49277
|
-
},
|
|
49278
|
-
{
|
|
49279
|
-
scriptKind: "initializer",
|
|
49280
|
-
returnTypeInfo: ctx.returnTypeInfo,
|
|
49281
|
-
...ctx.argumentTypes === void 0 ? {} : { functionArguments: ctx.argumentTypes },
|
|
49282
|
-
...ctx.initializerName === void 0 ? {} : { functionName: ctx.initializerName },
|
|
49283
|
-
dialogueContext: null
|
|
49523
|
+
declaringClass ? {
|
|
49524
|
+
...context,
|
|
49525
|
+
declaringType: {
|
|
49526
|
+
kind: "named",
|
|
49527
|
+
typeId: declaringClass.id,
|
|
49528
|
+
nullable: false
|
|
49284
49529
|
}
|
|
49285
|
-
|
|
49530
|
+
} : context
|
|
49286
49531
|
);
|
|
49287
49532
|
} catch (error) {
|
|
49288
49533
|
throw withInitializerSourcePosition(error);
|
|
@@ -49519,6 +49764,7 @@ function compileMemberInitializerBody(args) {
|
|
|
49519
49764
|
`Member "${args.member.name}" has an initializer but no resolvable declared type.`
|
|
49520
49765
|
);
|
|
49521
49766
|
}
|
|
49767
|
+
const instanceClass = isStaticMember(args.member) ? null : args.thisClass;
|
|
49522
49768
|
let compiled;
|
|
49523
49769
|
try {
|
|
49524
49770
|
compiled = compileUnit2(
|
|
@@ -49530,8 +49776,10 @@ function compileMemberInitializerBody(args) {
|
|
|
49530
49776
|
variantFolders: args.variantFolders ?? [],
|
|
49531
49777
|
returnTypeInfo,
|
|
49532
49778
|
initializerName: args.member.name,
|
|
49779
|
+
lexicalThisClass: parseExpression(defaultValue.init.code).kind === "lambda" ? instanceClass : null,
|
|
49780
|
+
declaringClass: instanceClass,
|
|
49533
49781
|
argumentTypes: initializerArgumentTypes(
|
|
49534
|
-
|
|
49782
|
+
instanceClass,
|
|
49535
49783
|
args.constructors ?? []
|
|
49536
49784
|
)
|
|
49537
49785
|
})
|
|
@@ -49576,6 +49824,7 @@ function compileValueRowInitializerBody(args) {
|
|
|
49576
49824
|
returnTypeInfo,
|
|
49577
49825
|
initializerName: args.member.name,
|
|
49578
49826
|
lexicalThisClass: args.lexicalThisClass ?? null,
|
|
49827
|
+
declaringClass: args.initializerOwnerClass,
|
|
49579
49828
|
argumentTypes: initializerArgumentTypes(
|
|
49580
49829
|
args.initializerOwnerClass,
|
|
49581
49830
|
args.constructors ?? []
|
|
@@ -56940,7 +57189,7 @@ var INITIALIZER_KEY_PLACEHOLDER = new RegExp(
|
|
|
56940
57189
|
|
|
56941
57190
|
// ../packages/manifest/schema-contract/registry.mjs
|
|
56942
57191
|
var PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
56943
|
-
cliVersion: "0.77.
|
|
57192
|
+
cliVersion: "0.77.1",
|
|
56944
57193
|
projectFileUploadBatchSize: 32,
|
|
56945
57194
|
documentRecords: {
|
|
56946
57195
|
member: {
|