@neocompose/cli 0.84.1 → 0.84.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/neo-runtime.mjs +684 -217
- package/dist/test-worker.mjs +314 -78
- 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/neoscript.md +21 -0
- package/skills/neocompose-cli/references/values-identities-and-references.md +11 -0
package/dist/test-worker.mjs
CHANGED
|
@@ -15965,6 +15965,22 @@ function neoScriptMemberLookupType(type) {
|
|
|
15965
15965
|
}
|
|
15966
15966
|
return nullable2 && current.nullable !== true ? { ...current, nullable: true } : current;
|
|
15967
15967
|
}
|
|
15968
|
+
function neoScriptMemberReceiverType(type, memberName, project) {
|
|
15969
|
+
const primary = neoScriptMemberLookupType(type);
|
|
15970
|
+
if (primary.kind !== "named" || primary.narrowedInterfaces === void 0)
|
|
15971
|
+
return primary;
|
|
15972
|
+
const declaration = project.typeById.get(primary.typeId);
|
|
15973
|
+
if (declaration?.kind === "class" && (memberName === NEOSCRIPT_CLASS_ID_MEMBER || memberName === "Clone"))
|
|
15974
|
+
return primary;
|
|
15975
|
+
if (declaration?.members.some((member) => member.name === memberName))
|
|
15976
|
+
return primary;
|
|
15977
|
+
for (const bound of Object.values(primary.narrowedInterfaces)) {
|
|
15978
|
+
if (project.typeById.get(bound.typeId)?.members.some((member) => member.name === memberName)) {
|
|
15979
|
+
return { ...bound, nullable: primary.nullable === true };
|
|
15980
|
+
}
|
|
15981
|
+
}
|
|
15982
|
+
return primary;
|
|
15983
|
+
}
|
|
15968
15984
|
function isNeoScriptHandleReferenceTarget(target, isValueType) {
|
|
15969
15985
|
switch (target.kind) {
|
|
15970
15986
|
case "list":
|
|
@@ -16288,6 +16304,20 @@ function isNeoScriptTypeAssignable(source, target, project) {
|
|
|
16288
16304
|
if (isUnknownType(source) || isUnknownType(target)) return false;
|
|
16289
16305
|
if (isNullType(source)) return isNullableType2(target);
|
|
16290
16306
|
if (isNullableType2(source) && !isNullableType2(target)) return false;
|
|
16307
|
+
if (target.kind === "named" && target.narrowedInterfaces !== void 0) {
|
|
16308
|
+
for (const bound of Object.values(target.narrowedInterfaces)) {
|
|
16309
|
+
if (!isNeoScriptTypeAssignable(source, bound, project)) return false;
|
|
16310
|
+
}
|
|
16311
|
+
}
|
|
16312
|
+
if (source.kind === "named" && source.narrowedInterfaces !== void 0) {
|
|
16313
|
+
const direct = target.kind === "named" ? source.narrowedInterfaces[target.typeId] : void 0;
|
|
16314
|
+
if (direct !== void 0 && isNeoScriptTypeAssignable(direct, target, project))
|
|
16315
|
+
return true;
|
|
16316
|
+
for (const bound of Object.values(source.narrowedInterfaces)) {
|
|
16317
|
+
if (bound !== direct && isNeoScriptTypeAssignable(bound, target, project))
|
|
16318
|
+
return true;
|
|
16319
|
+
}
|
|
16320
|
+
}
|
|
16291
16321
|
if (source.kind === "primitive" && target.kind === "primitive") {
|
|
16292
16322
|
if (source.name === target.name) return true;
|
|
16293
16323
|
return source.name === "int" && (target.name === "float" || target.name === "decimal");
|
|
@@ -16372,9 +16402,40 @@ function isNeoScriptTypeAssignable(source, target, project) {
|
|
|
16372
16402
|
}
|
|
16373
16403
|
return false;
|
|
16374
16404
|
}
|
|
16405
|
+
function withoutNeoScriptInterfaceProofs(type) {
|
|
16406
|
+
if (type.kind !== "named" || type.narrowedInterfaces === void 0)
|
|
16407
|
+
return type;
|
|
16408
|
+
const { narrowedInterfaces: _proofs, ...declared } = type;
|
|
16409
|
+
return declared;
|
|
16410
|
+
}
|
|
16375
16411
|
function commonNeoScriptAssignableType(left, right, project) {
|
|
16376
16412
|
if (isNeoScriptTypeAssignable(left, right, project)) return right;
|
|
16377
16413
|
if (isNeoScriptTypeAssignable(right, left, project)) return left;
|
|
16414
|
+
if (left.kind === "named" && right.kind === "named" && (left.narrowedInterfaces !== void 0 || right.narrowedInterfaces !== void 0)) {
|
|
16415
|
+
const declaredLeft = withoutNeoScriptInterfaceProofs(left);
|
|
16416
|
+
const declaredRight = withoutNeoScriptInterfaceProofs(right);
|
|
16417
|
+
const common = commonNeoScriptAssignableType(
|
|
16418
|
+
declaredLeft,
|
|
16419
|
+
declaredRight,
|
|
16420
|
+
project
|
|
16421
|
+
);
|
|
16422
|
+
if (common?.kind !== "named") return null;
|
|
16423
|
+
const proofs = {};
|
|
16424
|
+
for (const [source, other] of [
|
|
16425
|
+
[left, right],
|
|
16426
|
+
[right, left]
|
|
16427
|
+
]) {
|
|
16428
|
+
for (const [id, proof] of Object.entries(
|
|
16429
|
+
source.narrowedInterfaces ?? {}
|
|
16430
|
+
)) {
|
|
16431
|
+
if (proofs[id] !== void 0) continue;
|
|
16432
|
+
const opposite = other.narrowedInterfaces?.[id] ?? other;
|
|
16433
|
+
if (isNeoScriptTypeAssignable(opposite, proof, project))
|
|
16434
|
+
proofs[id] = proof;
|
|
16435
|
+
}
|
|
16436
|
+
}
|
|
16437
|
+
return { ...common, narrowedInterfaces: proofs };
|
|
16438
|
+
}
|
|
16378
16439
|
return null;
|
|
16379
16440
|
}
|
|
16380
16441
|
function isNeoVariantTypeId(typeId, project) {
|
|
@@ -21196,6 +21257,7 @@ function createdSessionValuesSince(ctx, checkpoint) {
|
|
|
21196
21257
|
return created;
|
|
21197
21258
|
}
|
|
21198
21259
|
function exportInitializerCollections(created, writes, ctx) {
|
|
21260
|
+
const inPlace = (value) => value instanceof RuntimeSet ? exportRuntimeSetValue(value, ctx) : value;
|
|
21199
21261
|
const assignedValues = /* @__PURE__ */ new Set();
|
|
21200
21262
|
const mutatedIds = /* @__PURE__ */ new Set();
|
|
21201
21263
|
for (const write of writes) {
|
|
@@ -21203,83 +21265,134 @@ function exportInitializerCollections(created, writes, ctx) {
|
|
|
21203
21265
|
if (destination !== void 0 && "containerValueId" in destination)
|
|
21204
21266
|
mutatedIds.add(destination.containerValueId);
|
|
21205
21267
|
if (write.kind === "assign" && write.valueId === void 0 && typeof write.value === "object" && write.value !== null) {
|
|
21206
|
-
assignedValues.add(write.value);
|
|
21268
|
+
assignedValues.add(inPlace(write.value));
|
|
21207
21269
|
}
|
|
21208
21270
|
}
|
|
21209
21271
|
const candidates = /* @__PURE__ */ new Set();
|
|
21272
|
+
const inlineFieldsByRowId = /* @__PURE__ */ new Map();
|
|
21210
21273
|
for (const row of created) {
|
|
21211
|
-
|
|
21274
|
+
const inlineFields = inlineCollectionFields(row, ctx);
|
|
21275
|
+
if (inlineFields !== null) inlineFieldsByRowId.set(row.id, inlineFields);
|
|
21276
|
+
if (inlineFields !== null || assignedValues.has(inPlace(row.value)) || row.classId === void 0 && mutatedIds.has(row.id) || Array.isArray(row.value) && row.value.length > 0 && ctx.__unorderedListProjections?.byContainerId.has(row.id)) {
|
|
21212
21277
|
candidates.add(row.id);
|
|
21213
21278
|
}
|
|
21214
21279
|
}
|
|
21215
21280
|
if (candidates.size === 0) return created;
|
|
21216
21281
|
invalidateEvaluatorIndexes(ctx, null);
|
|
21217
21282
|
const extra = [];
|
|
21218
|
-
const
|
|
21219
|
-
|
|
21220
|
-
const member = memberForValueRow(row, ctx);
|
|
21221
|
-
if (member === null) return row;
|
|
21222
|
-
if (!isMemberWithEntries(member)) return row;
|
|
21223
|
-
if (isMemberEntryCollectionBase(member) && listKindOf(member) === 1 /* Unordered */) {
|
|
21224
|
-
return { ...row, value: [] };
|
|
21225
|
-
}
|
|
21226
|
-
if (!assignedValues.has(row.value) && !mutatedIds.has(row.id)) return row;
|
|
21227
|
-
const values = [];
|
|
21283
|
+
const encode = (member, value, genericEnv, collectionOwnerId) => {
|
|
21284
|
+
const rows = [];
|
|
21228
21285
|
const declarations = /* @__PURE__ */ new Map();
|
|
21229
|
-
const
|
|
21230
|
-
overlayConcreteGenericEntries(
|
|
21231
|
-
genericEnv,
|
|
21232
|
-
envFromStamp(row.genericBindings)
|
|
21233
|
-
);
|
|
21234
|
-
const materialized = materializeConstructorArgumentValue({
|
|
21286
|
+
const root = materializeConstructorArgumentValue({
|
|
21235
21287
|
member,
|
|
21236
|
-
value
|
|
21288
|
+
value,
|
|
21237
21289
|
genericEnv,
|
|
21238
21290
|
ctx,
|
|
21239
|
-
createdValues:
|
|
21291
|
+
createdValues: rows,
|
|
21240
21292
|
createdById: /* @__PURE__ */ new Map(),
|
|
21241
21293
|
storageKeyDeclarations: declarations,
|
|
21242
|
-
collectionEntriesAreReferences: assignedValues.has(
|
|
21243
|
-
collectionOwnerId
|
|
21294
|
+
collectionEntriesAreReferences: assignedValues.has(value) ? false : void 0,
|
|
21295
|
+
collectionOwnerId
|
|
21244
21296
|
});
|
|
21245
|
-
const
|
|
21246
|
-
|
|
21247
|
-
|
|
21248
|
-
|
|
21249
|
-
|
|
21250
|
-
|
|
21251
|
-
groupId ?? row.id,
|
|
21252
|
-
ctx
|
|
21253
|
-
);
|
|
21297
|
+
const children = rows.filter((row) => row !== root);
|
|
21298
|
+
return { root, children, declarations };
|
|
21299
|
+
};
|
|
21300
|
+
const adopt = (owner, rootId, rows, declarations) => {
|
|
21301
|
+
const groupId = constructorGroupForRow(owner.id, ctx);
|
|
21302
|
+
retargetConstructorGroupDependencies(rootId, groupId ?? owner.id, ctx);
|
|
21254
21303
|
if (groupId !== null) {
|
|
21255
21304
|
const state = ctx.__executionState;
|
|
21256
21305
|
const group = state?.constructorGroups.get(groupId);
|
|
21257
|
-
for (const
|
|
21258
|
-
retargetConstructorGroupDependencies(
|
|
21259
|
-
group?.add(
|
|
21260
|
-
state?.constructorGroupByRowId.set(
|
|
21306
|
+
for (const row of rows) {
|
|
21307
|
+
retargetConstructorGroupDependencies(row.id, groupId, ctx);
|
|
21308
|
+
group?.add(row.id);
|
|
21309
|
+
state?.constructorGroupByRowId.set(row.id, groupId);
|
|
21261
21310
|
}
|
|
21262
21311
|
}
|
|
21263
|
-
stampCreatedValuesMapKey(
|
|
21312
|
+
stampCreatedValuesMapKey(rows, owner.mapKey);
|
|
21264
21313
|
applyDeclaredStorageKeyOverrides({
|
|
21265
|
-
createdValues: [
|
|
21314
|
+
createdValues: [owner, ...rows],
|
|
21266
21315
|
declarationByValueId: declarations
|
|
21267
21316
|
});
|
|
21268
|
-
for (const
|
|
21269
|
-
if (!isLiteralValueContent(
|
|
21317
|
+
for (const row of rows) {
|
|
21318
|
+
if (!isLiteralValueContent(row)) {
|
|
21270
21319
|
throw new NSGetterRuntimeError(
|
|
21271
21320
|
"Initializer collection produced an unevaluated row."
|
|
21272
21321
|
);
|
|
21273
21322
|
}
|
|
21274
|
-
extra.push(
|
|
21323
|
+
extra.push(row);
|
|
21275
21324
|
}
|
|
21276
21325
|
for (const [id, declaration] of declarations) {
|
|
21277
21326
|
ctx.__createdStorageKeyDeclarations?.set(id, declaration);
|
|
21278
21327
|
}
|
|
21328
|
+
};
|
|
21329
|
+
const exported = created.map((row) => {
|
|
21330
|
+
if (!candidates.has(row.id)) return row;
|
|
21331
|
+
const inlineFields = inlineFieldsByRowId.get(row.id);
|
|
21332
|
+
if (inlineFields !== void 0) {
|
|
21333
|
+
const record4 = { ...inlineFields.record };
|
|
21334
|
+
const encoded2 = { ...row, value: record4 };
|
|
21335
|
+
for (const [key, member2] of inlineFields.members) {
|
|
21336
|
+
const { root: root2, children: children2, declarations: declarations2 } = encode(
|
|
21337
|
+
member2,
|
|
21338
|
+
inPlace(record4[key]),
|
|
21339
|
+
inlineFields.genericEnv
|
|
21340
|
+
);
|
|
21341
|
+
record4[key] = root2.id;
|
|
21342
|
+
adopt(encoded2, root2.id, [root2, ...children2], declarations2);
|
|
21343
|
+
}
|
|
21344
|
+
return encoded2;
|
|
21345
|
+
}
|
|
21346
|
+
const member = memberForValueRow(row, ctx);
|
|
21347
|
+
if (member === null) return row;
|
|
21348
|
+
if (!isMemberWithEntries(member)) return row;
|
|
21349
|
+
if (isMemberEntryCollectionBase(member) && listKindOf(member) === 1 /* Unordered */) {
|
|
21350
|
+
return { ...row, value: [] };
|
|
21351
|
+
}
|
|
21352
|
+
const value = inPlace(row.value);
|
|
21353
|
+
if (!assignedValues.has(value) && !mutatedIds.has(row.id)) return row;
|
|
21354
|
+
const { root, children, declarations } = encode(
|
|
21355
|
+
member,
|
|
21356
|
+
value,
|
|
21357
|
+
rowGenericEnv(row, ctx),
|
|
21358
|
+
row.id
|
|
21359
|
+
);
|
|
21360
|
+
const encoded = { ...row, value: root.value };
|
|
21361
|
+
declarations.delete(root.id);
|
|
21362
|
+
adopt(encoded, root.id, children, declarations);
|
|
21279
21363
|
return encoded;
|
|
21280
21364
|
});
|
|
21281
21365
|
return [...exported, ...extra];
|
|
21282
21366
|
}
|
|
21367
|
+
function inlineCollectionFields(row, ctx) {
|
|
21368
|
+
if (typeof row.classId !== "string") return null;
|
|
21369
|
+
if (!isPlainRecord(row.value)) return null;
|
|
21370
|
+
let fields = null;
|
|
21371
|
+
for (const key in row.value) {
|
|
21372
|
+
const value = row.value[key];
|
|
21373
|
+
if (typeof value !== "object" || value === null) continue;
|
|
21374
|
+
const rawMember = memberForCustomSchemaValue(row.classId, key, ctx);
|
|
21375
|
+
if (rawMember === null) continue;
|
|
21376
|
+
fields ??= {
|
|
21377
|
+
record: row.value,
|
|
21378
|
+
members: /* @__PURE__ */ new Map(),
|
|
21379
|
+
genericEnv: rowGenericEnv(row, ctx)
|
|
21380
|
+
};
|
|
21381
|
+
const member = substituteMember(
|
|
21382
|
+
rawMember,
|
|
21383
|
+
fields.genericEnv,
|
|
21384
|
+
ctx.vm.members,
|
|
21385
|
+
cachedResolvedMember(rawMember, ctx)
|
|
21386
|
+
);
|
|
21387
|
+
if (isMemberWithEntries(member)) fields.members.set(key, member);
|
|
21388
|
+
}
|
|
21389
|
+
return fields === null || fields.members.size === 0 ? null : fields;
|
|
21390
|
+
}
|
|
21391
|
+
function rowGenericEnv(row, ctx) {
|
|
21392
|
+
const genericEnv = runtimeGenericEnvForValueRow(row, ctx, /* @__PURE__ */ new Set());
|
|
21393
|
+
overlayConcreteGenericEntries(genericEnv, envFromStamp(row.genericBindings));
|
|
21394
|
+
return genericEnv;
|
|
21395
|
+
}
|
|
21283
21396
|
function prepareSessionValueExport(ctx, checkpoint, writes) {
|
|
21284
21397
|
const created = createdSessionValuesSince(ctx, checkpoint);
|
|
21285
21398
|
if (created.length === 0) return;
|
|
@@ -32814,6 +32927,7 @@ function clonedConstructorProvenance(source) {
|
|
|
32814
32927
|
}
|
|
32815
32928
|
function cloneConstructorLiteralValue(value) {
|
|
32816
32929
|
if (typeof value !== "object" || value === null) return value;
|
|
32930
|
+
if (value instanceof NSSlotReference) return value.targetId;
|
|
32817
32931
|
if (Array.isArray(value)) {
|
|
32818
32932
|
return value.map((entry) => cloneConstructorLiteralValue(entry));
|
|
32819
32933
|
}
|
|
@@ -35539,7 +35653,8 @@ var Parser = class _Parser {
|
|
|
35539
35653
|
}
|
|
35540
35654
|
if (isIdentifier(t) && t.text === NEOSCRIPT_CONSTRUCTOR_KEYWORD) {
|
|
35541
35655
|
this.next();
|
|
35542
|
-
const
|
|
35656
|
+
const classToken = isIdentifier(this.peek()) ? this.next() : null;
|
|
35657
|
+
const className = classToken?.text ?? null;
|
|
35543
35658
|
const typeArguments = [];
|
|
35544
35659
|
if (this.eat("operator", "<")) {
|
|
35545
35660
|
if (className === null) {
|
|
@@ -35573,6 +35688,7 @@ var Parser = class _Parser {
|
|
|
35573
35688
|
return {
|
|
35574
35689
|
kind: "new",
|
|
35575
35690
|
className,
|
|
35691
|
+
...classToken ? { classNamePos: at(classToken) } : {},
|
|
35576
35692
|
...typeArguments.length > 0 ? { typeArguments } : {},
|
|
35577
35693
|
args,
|
|
35578
35694
|
...hasArgumentList ? { hasArgumentList: true } : {},
|
|
@@ -37073,7 +37189,7 @@ var MaterializedValueGraphContext = class _MaterializedValueGraphContext {
|
|
|
37073
37189
|
const typeInfo = parameterTypes.get(parameterId);
|
|
37074
37190
|
return [
|
|
37075
37191
|
parameterId,
|
|
37076
|
-
typeInfo !== void 0 && isAggregateTypeInfo(typeInfo) && typeof argument2 === "string" ? rewriteId(argument2) : argument2
|
|
37192
|
+
typeInfo !== void 0 && (isAggregateTypeInfo(typeInfo) || typeInfo.type === 29 /* Reference */) && typeof argument2 === "string" ? rewriteId(argument2) : argument2
|
|
37077
37193
|
];
|
|
37078
37194
|
}
|
|
37079
37195
|
)
|
|
@@ -37109,6 +37225,41 @@ var MaterializedValueGraphContext = class _MaterializedValueGraphContext {
|
|
|
37109
37225
|
ids.push(edge.targetValueId);
|
|
37110
37226
|
return ids;
|
|
37111
37227
|
}
|
|
37228
|
+
/** The targets a row's Reference creation data names (P112 §1.1). */
|
|
37229
|
+
referenceArgumentIds(row) {
|
|
37230
|
+
if (!isLiteralValueContent(row)) return [];
|
|
37231
|
+
const args = row.constructorArgs;
|
|
37232
|
+
if (args === void 0 || args === null) return [];
|
|
37233
|
+
const ids = [];
|
|
37234
|
+
for (const parameterId of this.referenceParameterIds(row)) {
|
|
37235
|
+
const argument2 = args[parameterId];
|
|
37236
|
+
if (typeof argument2 === "string") ids.push(argument2);
|
|
37237
|
+
}
|
|
37238
|
+
return ids;
|
|
37239
|
+
}
|
|
37240
|
+
/** Creation data with each Reference argument's target remapped (P112 §1.1). */
|
|
37241
|
+
remapReferenceArguments(row, remap, contextualMember) {
|
|
37242
|
+
const args = row.constructorArgs;
|
|
37243
|
+
if (args === void 0 || args === null) return args;
|
|
37244
|
+
let remapped;
|
|
37245
|
+
for (const parameterId of this.referenceParameterIds(
|
|
37246
|
+
row,
|
|
37247
|
+
contextualMember
|
|
37248
|
+
)) {
|
|
37249
|
+
const argument2 = args[parameterId];
|
|
37250
|
+
if (typeof argument2 !== "string") continue;
|
|
37251
|
+
const target = remap(argument2);
|
|
37252
|
+
if (target !== argument2) (remapped ??= { ...args })[parameterId] = target;
|
|
37253
|
+
}
|
|
37254
|
+
return remapped ?? args;
|
|
37255
|
+
}
|
|
37256
|
+
*referenceParameterIds(row, contextualMember) {
|
|
37257
|
+
for (const [parameterId, typeInfo] of this.constructorParameterTypes(
|
|
37258
|
+
row,
|
|
37259
|
+
contextualMember
|
|
37260
|
+
))
|
|
37261
|
+
if (typeInfo.type === 29 /* Reference */) yield parameterId;
|
|
37262
|
+
}
|
|
37112
37263
|
slotEntries(row) {
|
|
37113
37264
|
const value = row.value;
|
|
37114
37265
|
switch (this.referenceSlots(row.id, void 0, value)) {
|
|
@@ -38130,7 +38281,11 @@ function resolveVirtualInstanceGraph(args) {
|
|
|
38130
38281
|
}
|
|
38131
38282
|
}
|
|
38132
38283
|
}
|
|
38133
|
-
const virtualRow = rewriteExpandedRow(
|
|
38284
|
+
const virtualRow = rewriteExpandedRow(
|
|
38285
|
+
indexed,
|
|
38286
|
+
expansion,
|
|
38287
|
+
materializedGraph
|
|
38288
|
+
);
|
|
38134
38289
|
const location = {
|
|
38135
38290
|
id: effectiveId2,
|
|
38136
38291
|
instanceRootId: args.instanceRoot.id,
|
|
@@ -39384,7 +39539,7 @@ function indexExpansion(args) {
|
|
|
39384
39539
|
membersById
|
|
39385
39540
|
};
|
|
39386
39541
|
}
|
|
39387
|
-
function rewriteExpandedRow(node, expansion) {
|
|
39542
|
+
function rewriteExpandedRow(node, expansion, graph) {
|
|
39388
39543
|
const rewrite = (id) => expansion.nodesByExpandedId.get(id)?.virtualId ?? id;
|
|
39389
39544
|
const row = cloneRow(node.expandedRow);
|
|
39390
39545
|
row.id = node.virtualId;
|
|
@@ -39406,6 +39561,12 @@ function rewriteExpandedRow(node, expansion) {
|
|
|
39406
39561
|
if (node.member.kind === 9 /* Lookup */) {
|
|
39407
39562
|
row.value = remapLookupSelection(row.value, rewrite);
|
|
39408
39563
|
}
|
|
39564
|
+
if (isLiteralValueContent(row) && row.constructorArgs !== void 0)
|
|
39565
|
+
row.constructorArgs = graph.remapReferenceArguments(
|
|
39566
|
+
row,
|
|
39567
|
+
rewrite,
|
|
39568
|
+
node.member
|
|
39569
|
+
);
|
|
39409
39570
|
if (typeof row.containerId === "string") {
|
|
39410
39571
|
row.containerId = rewrite(row.containerId);
|
|
39411
39572
|
}
|
|
@@ -44500,7 +44661,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
44500
44661
|
statement.init.pos
|
|
44501
44662
|
);
|
|
44502
44663
|
}
|
|
44503
|
-
const localType = declared ?? initial.type;
|
|
44664
|
+
const localType = declared ?? withoutNeoScriptInterfaceProofs(initial.type);
|
|
44504
44665
|
if (declared) {
|
|
44505
44666
|
this.requireAssignable(
|
|
44506
44667
|
initial.type,
|
|
@@ -44515,16 +44676,18 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
44515
44676
|
initial.pointer,
|
|
44516
44677
|
this.project
|
|
44517
44678
|
);
|
|
44518
|
-
|
|
44519
|
-
|
|
44520
|
-
|
|
44521
|
-
|
|
44522
|
-
|
|
44523
|
-
|
|
44524
|
-
|
|
44525
|
-
this.localWriteTargetRoot(initial, scope)
|
|
44526
|
-
)
|
|
44679
|
+
const entry = scopeVariable(
|
|
44680
|
+
statement.name,
|
|
44681
|
+
local,
|
|
44682
|
+
localType,
|
|
44683
|
+
"local" /* Local */,
|
|
44684
|
+
localOwnership(initial),
|
|
44685
|
+
this.localWriteTargetRoot(initial, scope)
|
|
44527
44686
|
);
|
|
44687
|
+
scope.define(entry);
|
|
44688
|
+
if (inferred && localType !== initial.type) {
|
|
44689
|
+
scope.narrow(statement.name, entry, initial.type);
|
|
44690
|
+
}
|
|
44528
44691
|
return { type: "variable" /* Variable */, variable: local };
|
|
44529
44692
|
}
|
|
44530
44693
|
case "if": {
|
|
@@ -44579,7 +44742,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
44579
44742
|
mergeBranchInvalidations(scope, branchExitOwnershipScopes);
|
|
44580
44743
|
if (branchExitNarrowings.length > 0) {
|
|
44581
44744
|
for (const [path, narrowed] of mergeNarrowingMaps(
|
|
44582
|
-
branchExitNarrowings
|
|
44745
|
+
branchExitNarrowings,
|
|
44746
|
+
this.project
|
|
44583
44747
|
)) {
|
|
44584
44748
|
const rootEntry = scope.lookup(pathRoot(path));
|
|
44585
44749
|
if (rootEntry === narrowed.rootEntry) {
|
|
@@ -45505,7 +45669,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
45505
45669
|
}
|
|
45506
45670
|
mergeLoopNarrowings(parent, exitPaths) {
|
|
45507
45671
|
if (exitPaths.length === 0) return;
|
|
45508
|
-
const merged = mergeNarrowingMaps(exitPaths);
|
|
45672
|
+
const merged = mergeNarrowingMaps(exitPaths, this.project);
|
|
45509
45673
|
for (const [path, narrowed] of parent.effectiveNarrowedPaths()) {
|
|
45510
45674
|
const common = merged.get(path);
|
|
45511
45675
|
if (parent.containsEntry(narrowed.rootEntry) && (common?.rootEntry !== narrowed.rootEntry || !typeRefsEqual(common.type, narrowed.type))) {
|
|
@@ -47258,8 +47422,13 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
47258
47422
|
expression.receiver,
|
|
47259
47423
|
scope
|
|
47260
47424
|
);
|
|
47261
|
-
|
|
47262
|
-
|
|
47425
|
+
const memberType2 = neoScriptMemberReceiverType(
|
|
47426
|
+
receiverExpression.type,
|
|
47427
|
+
expression.name,
|
|
47428
|
+
this.project
|
|
47429
|
+
);
|
|
47430
|
+
if (memberType2.kind !== "named") return null;
|
|
47431
|
+
owner = this.project.typeById.get(memberType2.typeId);
|
|
47263
47432
|
symbol = owner?.members.find(
|
|
47264
47433
|
(candidate) => candidate.name === expression.name && (candidate.kind === "function" || candidate.kind === "method")
|
|
47265
47434
|
);
|
|
@@ -47270,7 +47439,10 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
47270
47439
|
expression.pos
|
|
47271
47440
|
);
|
|
47272
47441
|
}
|
|
47273
|
-
receiver = {
|
|
47442
|
+
receiver = {
|
|
47443
|
+
kind: "instance",
|
|
47444
|
+
expression: { ...receiverExpression, type: memberType2 }
|
|
47445
|
+
};
|
|
47274
47446
|
}
|
|
47275
47447
|
} else {
|
|
47276
47448
|
return null;
|
|
@@ -47347,9 +47519,13 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
47347
47519
|
if (symbol === void 0 || symbol.static !== true) return null;
|
|
47348
47520
|
} else {
|
|
47349
47521
|
const receiver2 = this.resolveExpression(expression.receiver, scope);
|
|
47350
|
-
|
|
47351
|
-
|
|
47352
|
-
|
|
47522
|
+
receiverType = neoScriptMemberReceiverType(
|
|
47523
|
+
receiver2.type,
|
|
47524
|
+
expression.name,
|
|
47525
|
+
this.project
|
|
47526
|
+
);
|
|
47527
|
+
if (receiverType.kind !== "named") return null;
|
|
47528
|
+
owner = this.project.typeById.get(receiverType.typeId);
|
|
47353
47529
|
symbol = owner?.members.find(
|
|
47354
47530
|
(candidate) => candidate.name === expression.name && (candidate.kind === "function" || candidate.kind === "method")
|
|
47355
47531
|
);
|
|
@@ -47427,6 +47603,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
47427
47603
|
pos
|
|
47428
47604
|
);
|
|
47429
47605
|
}
|
|
47606
|
+
entryType = withoutNeoScriptInterfaceProofs(entryType);
|
|
47430
47607
|
for (const item of resolved) {
|
|
47431
47608
|
const common = commonNeoScriptAssignableType(
|
|
47432
47609
|
entryType,
|
|
@@ -47451,7 +47628,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
47451
47628
|
}
|
|
47452
47629
|
const type = {
|
|
47453
47630
|
kind: "list",
|
|
47454
|
-
elementType: entryType
|
|
47631
|
+
elementType: withoutNeoScriptInterfaceProofs(entryType)
|
|
47455
47632
|
};
|
|
47456
47633
|
const wire = toWireType(type, this.project);
|
|
47457
47634
|
if (wire.type !== 6 /* List */) {
|
|
@@ -47517,6 +47694,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
47517
47694
|
if (!keyType || !valueType) {
|
|
47518
47695
|
throw new CompileError("Dictionary literal type inference failed.", pos);
|
|
47519
47696
|
}
|
|
47697
|
+
valueType = withoutNeoScriptInterfaceProofs(valueType);
|
|
47520
47698
|
for (const entry of resolved) {
|
|
47521
47699
|
if (expectedDictionary) {
|
|
47522
47700
|
this.requireAssignable(
|
|
@@ -47543,7 +47721,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
47543
47721
|
const type = {
|
|
47544
47722
|
kind: "dictionary",
|
|
47545
47723
|
keyType,
|
|
47546
|
-
valueType
|
|
47724
|
+
valueType: withoutNeoScriptInterfaceProofs(valueType)
|
|
47547
47725
|
};
|
|
47548
47726
|
const wire = toWireType(type, this.project);
|
|
47549
47727
|
if (wire.type !== 5 /* Dictionary */) {
|
|
@@ -47799,8 +47977,19 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
47799
47977
|
const target = this.resolveType(fact.targetType);
|
|
47800
47978
|
const targetDefinition = target.kind === "named" ? this.project.typeById.get(target.typeId) : void 0;
|
|
47801
47979
|
const naturalDefinition = natural.type.kind === "named" ? this.project.typeById.get(natural.type.typeId) : void 0;
|
|
47802
|
-
|
|
47803
|
-
|
|
47980
|
+
let narrowed = { ...target, nullable: false };
|
|
47981
|
+
if (!fact.bindingName && natural.type.kind === "named" && (naturalDefinition?.kind === "class" || naturalDefinition?.kind === "interface") && target.kind === "named" && targetDefinition?.kind === "interface") {
|
|
47982
|
+
narrowed = { ...natural.type, nullable: false };
|
|
47983
|
+
if (!isNeoScriptTypeAssignable(narrowed, target, this.project)) {
|
|
47984
|
+
narrowed = {
|
|
47985
|
+
...narrowed,
|
|
47986
|
+
narrowedInterfaces: {
|
|
47987
|
+
...natural.type.narrowedInterfaces,
|
|
47988
|
+
[target.typeId]: target
|
|
47989
|
+
}
|
|
47990
|
+
};
|
|
47991
|
+
}
|
|
47992
|
+
}
|
|
47804
47993
|
if (mode === "all" && fact.path !== null && rootEntry !== null && place.type.kind !== "reference") {
|
|
47805
47994
|
targetScope.narrow(fact.path, rootEntry, narrowed);
|
|
47806
47995
|
}
|
|
@@ -48393,7 +48582,11 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
48393
48582
|
if (receiver.dialogues !== void 0) {
|
|
48394
48583
|
return this.resolveDialogueGroupRead(receiver, name, pos);
|
|
48395
48584
|
}
|
|
48396
|
-
const memberReceiverType =
|
|
48585
|
+
const memberReceiverType = neoScriptMemberReceiverType(
|
|
48586
|
+
receiver.type,
|
|
48587
|
+
name,
|
|
48588
|
+
this.project
|
|
48589
|
+
);
|
|
48397
48590
|
if (memberReceiverType.kind === "named") {
|
|
48398
48591
|
const type = this.project.typeById.get(memberReceiverType.typeId);
|
|
48399
48592
|
if (!type) {
|
|
@@ -49205,7 +49398,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
49205
49398
|
}
|
|
49206
49399
|
const type = {
|
|
49207
49400
|
kind: "list",
|
|
49208
|
-
elementType: entryType
|
|
49401
|
+
elementType: withoutNeoScriptInterfaceProofs(entryType)
|
|
49209
49402
|
};
|
|
49210
49403
|
const wire = toWireType(type, this.project);
|
|
49211
49404
|
if (wire.type !== 6 /* List */) {
|
|
@@ -49446,7 +49639,11 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
49446
49639
|
pos
|
|
49447
49640
|
);
|
|
49448
49641
|
}
|
|
49449
|
-
const memberReceiverType =
|
|
49642
|
+
const memberReceiverType = neoScriptMemberReceiverType(
|
|
49643
|
+
receiver.type,
|
|
49644
|
+
callee.name,
|
|
49645
|
+
this.project
|
|
49646
|
+
);
|
|
49450
49647
|
const namedType2 = memberReceiverType.kind === "named" ? this.project.typeById.get(memberReceiverType.typeId) : void 0;
|
|
49451
49648
|
const member = namedType2?.members.find(
|
|
49452
49649
|
(candidate) => (candidate.kind === "function" || candidate.kind === "method") && candidate.name === callee.name
|
|
@@ -51871,7 +52068,11 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
51871
52068
|
}
|
|
51872
52069
|
const receiver = receiverValue();
|
|
51873
52070
|
if (receiver.dialogues !== void 0) return null;
|
|
51874
|
-
const memberReceiverType =
|
|
52071
|
+
const memberReceiverType = neoScriptMemberReceiverType(
|
|
52072
|
+
receiver.type,
|
|
52073
|
+
memberName,
|
|
52074
|
+
this.project
|
|
52075
|
+
);
|
|
51875
52076
|
if (memberReceiverType.kind !== "named") return null;
|
|
51876
52077
|
const type = this.project.typeById.get(memberReceiverType.typeId);
|
|
51877
52078
|
const symbol = type?.members.find(
|
|
@@ -53032,17 +53233,22 @@ function mergeFactSets(sets) {
|
|
|
53032
53233
|
)
|
|
53033
53234
|
);
|
|
53034
53235
|
}
|
|
53035
|
-
function mergeNarrowingMaps(maps) {
|
|
53236
|
+
function mergeNarrowingMaps(maps, project) {
|
|
53036
53237
|
const first = maps[0];
|
|
53037
53238
|
if (!first) return /* @__PURE__ */ new Map();
|
|
53038
53239
|
const result = /* @__PURE__ */ new Map();
|
|
53039
53240
|
for (const [path, narrowed] of first) {
|
|
53040
|
-
|
|
53041
|
-
|
|
53042
|
-
|
|
53043
|
-
|
|
53044
|
-
|
|
53241
|
+
let common = narrowed.type;
|
|
53242
|
+
for (let index = 1; index < maps.length; index++) {
|
|
53243
|
+
const candidate = maps[index].get(path);
|
|
53244
|
+
if (candidate?.rootEntry !== narrowed.rootEntry) {
|
|
53245
|
+
common = null;
|
|
53246
|
+
break;
|
|
53247
|
+
}
|
|
53248
|
+
common = commonNeoScriptAssignableType(common, candidate.type, project);
|
|
53249
|
+
if (common === null) break;
|
|
53045
53250
|
}
|
|
53251
|
+
if (common !== null) result.set(path, { ...narrowed, type: common });
|
|
53046
53252
|
}
|
|
53047
53253
|
return result;
|
|
53048
53254
|
}
|
|
@@ -53071,6 +53277,16 @@ function typeRefsEqual(left, right) {
|
|
|
53071
53277
|
if (left.kind === "named" && right.kind === "named") {
|
|
53072
53278
|
const leftArgs = left.typeArguments ?? [];
|
|
53073
53279
|
const rightArgs = right.typeArguments ?? [];
|
|
53280
|
+
if (left.narrowedInterfaces !== right.narrowedInterfaces) {
|
|
53281
|
+
const leftBounds = Object.entries(left.narrowedInterfaces ?? {});
|
|
53282
|
+
const rightBounds = right.narrowedInterfaces ?? {};
|
|
53283
|
+
if (leftBounds.length !== Object.keys(rightBounds).length) return false;
|
|
53284
|
+
for (const [id, leftBound] of leftBounds) {
|
|
53285
|
+
const rightBound = rightBounds[id];
|
|
53286
|
+
if (rightBound === void 0 || !typeRefsEqual(leftBound, rightBound))
|
|
53287
|
+
return false;
|
|
53288
|
+
}
|
|
53289
|
+
}
|
|
53074
53290
|
return left.typeId === right.typeId && leftArgs.length === rightArgs.length && leftArgs.every((item, index) => {
|
|
53075
53291
|
const other = rightArgs[index];
|
|
53076
53292
|
return other !== void 0 && typeRefsEqual(item, other);
|
|
@@ -54050,6 +54266,10 @@ function typesOverlap(left, right, project) {
|
|
|
54050
54266
|
if (isUnknown(left) || isUnknown(right)) return true;
|
|
54051
54267
|
if (isNull(left)) return isNullable(right);
|
|
54052
54268
|
if (isNull(right)) return isNullable(left);
|
|
54269
|
+
left = neoScriptMemberLookupType(left);
|
|
54270
|
+
right = neoScriptMemberLookupType(right);
|
|
54271
|
+
if (left.kind === "typeParameter" || right.kind === "typeParameter")
|
|
54272
|
+
return true;
|
|
54053
54273
|
if (isNeoScriptTypeAssignable(left, right, project) || isNeoScriptTypeAssignable(right, left, project))
|
|
54054
54274
|
return true;
|
|
54055
54275
|
if (left.kind === "named" && right.kind === "named") {
|
|
@@ -63988,13 +64208,29 @@ function memberSavedForStorage(ctx, memberId, contextSaved, declarationClassId)
|
|
|
63988
64208
|
if (isWritableConstraint(classStorage)) return true;
|
|
63989
64209
|
if (classStorage === 1 /* Immutable */) return false;
|
|
63990
64210
|
}
|
|
63991
|
-
|
|
64211
|
+
let effective = ctx.storageResolver.effectiveStorages(memberId);
|
|
64212
|
+
const visited = /* @__PURE__ */ new Set([memberId]);
|
|
64213
|
+
let currentId = memberId;
|
|
64214
|
+
let baseId = member?.extendsMemberId;
|
|
64215
|
+
while (effective.size === 0 && baseId !== void 0 && !visited.has(baseId)) {
|
|
64216
|
+
if (!isResolvedAbstract(ctx, currentId) && !isResolvedAbstract(ctx, baseId))
|
|
64217
|
+
break;
|
|
64218
|
+
visited.add(baseId);
|
|
64219
|
+
effective = ctx.storageResolver.effectiveStorages(baseId);
|
|
64220
|
+
currentId = baseId;
|
|
64221
|
+
baseId = ctx.exportData.members[baseId]?.extendsMemberId;
|
|
64222
|
+
}
|
|
63992
64223
|
const hasWritable = effective.has(2 /* Save */) || effective.has(3 /* Session */);
|
|
63993
64224
|
const hasStatic = effective.has(1 /* Immutable */);
|
|
63994
64225
|
if (hasWritable && !hasStatic) return true;
|
|
63995
64226
|
if (hasStatic && !hasWritable) return false;
|
|
63996
64227
|
return contextSaved;
|
|
63997
64228
|
}
|
|
64229
|
+
function isResolvedAbstract(ctx, memberId) {
|
|
64230
|
+
return isAbstractMember(
|
|
64231
|
+
resolveMemberById(ctx, memberId, `members.${memberId}`)
|
|
64232
|
+
);
|
|
64233
|
+
}
|
|
63998
64234
|
function classAllowedStorage(ctx, classId) {
|
|
63999
64235
|
return ctx.storageResolver.allowedStorage(classId);
|
|
64000
64236
|
}
|
|
@@ -64876,7 +65112,7 @@ function typeInfoConstructedSuffix(ctx, typeInfo, saved, genericEnv, genericBind
|
|
|
64876
65112
|
const argType = csharpTypeInfoValueType(
|
|
64877
65113
|
ctx,
|
|
64878
65114
|
argInfo,
|
|
64879
|
-
|
|
65115
|
+
true,
|
|
64880
65116
|
genericEnv,
|
|
64881
65117
|
genericBindingSaved
|
|
64882
65118
|
);
|