@neocompose/cli 0.89.7 → 0.89.8
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 +12 -0
- package/dist/neo-runtime.mjs +316 -223
- package/dist/test-worker.mjs +146 -219
- package/package.json +1 -1
- package/skills/neocompose-cli/SKILL.md +1 -1
- package/skills/neocompose-cli/references/cli-development.md +6 -1
- package/skills/neocompose-cli/references/declarations/constructors.md +4 -0
- package/skills/neocompose-cli/references/declarations/initializers.md +9 -0
- package/skills/neocompose-cli/references/neoscript/collections.md +9 -1
package/dist/neo-runtime.mjs
CHANGED
|
@@ -19407,7 +19407,7 @@ var init_registry = __esm({
|
|
|
19407
19407
|
"../packages/manifest/schema-contract/registry.mjs"() {
|
|
19408
19408
|
"use strict";
|
|
19409
19409
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
19410
|
-
cliVersion: "0.89.
|
|
19410
|
+
cliVersion: "0.89.8",
|
|
19411
19411
|
projectFileUploadBatchSize: 32,
|
|
19412
19412
|
documentRecords: {
|
|
19413
19413
|
member: {
|
|
@@ -28481,15 +28481,7 @@ function calculateDeclarationSignature(ctx, projectionClassId, schemaKey, declar
|
|
|
28481
28481
|
declarationClassId: declaration.classDef.id,
|
|
28482
28482
|
memberId: declaration.memberId,
|
|
28483
28483
|
isAbstract: isAbstractMember(member) === true,
|
|
28484
|
-
isVirtual: isVirtualMember(member) !== false
|
|
28485
|
-
// Openness belongs to the DECLARING class, not to whoever is asking: a
|
|
28486
|
-
// descendant that closes the param still has to see a declaration it is
|
|
28487
|
-
// obliged to implement.
|
|
28488
|
-
requiresClosingImplementation: lookupDeclaredTypeInfo(member) === null ? false : lookupNarrowingAwaitsClosingBinding(
|
|
28489
|
-
ctx,
|
|
28490
|
-
member,
|
|
28491
|
-
resolveGenericEnvForEmission(ctx, declaration.classDef.id)
|
|
28492
|
-
)
|
|
28484
|
+
isVirtual: isVirtualMember(member) !== false
|
|
28493
28485
|
};
|
|
28494
28486
|
if (isCallableMemberForCodegen(member)) {
|
|
28495
28487
|
const parameterTypes = member.argumentTypes.map(
|
|
@@ -28699,7 +28691,7 @@ function generatedInstanceMemberSignaturesEqual(left, right) {
|
|
|
28699
28691
|
return false;
|
|
28700
28692
|
}
|
|
28701
28693
|
function emitsAbstractDeclaration(signature2) {
|
|
28702
|
-
return signature2.isAbstract
|
|
28694
|
+
return signature2.isAbstract;
|
|
28703
28695
|
}
|
|
28704
28696
|
function resolveGeneratedInstanceMemberPlan(ctx, classDef, schemaKey) {
|
|
28705
28697
|
const declaration = ownInstanceMemberDeclaration(classDef, schemaKey);
|
|
@@ -30892,11 +30884,6 @@ function lookupHasRuntimeOwnership(member) {
|
|
|
30892
30884
|
function lookupNarrowsThroughGenericParam(member) {
|
|
30893
30885
|
return lookupDeclaredTypeInfo(member)?.type === 21 /* Generic */;
|
|
30894
30886
|
}
|
|
30895
|
-
function lookupNarrowingAwaitsClosingBinding(ctx, member, env) {
|
|
30896
|
-
if (!lookupNarrowsThroughGenericParam(member)) return false;
|
|
30897
|
-
if (lookupProjection(ctx, member) !== "class" /* Class */) return false;
|
|
30898
|
-
return lookupTargetClassProjection(ctx, member, env) === null;
|
|
30899
|
-
}
|
|
30900
30887
|
function lookupTargetValueType(ctx, member, saved, env) {
|
|
30901
30888
|
if (!isMemberLookupBase(member)) return "NeoLookupSelection";
|
|
30902
30889
|
const targetSaved = lookupTargetSaved(ctx, member) ?? saved;
|
|
@@ -40831,11 +40818,10 @@ function remapRuntimeReferences(value, overlay2, seen, preservedReferences) {
|
|
|
40831
40818
|
const next = {};
|
|
40832
40819
|
seen.set(value, next);
|
|
40833
40820
|
for (const [key, entry] of Object.entries(value)) {
|
|
40834
|
-
|
|
40835
|
-
|
|
40836
|
-
|
|
40837
|
-
seen,
|
|
40838
|
-
preservedReferences
|
|
40821
|
+
setOwnField(
|
|
40822
|
+
next,
|
|
40823
|
+
key,
|
|
40824
|
+
remapRuntimeReferences(entry, overlay2, seen, preservedReferences)
|
|
40839
40825
|
);
|
|
40840
40826
|
}
|
|
40841
40827
|
return next;
|
|
@@ -42635,7 +42621,7 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
42635
42621
|
if (entryId !== null) {
|
|
42636
42622
|
const collection = Array.isArray(receiver) ? receiver : objectArg(receiver, "Assignment target");
|
|
42637
42623
|
const entryKey = typeof key === "number" ? key : String(key);
|
|
42638
|
-
|
|
42624
|
+
setOwnField(collection, String(entryKey), entryId);
|
|
42639
42625
|
recordWrittenEntry(collection, entryKey, true, ctx);
|
|
42640
42626
|
if (!indexRuntimeCollectionChange(
|
|
42641
42627
|
collection,
|
|
@@ -42731,7 +42717,7 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
42731
42717
|
);
|
|
42732
42718
|
noteDetachedRow(object2[stringKey], referenceValueId, ctx);
|
|
42733
42719
|
}
|
|
42734
|
-
object2
|
|
42720
|
+
setOwnField(object2, stringKey, referenceValueId);
|
|
42735
42721
|
if (!field) recordWrittenEntry(object2, stringKey, true, ctx);
|
|
42736
42722
|
if (field || !indexRuntimeCollectionEntryWrite(
|
|
42737
42723
|
object2,
|
|
@@ -42747,7 +42733,7 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
42747
42733
|
return;
|
|
42748
42734
|
if (field && (targetTypeInfo.type === 7 /* Class */ || targetTypeInfo.type === 22 /* Interface */))
|
|
42749
42735
|
noteDetachedRow(object2[stringKey], value, ctx);
|
|
42750
|
-
object2
|
|
42736
|
+
setOwnField(object2, stringKey, value);
|
|
42751
42737
|
if (!field) recordWrittenEntry(object2, stringKey, false, ctx);
|
|
42752
42738
|
const scalarField = (previous == null || typeof previous === "number" || typeof previous === "boolean" || typeof previous === "string") && (value == null || typeof value === "number" || typeof value === "boolean" || typeof value === "string");
|
|
42753
42739
|
if (field && !scalarField || !indexRuntimeCollectionEntryWrite(object2, previous, value, stringKey, ctx))
|
|
@@ -42829,7 +42815,7 @@ function copiedCollectionContents(source, entryTypeInfo, slotId, ctx) {
|
|
|
42829
42815
|
}
|
|
42830
42816
|
}
|
|
42831
42817
|
if (Array.isArray(copy)) copy.push(entry);
|
|
42832
|
-
else copy
|
|
42818
|
+
else setOwnField(copy, String(key), entry);
|
|
42833
42819
|
return 0 /* Continue */;
|
|
42834
42820
|
});
|
|
42835
42821
|
const cache = unorderedListProjectionCache(ctx);
|
|
@@ -42898,107 +42884,6 @@ function keepAssignedCollectionValues(value, targetTypeInfo, row, ctx) {
|
|
|
42898
42884
|
return 0 /* Continue */;
|
|
42899
42885
|
});
|
|
42900
42886
|
}
|
|
42901
|
-
function pendingConstructorRootsForRow(valueId, ctx) {
|
|
42902
|
-
const roots = /* @__PURE__ */ new Set();
|
|
42903
|
-
const open2 = ctx.__executionState?.openConstructions;
|
|
42904
|
-
if (open2 === void 0 || open2.size === 0) return roots;
|
|
42905
|
-
const visited = /* @__PURE__ */ new Set();
|
|
42906
|
-
const pending = [valueId];
|
|
42907
|
-
const parentEntries = /* @__PURE__ */ new Map();
|
|
42908
|
-
const placingMembers = /* @__PURE__ */ new Map();
|
|
42909
|
-
while (pending.length > 0) {
|
|
42910
|
-
const id2 = pending.pop();
|
|
42911
|
-
if (id2 === void 0 || visited.has(id2)) continue;
|
|
42912
|
-
visited.add(id2);
|
|
42913
|
-
const row = evalValueById(
|
|
42914
|
-
ctx,
|
|
42915
|
-
id2,
|
|
42916
|
-
ctx.__runtimeSessionValues,
|
|
42917
|
-
ctx.__valueOverlay
|
|
42918
|
-
);
|
|
42919
|
-
if (row === null) continue;
|
|
42920
|
-
if (typeof row.value === "object" && row.value !== null && open2.has(row.value))
|
|
42921
|
-
roots.add(id2);
|
|
42922
|
-
for (const owner of currentOwnedValueAttachments(
|
|
42923
|
-
id2,
|
|
42924
|
-
ctx,
|
|
42925
|
-
parentEntries,
|
|
42926
|
-
placingMembers
|
|
42927
|
-
)) {
|
|
42928
|
-
if (!owner.identity.startsWith("value:")) continue;
|
|
42929
|
-
const parent = evalValueById(
|
|
42930
|
-
ctx,
|
|
42931
|
-
owner.label,
|
|
42932
|
-
ctx.__runtimeSessionValues,
|
|
42933
|
-
ctx.__valueOverlay
|
|
42934
|
-
);
|
|
42935
|
-
if (parent === null) continue;
|
|
42936
|
-
if (parent.classId === void 0 || parent.classId === null) {
|
|
42937
|
-
const raw = placingMember(
|
|
42938
|
-
parent,
|
|
42939
|
-
ctx,
|
|
42940
|
-
void 0,
|
|
42941
|
-
0,
|
|
42942
|
-
placingMembers,
|
|
42943
|
-
parentEntries
|
|
42944
|
-
);
|
|
42945
|
-
if (raw === null) continue;
|
|
42946
|
-
const member = raw.kind === 21 /* Generic */ ? substituteMember(raw, rowGenericEnv(parent, ctx), ctx.vm.members) : resolveMember(raw, ctx.vm.members);
|
|
42947
|
-
if (isMemberWithEntries(member)) {
|
|
42948
|
-
const rawEntry = evalMemberById(ctx.vm, member.entryMemberId);
|
|
42949
|
-
if (rawEntry === null) continue;
|
|
42950
|
-
const entry = rawEntry.kind === 21 /* Generic */ ? substituteMember(
|
|
42951
|
-
rawEntry,
|
|
42952
|
-
rowGenericEnv(parent, ctx),
|
|
42953
|
-
ctx.vm.members
|
|
42954
|
-
) : resolveMember(rawEntry, ctx.vm.members);
|
|
42955
|
-
if (entry.kind === 21 /* Generic */ || isMemberLookupBase(entry))
|
|
42956
|
-
continue;
|
|
42957
|
-
}
|
|
42958
|
-
}
|
|
42959
|
-
pending.push(owner.label);
|
|
42960
|
-
}
|
|
42961
|
-
for (const link of evaluatorParentLinks(evaluatorIndexes(ctx), id2)) {
|
|
42962
|
-
const parent = evalValueById(
|
|
42963
|
-
ctx,
|
|
42964
|
-
link.parentId,
|
|
42965
|
-
ctx.__runtimeSessionValues,
|
|
42966
|
-
ctx.__valueOverlay
|
|
42967
|
-
);
|
|
42968
|
-
if (parent === null || !Array.isArray(parent.value)) continue;
|
|
42969
|
-
const member = placingMember(
|
|
42970
|
-
parent,
|
|
42971
|
-
ctx,
|
|
42972
|
-
void 0,
|
|
42973
|
-
0,
|
|
42974
|
-
placingMembers,
|
|
42975
|
-
parentEntries
|
|
42976
|
-
);
|
|
42977
|
-
if (member === null || !isMemberTupleBase(member)) continue;
|
|
42978
|
-
const positions = ownershipParentEntryKeys(
|
|
42979
|
-
parent.value,
|
|
42980
|
-
id2,
|
|
42981
|
-
parentEntries
|
|
42982
|
-
);
|
|
42983
|
-
for (const position of positions ?? []) {
|
|
42984
|
-
if (typeof position !== "number") continue;
|
|
42985
|
-
const entryId = member.elementMemberIds[position];
|
|
42986
|
-
const rawEntry = entryId === void 0 ? null : evalMemberById(ctx.vm, entryId);
|
|
42987
|
-
if (rawEntry === null) continue;
|
|
42988
|
-
const entry = rawEntry.kind === 21 /* Generic */ ? substituteMember(
|
|
42989
|
-
rawEntry,
|
|
42990
|
-
rowGenericEnv(parent, ctx),
|
|
42991
|
-
ctx.vm.members
|
|
42992
|
-
) : resolveMember(rawEntry, ctx.vm.members);
|
|
42993
|
-
if (entry.kind === 21 /* Generic */ || isMemberLookupBase(entry))
|
|
42994
|
-
continue;
|
|
42995
|
-
pending.push(parent.id);
|
|
42996
|
-
break;
|
|
42997
|
-
}
|
|
42998
|
-
}
|
|
42999
|
-
}
|
|
43000
|
-
return roots;
|
|
43001
|
-
}
|
|
43002
42887
|
function preflightAssignedCollection(collection, member, row, ctx) {
|
|
43003
42888
|
if (member === null) return;
|
|
43004
42889
|
const env = rowGenericEnv(row, ctx);
|
|
@@ -43011,8 +42896,6 @@ function preflightAssignedCollection(collection, member, row, ctx) {
|
|
|
43011
42896
|
const attached = /* @__PURE__ */ new Set();
|
|
43012
42897
|
const preflight = {
|
|
43013
42898
|
parentEntries: /* @__PURE__ */ new Map(),
|
|
43014
|
-
constructorRootIds: pendingConstructorRootsForRow(row.id, ctx),
|
|
43015
|
-
constructorArgumentTransfers: /* @__PURE__ */ new Map(),
|
|
43016
42899
|
dependencies: /* @__PURE__ */ new Map()
|
|
43017
42900
|
};
|
|
43018
42901
|
forEachRawCollectionEntry(collection, ctx, ({ raw, key, valueId }) => {
|
|
@@ -43035,8 +42918,6 @@ function preflightAssignedCollection(collection, member, row, ctx) {
|
|
|
43035
42918
|
);
|
|
43036
42919
|
return 0 /* Continue */;
|
|
43037
42920
|
});
|
|
43038
|
-
for (const [id2, destination] of preflight.constructorArgumentTransfers)
|
|
43039
|
-
ctx.__executionState?.ownedValueAttachments.set(id2, destination);
|
|
43040
42921
|
for (const [id2, destination] of preflight.dependencies)
|
|
43041
42922
|
recordConstructorGroupDependency(id2, destination, ctx);
|
|
43042
42923
|
}
|
|
@@ -44874,7 +44755,11 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
|
|
|
44874
44755
|
}
|
|
44875
44756
|
return null;
|
|
44876
44757
|
}
|
|
44877
|
-
|
|
44758
|
+
setOwnField(
|
|
44759
|
+
objectArg(targetValue, "Dictionary Add target"),
|
|
44760
|
+
String(args[0]),
|
|
44761
|
+
args[1]
|
|
44762
|
+
);
|
|
44878
44763
|
return null;
|
|
44879
44764
|
case "Remove" /* Remove */:
|
|
44880
44765
|
if (Array.isArray(targetValue)) {
|
|
@@ -51206,6 +51091,7 @@ function publishConstructedRows(args) {
|
|
|
51206
51091
|
if (beforeRetain !== null) {
|
|
51207
51092
|
for (const rowId of beforeRetain) {
|
|
51208
51093
|
if (retained.has(rowId)) continue;
|
|
51094
|
+
if (constructorGroupForRow(rowId, ctx) !== null) continue;
|
|
51209
51095
|
deleteRuntimeSessionValue(ctx, rowId);
|
|
51210
51096
|
}
|
|
51211
51097
|
}
|
|
@@ -51291,16 +51177,55 @@ function assertImplicitConstructionAllowed(schemaClass2) {
|
|
|
51291
51177
|
`Class '${schemaClass2.name}' declares a required constructor, so it cannot be constructed without one.`
|
|
51292
51178
|
);
|
|
51293
51179
|
}
|
|
51180
|
+
function constructionReplayContext(descriptor, ctx) {
|
|
51181
|
+
if (ctx.storedConstructionReplay !== true) return ctx;
|
|
51182
|
+
const target = ctx.__storedInitializerReplay;
|
|
51183
|
+
let rowId;
|
|
51184
|
+
let candidate;
|
|
51185
|
+
if (target !== void 0) {
|
|
51186
|
+
const row = storedReplayRowById(target.rowId, ctx);
|
|
51187
|
+
if (row !== null && classIdForValueRow(row, ctx) === descriptor.schemaClass.id) {
|
|
51188
|
+
rowId = target.rowId;
|
|
51189
|
+
candidate = { reattached: false };
|
|
51190
|
+
target.candidates.push(candidate);
|
|
51191
|
+
}
|
|
51192
|
+
} else if (ctx.__executionState?.constructionStack.length === 0 && ctx.__storedConstructionReplaySlot?.classId === descriptor.schemaClass.id) {
|
|
51193
|
+
rowId = ctx.__storedConstructionReplayRowId;
|
|
51194
|
+
}
|
|
51195
|
+
return {
|
|
51196
|
+
...ctx,
|
|
51197
|
+
__storedInitializerReplay: void 0,
|
|
51198
|
+
__storedReplayCandidate: candidate,
|
|
51199
|
+
__storedConstructionReplayRowId: rowId,
|
|
51200
|
+
__storedConstructionReplayRootId: void 0,
|
|
51201
|
+
__storedConstructionReplaySlot: rowId === void 0 ? ctx.__storedConstructionReplaySlot : {
|
|
51202
|
+
classId: descriptor.schemaClass.id,
|
|
51203
|
+
classArguments: descriptor.classArguments ?? {}
|
|
51204
|
+
}
|
|
51205
|
+
};
|
|
51206
|
+
}
|
|
51207
|
+
function rollbackStoredConstructionReplay(ctx, checkpoint) {
|
|
51208
|
+
if (checkpoint === void 0) return;
|
|
51209
|
+
for (const row of createdSessionValuesSince(ctx, checkpoint))
|
|
51210
|
+
deleteRuntimeSessionValue(ctx, row.id);
|
|
51211
|
+
if (ctx.__storedReplayCandidate !== void 0)
|
|
51212
|
+
ctx.__storedReplayCandidate.reattached = false;
|
|
51213
|
+
}
|
|
51294
51214
|
function constructClassValue(info, scope, ctx) {
|
|
51295
51215
|
const descriptor = validateClassConstructorDescriptor(
|
|
51296
51216
|
info,
|
|
51297
51217
|
ctx,
|
|
51298
51218
|
ctx.constructionBaselineReplay !== true
|
|
51299
51219
|
);
|
|
51220
|
+
ctx = constructionReplayContext(descriptor, ctx);
|
|
51300
51221
|
assertImplicitConstructionAllowed(descriptor.schemaClass);
|
|
51222
|
+
const replayCheckpoint = ctx.__storedConstructionReplayRowId === void 0 ? void 0 : sessionCreationCheckpoint(ctx);
|
|
51301
51223
|
const closeFrame = pushConstructionFrame(ctx, descriptor.schemaClass.name);
|
|
51302
51224
|
try {
|
|
51303
51225
|
return constructClassValueWithinFrame(descriptor, scope, ctx);
|
|
51226
|
+
} catch (error) {
|
|
51227
|
+
rollbackStoredConstructionReplay(ctx, replayCheckpoint);
|
|
51228
|
+
throw error;
|
|
51304
51229
|
} finally {
|
|
51305
51230
|
closeFrame();
|
|
51306
51231
|
}
|
|
@@ -51400,6 +51325,8 @@ function constructClassValueWithinFrame(descriptor, scope, ctx) {
|
|
|
51400
51325
|
});
|
|
51401
51326
|
root.classId = classId;
|
|
51402
51327
|
stampConstructedRootGenericBindings(root, descriptor);
|
|
51328
|
+
if (ctx.__storedReplayCandidate !== void 0)
|
|
51329
|
+
ctx.__storedReplayCandidate.value = root.value;
|
|
51403
51330
|
if (typeof root.value !== "object" || root.value === null || Array.isArray(root.value)) {
|
|
51404
51331
|
throw new Error(
|
|
51405
51332
|
`Class constructor for '${schemaClass2.name}' produced a non-record root.`
|
|
@@ -51829,15 +51756,20 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
|
|
|
51829
51756
|
sourceValueId: sourceValueId ?? null,
|
|
51830
51757
|
compileMemberId: scopeMemberId
|
|
51831
51758
|
});
|
|
51759
|
+
const childId = storedInitializerChildId(member, ctx);
|
|
51760
|
+
const initializerCtx = childId === void 0 ? ctx : {
|
|
51761
|
+
...ctx,
|
|
51762
|
+
__storedInitializerReplay: { rowId: childId, candidates: [] }
|
|
51763
|
+
};
|
|
51832
51764
|
const evaluate = (argumentValues = []) => {
|
|
51833
|
-
|
|
51765
|
+
const result = withConstructionGenericSlots(
|
|
51834
51766
|
member,
|
|
51835
|
-
|
|
51767
|
+
initializerCtx,
|
|
51836
51768
|
genericEnv,
|
|
51837
51769
|
() => evaluateInitializerInContext(
|
|
51838
51770
|
init,
|
|
51839
51771
|
member,
|
|
51840
|
-
|
|
51772
|
+
initializerCtx,
|
|
51841
51773
|
createdValues,
|
|
51842
51774
|
argumentValues,
|
|
51843
51775
|
sourceValueId ?? null,
|
|
@@ -51845,6 +51777,17 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
|
|
|
51845
51777
|
genericEnv
|
|
51846
51778
|
)
|
|
51847
51779
|
);
|
|
51780
|
+
for (const candidate of initializerCtx.__storedInitializerReplay?.candidates ?? []) {
|
|
51781
|
+
if (!candidate.reattached) continue;
|
|
51782
|
+
if (candidate.value !== result.value) {
|
|
51783
|
+
throw new NSGetterRuntimeError(
|
|
51784
|
+
`Stored initializer '${member.name}' constructed an already owned value outside its returned child. Call Clone() explicitly.`
|
|
51785
|
+
);
|
|
51786
|
+
}
|
|
51787
|
+
if (ctx.__storedReplayCandidate !== void 0)
|
|
51788
|
+
ctx.__storedReplayCandidate.reattached = true;
|
|
51789
|
+
}
|
|
51790
|
+
return result;
|
|
51848
51791
|
};
|
|
51849
51792
|
const ownerClassId = scopeMemberId === null ? null : owningClassId(scopeMemberId);
|
|
51850
51793
|
const expectedArgumentCount = compiled.parameters.slice(2).length;
|
|
@@ -52057,6 +52000,13 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
|
|
|
52057
52000
|
(argument2) => trackedRowForValueReference(argument2, ctx)?.id === existingValueRow.id
|
|
52058
52001
|
)) {
|
|
52059
52002
|
assertInitializerPlacement(existingValueRow.id, member, ctx);
|
|
52003
|
+
if (storedInitializerChildId(member, ctx) === existingValueRow.id) {
|
|
52004
|
+
return {
|
|
52005
|
+
value: result.value,
|
|
52006
|
+
classId: existingRuntimeClassId,
|
|
52007
|
+
existingValueRow
|
|
52008
|
+
};
|
|
52009
|
+
}
|
|
52060
52010
|
}
|
|
52061
52011
|
if (existingValueRow !== null && existingRuntimeClassId !== null && isClassSlotMember(member)) {
|
|
52062
52012
|
const storage = constructorArgumentStorage(existingValueRow.id, ctx);
|
|
@@ -52260,18 +52210,14 @@ function encodeRequiredConstructorArgument(args) {
|
|
|
52260
52210
|
args.ctx.__valueOverlay
|
|
52261
52211
|
) !== null ? args.value : null;
|
|
52262
52212
|
const adoptTracked = (id2, suffix) => {
|
|
52263
|
-
|
|
52264
|
-
|
|
52265
|
-
|
|
52266
|
-
{
|
|
52267
|
-
|
|
52268
|
-
|
|
52269
|
-
|
|
52270
|
-
|
|
52271
|
-
args.ctx,
|
|
52272
|
-
true
|
|
52273
|
-
);
|
|
52274
|
-
}
|
|
52213
|
+
recordConstructorGroupDependency(
|
|
52214
|
+
id2,
|
|
52215
|
+
{
|
|
52216
|
+
identity: `value:${args.ownerRootId}:constructorArg:${args.parameterId}:${suffix}`,
|
|
52217
|
+
label: args.ownerRootId
|
|
52218
|
+
},
|
|
52219
|
+
args.ctx
|
|
52220
|
+
);
|
|
52275
52221
|
return id2;
|
|
52276
52222
|
};
|
|
52277
52223
|
if (args.typeInfo.type === 21 /* Generic */) {
|
|
@@ -53192,7 +53138,8 @@ function constructDeclaredClassValue(info, scope, ctx) {
|
|
|
53192
53138
|
const descriptor = validateClassConstructorDescriptor(info, ctx, false);
|
|
53193
53139
|
const schemaClass2 = descriptor.schemaClass;
|
|
53194
53140
|
const record7 = resolveDeclaredConstructorRecord(info, schemaClass2, ctx);
|
|
53195
|
-
|
|
53141
|
+
ctx = constructionReplayContext(descriptor, ctx);
|
|
53142
|
+
const replayCheckpoint = ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === schemaClass2.id ? sessionCreationCheckpoint(ctx) : void 0;
|
|
53196
53143
|
const closeFrame = pushConstructionFrame(ctx, schemaClass2.name);
|
|
53197
53144
|
try {
|
|
53198
53145
|
return constructDeclaredClassValueWithinFrame(
|
|
@@ -53203,11 +53150,7 @@ function constructDeclaredClassValue(info, scope, ctx) {
|
|
|
53203
53150
|
ctx
|
|
53204
53151
|
);
|
|
53205
53152
|
} catch (error) {
|
|
53206
|
-
|
|
53207
|
-
for (const row of createdSessionValuesSince(ctx, replayCheckpoint)) {
|
|
53208
|
-
deleteRuntimeSessionValue(ctx, row.id);
|
|
53209
|
-
}
|
|
53210
|
-
}
|
|
53153
|
+
rollbackStoredConstructionReplay(ctx, replayCheckpoint);
|
|
53211
53154
|
throw error;
|
|
53212
53155
|
} finally {
|
|
53213
53156
|
closeFrame();
|
|
@@ -53268,6 +53211,8 @@ function constructDeclaredClassValueWithinFrame(descriptor, record7, info, scope
|
|
|
53268
53211
|
});
|
|
53269
53212
|
root.classId = classId;
|
|
53270
53213
|
stampConstructedRootGenericBindings(root, descriptor);
|
|
53214
|
+
if (ctx.__storedReplayCandidate !== void 0)
|
|
53215
|
+
ctx.__storedReplayCandidate.value = root.value;
|
|
53271
53216
|
} catch (error) {
|
|
53272
53217
|
if (error instanceof NSGetterRuntimeError) {
|
|
53273
53218
|
positionAtPassingArgument(error, info, record7, argumentValues, ctx);
|
|
@@ -53280,7 +53225,7 @@ function constructDeclaredClassValueWithinFrame(descriptor, record7, info, scope
|
|
|
53280
53225
|
`Declared constructor for '${schemaClass2.name}' produced a non-record root.`
|
|
53281
53226
|
);
|
|
53282
53227
|
}
|
|
53283
|
-
if (ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === classId
|
|
53228
|
+
if (ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === classId) {
|
|
53284
53229
|
ctx = { ...ctx, __storedConstructionReplayRootId: root.id };
|
|
53285
53230
|
}
|
|
53286
53231
|
const rootRecord = root.value;
|
|
@@ -53444,8 +53389,13 @@ function assertOwnedValueAttachable(valueId, destination, destinationName2, ctx,
|
|
|
53444
53389
|
ctx,
|
|
53445
53390
|
preflight?.parentEntries
|
|
53446
53391
|
)) {
|
|
53447
|
-
if (mode === "assign" && ownedAttachmentIdentity(owner, ctx) === ownedAttachmentIdentity(destination, ctx))
|
|
53392
|
+
if (mode === "assign" && ownedAttachmentIdentity(owner, ctx) === ownedAttachmentIdentity(destination, ctx)) {
|
|
53393
|
+
if (ctx.__storedReplayCandidate !== void 0 && ctx.__storedConstructionReplayRowId !== void 0 && owner.identity.startsWith(
|
|
53394
|
+
`value:${ctx.__storedConstructionReplayRowId}:slot:`
|
|
53395
|
+
))
|
|
53396
|
+
ctx.__storedReplayCandidate.reattached = true;
|
|
53448
53397
|
continue;
|
|
53398
|
+
}
|
|
53449
53399
|
const error = new NSGetterRuntimeError(
|
|
53450
53400
|
`Aggregate value '${valueId}' is already owned by parent value '${owner.label}' and cannot be attached to '${destinationName2}'. Call Clone() explicitly.`
|
|
53451
53401
|
);
|
|
@@ -53454,23 +53404,6 @@ function assertOwnedValueAttachable(valueId, destination, destinationName2, ctx,
|
|
|
53454
53404
|
}
|
|
53455
53405
|
const reserved = ctx.__executionState?.ownedValueAttachments.get(valueId);
|
|
53456
53406
|
if (reserved !== void 0 && (mode === "insert" || reserved.identity !== destination.identity)) {
|
|
53457
|
-
const constructorArgumentReservation = reserved.identity.startsWith(
|
|
53458
|
-
`value:${reserved.label}:constructorArg:`
|
|
53459
|
-
);
|
|
53460
|
-
const destinationConstructorGroup = constructorGroupForRow(
|
|
53461
|
-
destination.label,
|
|
53462
|
-
ctx
|
|
53463
|
-
);
|
|
53464
|
-
if (constructorArgumentReservation && (destination.label === reserved.label || destinationConstructorGroup === reserved.label || preflight?.constructorRootIds.has(reserved.label) === true)) {
|
|
53465
|
-
if (preflight === void 0) {
|
|
53466
|
-
ctx.__executionState?.ownedValueAttachments.set(valueId, destination);
|
|
53467
|
-
recordConstructorGroupDependency(valueId, destination, ctx);
|
|
53468
|
-
} else {
|
|
53469
|
-
preflight.constructorArgumentTransfers.set(valueId, destination);
|
|
53470
|
-
preflight.dependencies.set(valueId, destination);
|
|
53471
|
-
}
|
|
53472
|
-
return;
|
|
53473
|
-
}
|
|
53474
53407
|
throw new NSGetterRuntimeError(
|
|
53475
53408
|
`Aggregate value '${valueId}' is already owned by parent value '${reserved.label}' and cannot be attached to '${destinationName2}'. Call Clone() explicitly.`
|
|
53476
53409
|
);
|
|
@@ -53482,6 +53415,29 @@ function assertOwnedValueAttachable(valueId, destination, destinationName2, ctx,
|
|
|
53482
53415
|
recordConstructorGroupDependency(valueId, destination, ctx);
|
|
53483
53416
|
else preflight.dependencies.set(valueId, destination);
|
|
53484
53417
|
}
|
|
53418
|
+
function storedReplayRowById(id2, ctx) {
|
|
53419
|
+
ctx.valueDependencies?.add(id2);
|
|
53420
|
+
ctx.__getterReads?.add(id2);
|
|
53421
|
+
const database = ctx.vm.databaseVM;
|
|
53422
|
+
if (database?.storedValueById !== void 0)
|
|
53423
|
+
return database.storedValueById(id2);
|
|
53424
|
+
if (database?.evaluatorIndexes !== void 0)
|
|
53425
|
+
return database.evaluatorIndexes.valueById.get(id2) ?? null;
|
|
53426
|
+
return ctx.vm.values.find((row) => row.id === id2) ?? null;
|
|
53427
|
+
}
|
|
53428
|
+
function storedInitializerChildId(member, ctx) {
|
|
53429
|
+
if (ctx.storedConstructionReplay !== true) return void 0;
|
|
53430
|
+
const parentId = ctx.__storedConstructionReplayRowId;
|
|
53431
|
+
const memberId = Reflect.get(member, "id");
|
|
53432
|
+
if (parentId === void 0 || typeof memberId !== "string") return void 0;
|
|
53433
|
+
const parent = storedReplayRowById(parentId, ctx);
|
|
53434
|
+
if (parent?.value === null || typeof parent?.value !== "object")
|
|
53435
|
+
return void 0;
|
|
53436
|
+
const schemaKey = cachedSchemaKeyForMember(memberId, ctx);
|
|
53437
|
+
if (schemaKey === null) return void 0;
|
|
53438
|
+
const childId = Reflect.get(parent.value, schemaKey);
|
|
53439
|
+
return typeof childId === "string" ? childId : void 0;
|
|
53440
|
+
}
|
|
53485
53441
|
function assertInitializerPlacement(valueId, member, ctx) {
|
|
53486
53442
|
const replayRowId = ctx.__storedConstructionReplayRowId;
|
|
53487
53443
|
const memberId = Reflect.get(member, "id");
|
|
@@ -53518,7 +53474,7 @@ function ownershipParentEntryKeys(value, valueId, cache) {
|
|
|
53518
53474
|
}
|
|
53519
53475
|
return entries.get(valueId) ?? [];
|
|
53520
53476
|
}
|
|
53521
|
-
function currentOwnedValueAttachments(valueId, ctx, parentEntries
|
|
53477
|
+
function currentOwnedValueAttachments(valueId, ctx, parentEntries) {
|
|
53522
53478
|
const indexes4 = evaluatorIndexes(ctx);
|
|
53523
53479
|
const cached = indexes4.ownedValueAttachmentsByValueId.get(valueId);
|
|
53524
53480
|
if (cached !== void 0) return [...cached];
|
|
@@ -53581,14 +53537,7 @@ function currentOwnedValueAttachments(valueId, ctx, parentEntries, placingMember
|
|
|
53581
53537
|
let member = null;
|
|
53582
53538
|
let classId = parent.classId;
|
|
53583
53539
|
if (classId === void 0 || classId === null) {
|
|
53584
|
-
member = activeStaticBindingRoot(parent.id, ctx)?.member ??
|
|
53585
|
-
parent,
|
|
53586
|
-
ctx,
|
|
53587
|
-
void 0,
|
|
53588
|
-
0,
|
|
53589
|
-
placingMembers,
|
|
53590
|
-
parentEntries
|
|
53591
|
-
));
|
|
53540
|
+
member = activeStaticBindingRoot(parent.id, ctx)?.member ?? memberForValueRow(parent, ctx);
|
|
53592
53541
|
if (member !== null) {
|
|
53593
53542
|
try {
|
|
53594
53543
|
member = resolveMember(member, ctx.vm.members);
|
|
@@ -69866,8 +69815,8 @@ var init_strict_resolver = __esm({
|
|
|
69866
69815
|
this.persistingMethodGroup = false;
|
|
69867
69816
|
}
|
|
69868
69817
|
}
|
|
69869
|
-
/**
|
|
69870
|
-
|
|
69818
|
+
/** Check an initializer with its expected type, including contextual expressions. */
|
|
69819
|
+
validateInitializerExpression(expression, expected) {
|
|
69871
69820
|
const resolved = this.resolveExpression(
|
|
69872
69821
|
expression,
|
|
69873
69822
|
this.initialScope(),
|
|
@@ -75641,6 +75590,8 @@ var init_strict_resolver = __esm({
|
|
|
75641
75590
|
}
|
|
75642
75591
|
const staticType = this.project.typeByName.get(receiverAst.name);
|
|
75643
75592
|
if (staticType && staticType.kind !== "enum") {
|
|
75593
|
+
if (receiverAst.typeQualifier)
|
|
75594
|
+
this.resolveType(receiverAst.typeQualifier);
|
|
75644
75595
|
this.assertUserSafe(
|
|
75645
75596
|
{ kind: "named", typeId: staticType.id },
|
|
75646
75597
|
"a static receiver",
|
|
@@ -75780,6 +75731,9 @@ var init_strict_resolver = __esm({
|
|
|
75780
75731
|
pointer: listIndexPointer(receiver.pointer, index),
|
|
75781
75732
|
type: viewType,
|
|
75782
75733
|
writability: "readOnly" /* ReadOnly */,
|
|
75734
|
+
...receiver.entryWritability !== void 0 ? { entryWritability: receiver.entryWritability } : {},
|
|
75735
|
+
entryUserData: receiver.entryUserData === true,
|
|
75736
|
+
...receiver.writeRoot !== void 0 ? { writeRoot: receiver.writeRoot } : {},
|
|
75783
75737
|
indexDefinition: index,
|
|
75784
75738
|
indexCollectionPointer: receiver.pointer
|
|
75785
75739
|
};
|
|
@@ -75788,7 +75742,10 @@ var init_strict_resolver = __esm({
|
|
|
75788
75742
|
return {
|
|
75789
75743
|
pointer: receiver.pointer,
|
|
75790
75744
|
type: { kind: "primitive", name: "unknown" },
|
|
75791
|
-
indexSurface: receiver.type
|
|
75745
|
+
indexSurface: receiver.type,
|
|
75746
|
+
entryWritability: receiver.entryWritability ?? receiver.writability ?? "runtime" /* Runtime */,
|
|
75747
|
+
entryUserData: receiver.entryWritability === void 0 ? receiver.userData === true : receiver.entryUserData === true,
|
|
75748
|
+
writeRoot: this.expressionWriteRoot(receiver, scope)
|
|
75792
75749
|
};
|
|
75793
75750
|
}
|
|
75794
75751
|
if ((name === "Keys" || name === "Values") && receiver.type.kind === "dictionary") {
|
|
@@ -76063,7 +76020,7 @@ var init_strict_resolver = __esm({
|
|
|
76063
76020
|
pos
|
|
76064
76021
|
);
|
|
76065
76022
|
}
|
|
76066
|
-
if (entry.id.startsWith(NEOSCRIPT_PENDING_SYMBOL_ID_PREFIX)) {
|
|
76023
|
+
if (entry.id.startsWith(NEOSCRIPT_PENDING_SYMBOL_ID_PREFIX) && !this.options.allowPendingRegistryEntries) {
|
|
76067
76024
|
throw new CompileError(
|
|
76068
76025
|
`${registry.entryType} '${name}' has no @id, so it has never been pushed and has no project file to reference. Push the file before referencing it.`,
|
|
76069
76026
|
pos
|
|
@@ -76191,7 +76148,10 @@ var init_strict_resolver = __esm({
|
|
|
76191
76148
|
key.pointer
|
|
76192
76149
|
),
|
|
76193
76150
|
type: resultType,
|
|
76194
|
-
writability: "readOnly" /* ReadOnly
|
|
76151
|
+
writability: "readOnly" /* ReadOnly */,
|
|
76152
|
+
...receiver.entryWritability !== void 0 ? { entryWritability: receiver.entryWritability } : {},
|
|
76153
|
+
entryUserData: receiver.entryUserData === true,
|
|
76154
|
+
...receiver.writeRoot !== void 0 ? { writeRoot: receiver.writeRoot } : {}
|
|
76195
76155
|
};
|
|
76196
76156
|
}
|
|
76197
76157
|
const readonlyCollection = receiver.symbol?.readonlyDeclaration === true && receiver.initWritability !== void 0 ? {
|
|
@@ -77027,6 +76987,8 @@ var init_strict_resolver = __esm({
|
|
|
77027
76987
|
}
|
|
77028
76988
|
const staticType = this.project.typeByName.get(callee.receiver.name);
|
|
77029
76989
|
if (staticType && staticType.kind !== "enum") {
|
|
76990
|
+
if (callee.receiver.typeQualifier)
|
|
76991
|
+
this.resolveType(callee.receiver.typeQualifier);
|
|
77030
76992
|
this.assertUserSafe(
|
|
77031
76993
|
{ kind: "named", typeId: staticType.id },
|
|
77032
76994
|
"a static receiver",
|
|
@@ -85628,7 +85590,10 @@ function formatNeoScript(text, options = {}) {
|
|
|
85628
85590
|
const literalNewlines = /* @__PURE__ */ new Set();
|
|
85629
85591
|
const delimiterTokensByLine = /* @__PURE__ */ new Map();
|
|
85630
85592
|
const tokensByLine = /* @__PURE__ */ new Map();
|
|
85631
|
-
const
|
|
85593
|
+
const braceHeaderLines = /* @__PURE__ */ new Map();
|
|
85594
|
+
const parenthesisLines = [];
|
|
85595
|
+
const genericLines = [];
|
|
85596
|
+
let previousHeaderLine = 0;
|
|
85632
85597
|
const genericOffsets = genericAngleOffsets(syntax.lexed.tokens);
|
|
85633
85598
|
const continuationOperator = (token) => !genericOffsets.has(token.start) && isContinuationOperator(token);
|
|
85634
85599
|
let annotationState = "none";
|
|
@@ -85664,9 +85629,22 @@ function formatNeoScript(text, options = {}) {
|
|
|
85664
85629
|
tripleString = { token, previous: previousSignificantToken };
|
|
85665
85630
|
}
|
|
85666
85631
|
if (token.kind !== "comment" && token.kind !== "eof") {
|
|
85667
|
-
|
|
85668
|
-
|
|
85669
|
-
|
|
85632
|
+
let headerLine = token.range.start.line;
|
|
85633
|
+
const followsTypeOrName = previousSignificantToken?.kind === "identifier" || previousSignificantToken?.text === "new" || previousSignificantToken?.text === ">" && genericOffsets.has(previousSignificantToken.start);
|
|
85634
|
+
if (token.kind === "identifier" && previousSignificantToken?.text === "new" || token.text === "(" && followsTypeOrName)
|
|
85635
|
+
headerLine = previousHeaderLine;
|
|
85636
|
+
if (genericOffsets.has(token.start)) {
|
|
85637
|
+
if (token.text === "<") genericLines.push(previousHeaderLine);
|
|
85638
|
+
if (token.text === ">") headerLine = genericLines.pop() ?? headerLine;
|
|
85639
|
+
}
|
|
85640
|
+
if (token.text === "(") parenthesisLines.push(headerLine);
|
|
85641
|
+
if (token.text === ")") headerLine = parenthesisLines.pop() ?? headerLine;
|
|
85642
|
+
if (token.text === "{")
|
|
85643
|
+
braceHeaderLines.set(
|
|
85644
|
+
token.start,
|
|
85645
|
+
previousSignificantToken?.text === ")" || previousSignificantToken?.text === "=>" || previousSignificantToken?.kind === "identifier" || previousSignificantToken?.text === ">" && genericOffsets.has(previousSignificantToken.start) ? previousHeaderLine : headerLine
|
|
85646
|
+
);
|
|
85647
|
+
previousHeaderLine = headerLine;
|
|
85670
85648
|
let annotationEnd = false;
|
|
85671
85649
|
if (token.kind === "punctuation" && token.text === "@" && annotationDepth === 0)
|
|
85672
85650
|
annotationState = "name";
|
|
@@ -85695,6 +85673,8 @@ function formatNeoScript(text, options = {}) {
|
|
|
85695
85673
|
}
|
|
85696
85674
|
const formatted = [];
|
|
85697
85675
|
const delimiters = [];
|
|
85676
|
+
const lineDepths = /* @__PURE__ */ new Map();
|
|
85677
|
+
const braceHeaderDepth = (token) => lineDepths.get(braceHeaderLines.get(token.start) ?? -1);
|
|
85698
85678
|
const continuations = /* @__PURE__ */ new Set();
|
|
85699
85679
|
let preceding;
|
|
85700
85680
|
let aligning;
|
|
@@ -85728,14 +85708,21 @@ function formatNeoScript(text, options = {}) {
|
|
|
85728
85708
|
const sectionDepth = switchSectionIndentDepth(syntax.parsed, contentOffset);
|
|
85729
85709
|
const leadingState = cloneDelimiterStack(delimiters);
|
|
85730
85710
|
for (const token of leadingClosers) {
|
|
85731
|
-
applyDelimiterToken(leadingState, token
|
|
85711
|
+
applyDelimiterToken(leadingState, token);
|
|
85732
85712
|
}
|
|
85733
|
-
|
|
85713
|
+
let depth = delimiterDepth(leadingState);
|
|
85734
85714
|
const significant = tokensByLine.get(lineIndex) ?? [];
|
|
85735
|
-
|
|
85715
|
+
lineDepths.set(lineIndex, depth);
|
|
85736
85716
|
const first = significant[0];
|
|
85717
|
+
const continuationScope = leadingState.at(-1)?.openingOffset ?? -1;
|
|
85718
|
+
if (first?.text === "{") {
|
|
85719
|
+
applyDelimiterToken(leadingState, first, braceHeaderDepth(first));
|
|
85720
|
+
depth = delimiterDepth(leadingState) - 1;
|
|
85721
|
+
lineDepths.set(lineIndex, depth);
|
|
85722
|
+
}
|
|
85723
|
+
pruneContinuations(continuations, leadingState);
|
|
85737
85724
|
if (leadingClosers.length === 0 && (first !== void 0 && continuationOperator(first) && preceding !== void 0 && canEndExpression(preceding) || preceding !== void 0 && continuationOperator(preceding)))
|
|
85738
|
-
continuations.add(
|
|
85725
|
+
continuations.add(continuationScope);
|
|
85739
85726
|
const lineDepth = depth + sectionDepth + continuations.size;
|
|
85740
85727
|
const normalized = first?.range.start.character === firstContentCharacter ? normalizeControlHeaderSpacing(content) : content;
|
|
85741
85728
|
const indent2 = indentUnit.repeat(lineDepth);
|
|
@@ -85746,7 +85733,7 @@ function formatNeoScript(text, options = {}) {
|
|
|
85746
85733
|
if (standalone !== void 0 && standalone.closingIndent !== indent2)
|
|
85747
85734
|
aligning = { ...standalone, indent: indent2 };
|
|
85748
85735
|
for (const token of lineTokens) {
|
|
85749
|
-
applyDelimiterToken(delimiters, token,
|
|
85736
|
+
applyDelimiterToken(delimiters, token, braceHeaderDepth(token));
|
|
85750
85737
|
}
|
|
85751
85738
|
pruneContinuations(continuations, delimiters);
|
|
85752
85739
|
const last = significant.at(-1);
|
|
@@ -85887,25 +85874,26 @@ function leadingClosingTokens(lineTokens, firstContentCharacter) {
|
|
|
85887
85874
|
}
|
|
85888
85875
|
return result;
|
|
85889
85876
|
}
|
|
85890
|
-
function applyDelimiterToken(stack, token,
|
|
85877
|
+
function applyDelimiterToken(stack, token, headerDepth) {
|
|
85891
85878
|
if (isOpeningDelimiter(token.text)) {
|
|
85892
|
-
|
|
85893
|
-
if (token.text === "{" &&
|
|
85894
|
-
|
|
85879
|
+
const restores = [];
|
|
85880
|
+
if (token.text === "{" && headerDepth !== void 0) {
|
|
85881
|
+
let depth = delimiterDepth(stack);
|
|
85882
|
+
for (let index = stack.length - 1; index >= 0 && depth > headerDepth; index--) {
|
|
85895
85883
|
const candidate = stack[index];
|
|
85896
|
-
if (candidate?.text === "
|
|
85897
|
-
|
|
85898
|
-
|
|
85884
|
+
if (candidate?.text === "{") break;
|
|
85885
|
+
if (candidate?.text === "(" && candidate.contributes) {
|
|
85886
|
+
restores.push(candidate);
|
|
85887
|
+
candidate.contributes = false;
|
|
85888
|
+
depth--;
|
|
85899
85889
|
}
|
|
85900
85890
|
}
|
|
85901
|
-
if (restores) restores.contributes = false;
|
|
85902
85891
|
}
|
|
85903
85892
|
stack.push({
|
|
85904
85893
|
text: token.text,
|
|
85905
|
-
openingLine: token.range.start.line,
|
|
85906
85894
|
openingOffset: token.start,
|
|
85907
85895
|
contributes: true,
|
|
85908
|
-
...restores ? { restores } : {}
|
|
85896
|
+
...restores.length > 0 ? { restores } : {}
|
|
85909
85897
|
});
|
|
85910
85898
|
return;
|
|
85911
85899
|
}
|
|
@@ -85919,7 +85907,7 @@ function applyDelimiterToken(stack, token, lambdaBraceOffsets) {
|
|
|
85919
85907
|
}
|
|
85920
85908
|
if (frameIndex < 0) return;
|
|
85921
85909
|
const [frame] = stack.splice(frameIndex, 1);
|
|
85922
|
-
|
|
85910
|
+
for (const restored of frame?.restores ?? []) restored.contributes = true;
|
|
85923
85911
|
}
|
|
85924
85912
|
function pruneContinuations(continuations, stack) {
|
|
85925
85913
|
const scopes = /* @__PURE__ */ new Set([-1, ...stack.map((frame) => frame.openingOffset)]);
|
|
@@ -85930,20 +85918,11 @@ function delimiterDepth(stack) {
|
|
|
85930
85918
|
return stack.filter((frame) => frame.contributes).length;
|
|
85931
85919
|
}
|
|
85932
85920
|
function cloneDelimiterStack(stack) {
|
|
85933
|
-
|
|
85921
|
+
return stack.map((frame) => ({
|
|
85934
85922
|
text: frame.text,
|
|
85935
|
-
openingLine: frame.openingLine,
|
|
85936
85923
|
openingOffset: frame.openingOffset,
|
|
85937
85924
|
contributes: frame.contributes
|
|
85938
85925
|
}));
|
|
85939
|
-
for (let index = 0; index < stack.length; index++) {
|
|
85940
|
-
const restores = stack[index]?.restores;
|
|
85941
|
-
if (!restores) continue;
|
|
85942
|
-
const restoreIndex = stack.indexOf(restores);
|
|
85943
|
-
if (restoreIndex < 0) continue;
|
|
85944
|
-
clones[index] = { ...clones[index], restores: clones[restoreIndex] };
|
|
85945
|
-
}
|
|
85946
|
-
return clones;
|
|
85947
85926
|
}
|
|
85948
85927
|
function matchingOpeningDelimiter(value) {
|
|
85949
85928
|
switch (value) {
|
|
@@ -97695,7 +97674,11 @@ function validateMember(uri, member, ownerName, documentKind, ownerScope, enviro
|
|
|
97695
97674
|
member.initializer.text,
|
|
97696
97675
|
memberType2,
|
|
97697
97676
|
scope,
|
|
97698
|
-
|
|
97677
|
+
{
|
|
97678
|
+
...environment,
|
|
97679
|
+
staticMember: member.modifiers.includes("static"),
|
|
97680
|
+
checkComputedInitializers: true
|
|
97681
|
+
},
|
|
97699
97682
|
member.initializer.range,
|
|
97700
97683
|
diagnostics,
|
|
97701
97684
|
anchorOf(member.initializer),
|
|
@@ -98619,6 +98602,80 @@ function knownGeneratorExpression(expression, scope, environment) {
|
|
|
98619
98602
|
return candidates !== void 0 && candidates.length > 0 && candidates.every((member) => member.generator === true);
|
|
98620
98603
|
}
|
|
98621
98604
|
function validateExpression(expression, expected, scope, environment, uri, range2, diagnostics, anchor, storedValue = true) {
|
|
98605
|
+
const sourceOnly = expected !== void 0 && (isNeoVariantTypeName(expected.name) || expected.name === "NeoAction" || expected.name === "ImageRef");
|
|
98606
|
+
let receiver = expression;
|
|
98607
|
+
if (environment.checkComputedInitializers) {
|
|
98608
|
+
while (receiver.kind === "member") receiver = receiver.receiver;
|
|
98609
|
+
}
|
|
98610
|
+
const computed = environment.checkComputedInitializers && !sourceOnly && (expression.kind === "member" && (receiver.kind !== "ident" || receiver.typeQualifier !== void 0) || [
|
|
98611
|
+
"binary",
|
|
98612
|
+
"unary",
|
|
98613
|
+
"force",
|
|
98614
|
+
"coalesce",
|
|
98615
|
+
"conditional",
|
|
98616
|
+
"switchExpression",
|
|
98617
|
+
"is",
|
|
98618
|
+
"lambda",
|
|
98619
|
+
"index",
|
|
98620
|
+
"litInterp",
|
|
98621
|
+
"litTripleString",
|
|
98622
|
+
"call"
|
|
98623
|
+
].includes(expression.kind)) && !isReferenceCall(expression);
|
|
98624
|
+
const count = diagnostics.length;
|
|
98625
|
+
validateStoredExpression(
|
|
98626
|
+
expression,
|
|
98627
|
+
expected,
|
|
98628
|
+
scope,
|
|
98629
|
+
computed || sourceOnly || expression.kind === "member" ? { ...environment, checkComputedInitializers: false } : environment,
|
|
98630
|
+
uri,
|
|
98631
|
+
range2,
|
|
98632
|
+
diagnostics,
|
|
98633
|
+
anchor,
|
|
98634
|
+
storedValue
|
|
98635
|
+
);
|
|
98636
|
+
if (!computed || diagnostics.length !== count) return;
|
|
98637
|
+
const { context, resolver, parameterNames, parameterTypes } = initializerResolver(
|
|
98638
|
+
environment,
|
|
98639
|
+
scope.get("this")?.name ?? "",
|
|
98640
|
+
environment.staticMember,
|
|
98641
|
+
"initializer"
|
|
98642
|
+
);
|
|
98643
|
+
try {
|
|
98644
|
+
const reads = new Set(
|
|
98645
|
+
collectIdentifierReads(expression, parameterNames).map(
|
|
98646
|
+
(read) => read.name
|
|
98647
|
+
)
|
|
98648
|
+
);
|
|
98649
|
+
const parameters = [...reads].map((name) => ({
|
|
98650
|
+
name,
|
|
98651
|
+
type: parameterTypes.get(name)
|
|
98652
|
+
}));
|
|
98653
|
+
const scopedResolver = parameters.length === 0 ? resolver : new StrictNeoScriptResolver(
|
|
98654
|
+
{ ...context, parameters },
|
|
98655
|
+
environment.projectIndex,
|
|
98656
|
+
void 0,
|
|
98657
|
+
{ allowPendingRegistryEntries: true }
|
|
98658
|
+
);
|
|
98659
|
+
scopedResolver.validateInitializerExpression(
|
|
98660
|
+
expression,
|
|
98661
|
+
expected === void 0 ? void 0 : resolveNeoScriptType(
|
|
98662
|
+
semanticAst(expected, expression.pos),
|
|
98663
|
+
context,
|
|
98664
|
+
environment.projectIndex
|
|
98665
|
+
)
|
|
98666
|
+
);
|
|
98667
|
+
} catch (error) {
|
|
98668
|
+
if (!(error instanceof CompileError)) throw error;
|
|
98669
|
+
pushDiagnostic(
|
|
98670
|
+
diagnostics,
|
|
98671
|
+
uri,
|
|
98672
|
+
anchor ? anchorSpan(anchor, error, 1) : range2,
|
|
98673
|
+
"invalid-computed-initializer",
|
|
98674
|
+
error.message.replace(/^\d+:\d+: /, "")
|
|
98675
|
+
);
|
|
98676
|
+
}
|
|
98677
|
+
}
|
|
98678
|
+
function validateStoredExpression(expression, expected, scope, environment, uri, range2, diagnostics, anchor, storedValue = true) {
|
|
98622
98679
|
if (anchor !== void 0 && expression.kind === "call") {
|
|
98623
98680
|
const error = sourceCallBinding(expression, scope, environment)?.error;
|
|
98624
98681
|
if (error?.message.includes(
|
|
@@ -98843,7 +98900,7 @@ function validateExpression(expression, expected, scope, environment, uri, range
|
|
|
98843
98900
|
// Enum dictionaries also preserve quoted option IDs, including orphaned IDs.
|
|
98844
98901
|
entry.key.kind === "litString" ? void 0 : key,
|
|
98845
98902
|
scope,
|
|
98846
|
-
environment,
|
|
98903
|
+
{ ...environment, checkComputedInitializers: false },
|
|
98847
98904
|
uri,
|
|
98848
98905
|
range2,
|
|
98849
98906
|
diagnostics,
|
|
@@ -99025,6 +99082,17 @@ function validateExpression(expression, expected, scope, environment, uri, range
|
|
|
99025
99082
|
}
|
|
99026
99083
|
if (expression.kind === "new") {
|
|
99027
99084
|
const typeName = expression.className ?? expected?.name;
|
|
99085
|
+
if (typeName === "List" || typeName === "Set" || typeName === "Dictionary") {
|
|
99086
|
+
const literal3 = typeName === "Dictionary" ? "{}" : "[]";
|
|
99087
|
+
pushDiagnostic(
|
|
99088
|
+
diagnostics,
|
|
99089
|
+
uri,
|
|
99090
|
+
anchor ? anchorSpan(anchor, expression.pos, 3) : range2,
|
|
99091
|
+
"collection-construction",
|
|
99092
|
+
`${typeName} has no constructor. Use ${literal3} for an empty collection.`
|
|
99093
|
+
);
|
|
99094
|
+
return;
|
|
99095
|
+
}
|
|
99028
99096
|
const declaration = typeName ? environment.types.get(typeName) : void 0;
|
|
99029
99097
|
for (const entry of expression.initializer ?? []) {
|
|
99030
99098
|
if (entry.name !== "layerClassId") continue;
|
|
@@ -99958,24 +100026,49 @@ function wrappedTypeParameterConstruction(declaration, typeArguments, scope, env
|
|
|
99958
100026
|
}
|
|
99959
100027
|
return target.kind === "named" ? wrappedTypeParameterMessage(target, environment.projectIndex) : null;
|
|
99960
100028
|
}
|
|
99961
|
-
function initializerResolver(environment, thisName, staticMember) {
|
|
100029
|
+
function initializerResolver(environment, thisName, staticMember, kind = "initializerExpression") {
|
|
99962
100030
|
const declaring = environment.projectIndex.typeByName.get(thisName);
|
|
99963
|
-
const key = `${declaring?.id ?? ""}:${staticMember}`;
|
|
100031
|
+
const key = `${declaring?.id ?? ""}:${staticMember}:${kind}`;
|
|
99964
100032
|
let entry = environment.initializerResolvers.get(key);
|
|
99965
100033
|
if (entry === void 0) {
|
|
99966
100034
|
const declaringType = declaring ? { kind: "named", typeId: declaring.id } : void 0;
|
|
99967
100035
|
const context = {
|
|
99968
100036
|
project: environment.project,
|
|
99969
|
-
kind
|
|
100037
|
+
kind,
|
|
99970
100038
|
...declaringType ? {
|
|
99971
100039
|
declaringType,
|
|
99972
100040
|
implicitMemberAccess: true,
|
|
99973
100041
|
...staticMember ? { staticMember } : { thisClass: declaringType }
|
|
99974
100042
|
} : {}
|
|
99975
100043
|
};
|
|
100044
|
+
const parameterTypes = /* @__PURE__ */ new Map();
|
|
100045
|
+
if (kind === "initializer" && !staticMember) {
|
|
100046
|
+
const owner = environment.types.get(thisName);
|
|
100047
|
+
for (const parameter4 of owner?.headerParameters ?? []) {
|
|
100048
|
+
try {
|
|
100049
|
+
parameterTypes.set(
|
|
100050
|
+
parameter4.name,
|
|
100051
|
+
resolveNeoScriptType(
|
|
100052
|
+
semanticAst(semanticType(parameter4.type), { line: 1, column: 1 }),
|
|
100053
|
+
context,
|
|
100054
|
+
environment.projectIndex
|
|
100055
|
+
)
|
|
100056
|
+
);
|
|
100057
|
+
} catch (error) {
|
|
100058
|
+
if (!(error instanceof CompileError)) throw error;
|
|
100059
|
+
}
|
|
100060
|
+
}
|
|
100061
|
+
}
|
|
99976
100062
|
entry = {
|
|
99977
100063
|
context,
|
|
99978
|
-
|
|
100064
|
+
parameterNames: new Set(parameterTypes.keys()),
|
|
100065
|
+
parameterTypes,
|
|
100066
|
+
resolver: new StrictNeoScriptResolver(
|
|
100067
|
+
context,
|
|
100068
|
+
environment.projectIndex,
|
|
100069
|
+
void 0,
|
|
100070
|
+
{ allowPendingRegistryEntries: true }
|
|
100071
|
+
)
|
|
99979
100072
|
};
|
|
99980
100073
|
environment.initializerResolvers.set(key, entry);
|
|
99981
100074
|
}
|
|
@@ -100525,7 +100618,7 @@ function validatePlaceReference(expression, expected, thisName, environment, rep
|
|
|
100525
100618
|
environment.staticMember
|
|
100526
100619
|
);
|
|
100527
100620
|
try {
|
|
100528
|
-
resolver.
|
|
100621
|
+
resolver.validateInitializerExpression(
|
|
100529
100622
|
expression,
|
|
100530
100623
|
expected === void 0 ? void 0 : resolveNeoScriptType(
|
|
100531
100624
|
semanticAst(expected, expression.pos),
|
|
@@ -240314,7 +240407,7 @@ var releaseWorkspaceLock = () => void 0;
|
|
|
240314
240407
|
async function main() {
|
|
240315
240408
|
const args = parseArgs(process.argv.slice(2));
|
|
240316
240409
|
if (args.command === "--version") {
|
|
240317
|
-
console.log("0.89.
|
|
240410
|
+
console.log("0.89.8");
|
|
240318
240411
|
return;
|
|
240319
240412
|
}
|
|
240320
240413
|
if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
|