@neocompose/cli 0.24.9 → 0.25.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/dist/neo.mjs
CHANGED
|
@@ -1291,6 +1291,7 @@ var init_language_spec = __esm({
|
|
|
1291
1291
|
"Partial",
|
|
1292
1292
|
"FunctionRef",
|
|
1293
1293
|
"NeoDelegate",
|
|
1294
|
+
"NeoAction",
|
|
1294
1295
|
"Dialogue",
|
|
1295
1296
|
"Trigger",
|
|
1296
1297
|
"Node",
|
|
@@ -1958,6 +1959,12 @@ function isNeoScriptTypeAssignable(source, target, project) {
|
|
|
1958
1959
|
return expected !== void 0 && isNeoScriptTypeAssignable(parameter4, expected, project) && isNeoScriptTypeAssignable(expected, parameter4, project);
|
|
1959
1960
|
});
|
|
1960
1961
|
}
|
|
1962
|
+
if (source.kind === "action" && target.kind === "action") {
|
|
1963
|
+
return source.parameterTypes.length === target.parameterTypes.length && source.parameterTypes.every((parameter4, index) => {
|
|
1964
|
+
const expected = target.parameterTypes[index];
|
|
1965
|
+
return expected !== void 0 && isNeoScriptTypeAssignable(parameter4, expected, project) && isNeoScriptTypeAssignable(expected, parameter4, project);
|
|
1966
|
+
});
|
|
1967
|
+
}
|
|
1961
1968
|
return false;
|
|
1962
1969
|
}
|
|
1963
1970
|
function commonNeoScriptAssignableType(left, right, project) {
|
|
@@ -2019,6 +2026,8 @@ function formatType(type, project) {
|
|
|
2019
2026
|
(parameter4) => formatType(parameter4, project)
|
|
2020
2027
|
)
|
|
2021
2028
|
].join(", ")}>${suffix}`;
|
|
2029
|
+
case "action":
|
|
2030
|
+
return `NeoAction<${type.parameterTypes.map((parameter4) => formatType(parameter4, project)).join(", ")}>${suffix}`;
|
|
2022
2031
|
}
|
|
2023
2032
|
}
|
|
2024
2033
|
var UNKNOWN_TYPE;
|
|
@@ -6919,6 +6928,8 @@ function neoScriptPositionalTypeKey(type) {
|
|
|
6919
6928
|
return `typeParameter:${type.id}`;
|
|
6920
6929
|
case "delegate":
|
|
6921
6930
|
return `delegate:${neoScriptPositionalTypeKey(type.returnType)}(${type.parameterTypes.map(neoScriptPositionalTypeKey).join(",")})`;
|
|
6931
|
+
case "action":
|
|
6932
|
+
return `action:(${type.parameterTypes.map(neoScriptPositionalTypeKey).join(",")})`;
|
|
6922
6933
|
}
|
|
6923
6934
|
}
|
|
6924
6935
|
function validateNeoScriptOverloadSignatures(className, signatures) {
|
|
@@ -7485,8 +7496,34 @@ function typeRefsEqual(left, right) {
|
|
|
7485
7496
|
return other !== void 0 && typeRefsEqual(parameter4, other);
|
|
7486
7497
|
});
|
|
7487
7498
|
}
|
|
7499
|
+
if (left.kind === "action" && right.kind === "action") {
|
|
7500
|
+
return left.parameterTypes.length === right.parameterTypes.length && left.parameterTypes.every((parameter4, index) => {
|
|
7501
|
+
const other = right.parameterTypes[index];
|
|
7502
|
+
return other !== void 0 && typeRefsEqual(parameter4, other);
|
|
7503
|
+
});
|
|
7504
|
+
}
|
|
7488
7505
|
return left.kind === "dictionary" && right.kind === "dictionary" ? typeRefsEqual(left.keyType, right.keyType) && typeRefsEqual(left.valueType, right.valueType) : false;
|
|
7489
7506
|
}
|
|
7507
|
+
function actionListenerSignature(symbol) {
|
|
7508
|
+
if (symbol.kind === "function" || symbol.kind === "method") {
|
|
7509
|
+
return {
|
|
7510
|
+
returnsVoid: isVoid(symbol.returnType ?? symbol.type),
|
|
7511
|
+
parameterTypes: (symbol.parameters ?? []).map(
|
|
7512
|
+
(parameter4) => parameter4.type
|
|
7513
|
+
)
|
|
7514
|
+
};
|
|
7515
|
+
}
|
|
7516
|
+
if (symbol.type.kind === "delegate") {
|
|
7517
|
+
return {
|
|
7518
|
+
returnsVoid: isVoid(symbol.type.returnType),
|
|
7519
|
+
parameterTypes: symbol.type.parameterTypes
|
|
7520
|
+
};
|
|
7521
|
+
}
|
|
7522
|
+
if (symbol.type.kind === "action") {
|
|
7523
|
+
return { returnsVoid: true, parameterTypes: symbol.type.parameterTypes };
|
|
7524
|
+
}
|
|
7525
|
+
return null;
|
|
7526
|
+
}
|
|
7490
7527
|
function variable(id2, type, pointer, project) {
|
|
7491
7528
|
return {
|
|
7492
7529
|
id: id2,
|
|
@@ -7867,6 +7904,14 @@ function toWireType(type, project) {
|
|
|
7867
7904
|
(parameter4) => toWireType(parameter4, project)
|
|
7868
7905
|
)
|
|
7869
7906
|
};
|
|
7907
|
+
case "action":
|
|
7908
|
+
return {
|
|
7909
|
+
type: 26 /* Action */,
|
|
7910
|
+
required: true,
|
|
7911
|
+
argumentTypes: type.parameterTypes.map(
|
|
7912
|
+
(parameter4) => toWireType(parameter4, project)
|
|
7913
|
+
)
|
|
7914
|
+
};
|
|
7870
7915
|
}
|
|
7871
7916
|
}
|
|
7872
7917
|
function fromWireType(type) {
|
|
@@ -7921,6 +7966,12 @@ function fromWireType(type) {
|
|
|
7921
7966
|
nullable
|
|
7922
7967
|
};
|
|
7923
7968
|
}
|
|
7969
|
+
if (type.type === 26 /* Action */) {
|
|
7970
|
+
return {
|
|
7971
|
+
kind: "action",
|
|
7972
|
+
parameterTypes: type.argumentTypes.map(fromWireType)
|
|
7973
|
+
};
|
|
7974
|
+
}
|
|
7924
7975
|
return { kind: "primitive", name: valueKindPrimitive(type.type), nullable };
|
|
7925
7976
|
}
|
|
7926
7977
|
function findGenericParameterOwner(parameterId, project) {
|
|
@@ -8149,10 +8200,17 @@ function substituteTypeParameters(member, receiver, declaring) {
|
|
|
8149
8200
|
parameterTypes: type.parameterTypes.map(visit)
|
|
8150
8201
|
};
|
|
8151
8202
|
}
|
|
8203
|
+
if (type.kind === "action") {
|
|
8204
|
+
return { ...type, parameterTypes: type.parameterTypes.map(visit) };
|
|
8205
|
+
}
|
|
8152
8206
|
return type;
|
|
8153
8207
|
};
|
|
8154
8208
|
return visit(member);
|
|
8155
8209
|
}
|
|
8210
|
+
function isActionMemberPointer(pointer) {
|
|
8211
|
+
if (pointer.type === "staticMember" /* StaticMember */) return true;
|
|
8212
|
+
return pointer.type === "keyOf" /* KeyOf */;
|
|
8213
|
+
}
|
|
8156
8214
|
function pointerToBooleanExpression(pointer) {
|
|
8157
8215
|
if (pointer.type === "operation" /* Operation */ && pointer.operation.type === "boolean" /* Boolean */) {
|
|
8158
8216
|
return pointer.operation.expression;
|
|
@@ -8771,6 +8829,12 @@ var init_strict_resolver = __esm({
|
|
|
8771
8829
|
statement.init.pos
|
|
8772
8830
|
);
|
|
8773
8831
|
}
|
|
8832
|
+
if (initial.type.kind === "action") {
|
|
8833
|
+
throw new CompileError(
|
|
8834
|
+
`Cannot bind ${this.describe(initial.type)} to local '${statement.name}'; an action is not a value. Subscribe or invoke it through the member reference directly.`,
|
|
8835
|
+
statement.init.pos
|
|
8836
|
+
);
|
|
8837
|
+
}
|
|
8774
8838
|
const localType = declared ?? initial.type;
|
|
8775
8839
|
if (declared) {
|
|
8776
8840
|
this.requireAssignable(
|
|
@@ -9003,6 +9067,12 @@ var init_strict_resolver = __esm({
|
|
|
9003
9067
|
statement.iterator,
|
|
9004
9068
|
iteratorScope
|
|
9005
9069
|
);
|
|
9070
|
+
if (iterator.type !== "assign" /* Assign */) {
|
|
9071
|
+
throw new CompileError(
|
|
9072
|
+
"A for-loop iterator must be an assignment; an NSAction subscription is not a valid iterator.",
|
|
9073
|
+
statement.iterator.pos
|
|
9074
|
+
);
|
|
9075
|
+
}
|
|
9006
9076
|
const initialConditionFalseScope = new Scope(loopScope);
|
|
9007
9077
|
this.applyFactsToScope(loopScope, initialConditionFalseScope, [
|
|
9008
9078
|
...factsWhenFalse(statement.condition)
|
|
@@ -9593,6 +9663,15 @@ var init_strict_resolver = __esm({
|
|
|
9593
9663
|
scope,
|
|
9594
9664
|
false
|
|
9595
9665
|
);
|
|
9666
|
+
if (target.type.kind === "action") {
|
|
9667
|
+
return this.resolveActionSubscription(
|
|
9668
|
+
statement,
|
|
9669
|
+
target,
|
|
9670
|
+
target.type,
|
|
9671
|
+
writability,
|
|
9672
|
+
scope
|
|
9673
|
+
);
|
|
9674
|
+
}
|
|
9596
9675
|
let value;
|
|
9597
9676
|
if (statement.op === "=") {
|
|
9598
9677
|
if (!statement.value) {
|
|
@@ -9675,6 +9754,189 @@ var init_strict_resolver = __esm({
|
|
|
9675
9754
|
pos
|
|
9676
9755
|
);
|
|
9677
9756
|
}
|
|
9757
|
+
/**
|
|
9758
|
+
* P62 §3.2. `+=` / `-=` on an NSAction member are subscription operators,
|
|
9759
|
+
* not arithmetic: the listener set *is* the member's value, so each one
|
|
9760
|
+
* compiles to a member-value write carrying the listener target.
|
|
9761
|
+
*/
|
|
9762
|
+
resolveActionSubscription(statement, target, actionType, writability, scope) {
|
|
9763
|
+
if (statement.op === "=") {
|
|
9764
|
+
throw new CompileError(
|
|
9765
|
+
`Cannot assign to ${this.describe(actionType)}; a listener set is not reassignable from script. Use '+=' to add a listener or '-=' to remove one.`,
|
|
9766
|
+
statement.pos
|
|
9767
|
+
);
|
|
9768
|
+
}
|
|
9769
|
+
if (statement.op !== "+=" && statement.op !== "-=") {
|
|
9770
|
+
throw new CompileError(
|
|
9771
|
+
`Operator '${statement.op}' cannot be applied to ${this.describe(actionType)}; an action supports only '+=' and '-='.`,
|
|
9772
|
+
statement.pos
|
|
9773
|
+
);
|
|
9774
|
+
}
|
|
9775
|
+
if (!isActionMemberPointer(target.pointer)) {
|
|
9776
|
+
throw new CompileError(
|
|
9777
|
+
`Cannot apply '${statement.op}' to ${this.describe(actionType)} that is not a member reference; an action is not a value. Subscribe or invoke it through the member reference directly.`,
|
|
9778
|
+
statement.pos
|
|
9779
|
+
);
|
|
9780
|
+
}
|
|
9781
|
+
if (!statement.value) {
|
|
9782
|
+
throw new CompileError(
|
|
9783
|
+
`Assignment operator '${statement.op}' requires a right-hand listener.`,
|
|
9784
|
+
statement.pos
|
|
9785
|
+
);
|
|
9786
|
+
}
|
|
9787
|
+
const listener = this.resolveActionListener(
|
|
9788
|
+
statement.value,
|
|
9789
|
+
actionType,
|
|
9790
|
+
scope
|
|
9791
|
+
);
|
|
9792
|
+
const assignedPath = canonicalPath(statement.target);
|
|
9793
|
+
if (assignedPath) {
|
|
9794
|
+
const rootEntry = scope.lookup(pathRoot(assignedPath));
|
|
9795
|
+
if (rootEntry) scope.invalidate(rootEntry);
|
|
9796
|
+
}
|
|
9797
|
+
const kind = statement.op === "+=" ? "addActionListener" /* AddActionListener */ : "removeActionListener" /* RemoveActionListener */;
|
|
9798
|
+
return {
|
|
9799
|
+
type: kind,
|
|
9800
|
+
target: {
|
|
9801
|
+
pointer: target.pointer,
|
|
9802
|
+
typeInfo: target.wireType ?? toWireType(actionType, this.project),
|
|
9803
|
+
writability
|
|
9804
|
+
},
|
|
9805
|
+
listener
|
|
9806
|
+
};
|
|
9807
|
+
}
|
|
9808
|
+
/**
|
|
9809
|
+
* Lowers a `+=` / `-=` right-hand side to the member target a listener is
|
|
9810
|
+
* (P62 §3.2). A listener is always a member reference, so the accepted forms
|
|
9811
|
+
* are exactly the ones the authored listener list accepts: a method group or
|
|
9812
|
+
* a delegate/action-typed member on the current class, or the same through a
|
|
9813
|
+
* value alias or a static type name.
|
|
9814
|
+
*/
|
|
9815
|
+
resolveActionListener(expression, expected, scope) {
|
|
9816
|
+
if (expression.kind === "lambda") {
|
|
9817
|
+
throw new CompileError(
|
|
9818
|
+
`A lambda cannot be an action listener: a closure has no identity to deduplicate or remove by. Extract the body to an NSFunction member and subscribe that member instead.`,
|
|
9819
|
+
expression.pos
|
|
9820
|
+
);
|
|
9821
|
+
}
|
|
9822
|
+
const resolved = this.resolveActionListenerSymbol(expression, scope);
|
|
9823
|
+
if (resolved === null) {
|
|
9824
|
+
throw new CompileError(
|
|
9825
|
+
`An action listener must be a Function, NSFunction, NeoDelegate, or NeoAction member reference.`,
|
|
9826
|
+
expression.pos
|
|
9827
|
+
);
|
|
9828
|
+
}
|
|
9829
|
+
const { symbol, owner, receiverType, valueId } = resolved;
|
|
9830
|
+
if (owner !== void 0) {
|
|
9831
|
+
this.assertMemberAccessible(owner, symbol, expression.pos);
|
|
9832
|
+
}
|
|
9833
|
+
if (symbol.deferred === true) {
|
|
9834
|
+
throw new CompileError(
|
|
9835
|
+
`Deferred member '${symbol.name}' cannot be an action listener; listeners run immediately.`,
|
|
9836
|
+
expression.pos
|
|
9837
|
+
);
|
|
9838
|
+
}
|
|
9839
|
+
this.requireActionListenerSignature(
|
|
9840
|
+
symbol,
|
|
9841
|
+
owner,
|
|
9842
|
+
receiverType,
|
|
9843
|
+
expected,
|
|
9844
|
+
expression.pos
|
|
9845
|
+
);
|
|
9846
|
+
return {
|
|
9847
|
+
type: "value" /* Value */,
|
|
9848
|
+
value: {
|
|
9849
|
+
typeInfo: toWireType(expected, this.project),
|
|
9850
|
+
value: { memberId: symbol.id, valueId }
|
|
9851
|
+
}
|
|
9852
|
+
};
|
|
9853
|
+
}
|
|
9854
|
+
/**
|
|
9855
|
+
* Resolves the member a listener expression names, along with the row the
|
|
9856
|
+
* target binds to. `valueId` is `null` for a member on the current class or
|
|
9857
|
+
* a static member — the same identity the authored listener list lowers to
|
|
9858
|
+
* — and a value alias contributes its own stable row.
|
|
9859
|
+
*/
|
|
9860
|
+
resolveActionListenerSymbol(expression, scope) {
|
|
9861
|
+
if (expression.kind === "ident") {
|
|
9862
|
+
const implicit = this.implicitMember(expression.name);
|
|
9863
|
+
if (implicit === null) return null;
|
|
9864
|
+
return {
|
|
9865
|
+
symbol: implicit.symbol,
|
|
9866
|
+
owner: implicit.owner,
|
|
9867
|
+
receiverType: this.context.thisClass,
|
|
9868
|
+
valueId: null
|
|
9869
|
+
};
|
|
9870
|
+
}
|
|
9871
|
+
if (expression.kind !== "member") return null;
|
|
9872
|
+
if (expression.receiver.kind === "ident" && !scope.lookup(expression.receiver.name)) {
|
|
9873
|
+
const owner2 = this.project.typeByName.get(expression.receiver.name);
|
|
9874
|
+
const symbol2 = owner2?.members.find(
|
|
9875
|
+
(candidate) => candidate.name === expression.name
|
|
9876
|
+
);
|
|
9877
|
+
if (owner2 === void 0 || symbol2 === void 0) return null;
|
|
9878
|
+
if (symbol2.static !== true) {
|
|
9879
|
+
throw new CompileError(
|
|
9880
|
+
`Member '${owner2.name}.${symbol2.name}' requires an instance receiver.`,
|
|
9881
|
+
expression.pos
|
|
9882
|
+
);
|
|
9883
|
+
}
|
|
9884
|
+
return { symbol: symbol2, owner: owner2, receiverType: void 0, valueId: null };
|
|
9885
|
+
}
|
|
9886
|
+
const receiver = this.resolveExpression(expression.receiver, scope);
|
|
9887
|
+
if (receiver.type.kind !== "named") return null;
|
|
9888
|
+
const owner = this.project.typeById.get(receiver.type.typeId);
|
|
9889
|
+
const symbol = owner?.members.find(
|
|
9890
|
+
(candidate) => candidate.name === expression.name
|
|
9891
|
+
);
|
|
9892
|
+
if (owner === void 0 || symbol === void 0) return null;
|
|
9893
|
+
if (expression.receiver.kind === "ident" && expression.receiver.name === "this") {
|
|
9894
|
+
return { symbol, owner, receiverType: receiver.type, valueId: null };
|
|
9895
|
+
}
|
|
9896
|
+
if (receiver.pointer.type !== "reference" /* Reference */) {
|
|
9897
|
+
throw new CompileError(
|
|
9898
|
+
`Listener '${symbol.name}' cannot be subscribed through this receiver: a listener target is a stable (member, row) identity, so the receiver must be \`this\`, a project value, or a type name.`,
|
|
9899
|
+
expression.pos
|
|
9900
|
+
);
|
|
9901
|
+
}
|
|
9902
|
+
return {
|
|
9903
|
+
symbol,
|
|
9904
|
+
owner,
|
|
9905
|
+
receiverType: receiver.type,
|
|
9906
|
+
valueId: receiver.pointer.valueId
|
|
9907
|
+
};
|
|
9908
|
+
}
|
|
9909
|
+
/**
|
|
9910
|
+
* P62 §2.1. A listener's effective signature must be void-returning with
|
|
9911
|
+
* pairwise-identical post-substitution parameter types — the method-group
|
|
9912
|
+
* discipline with void-ness fixed true. A delegate or action member is
|
|
9913
|
+
* accepted by the signature it carries: subscribing it is an indirection
|
|
9914
|
+
* through the member, not a snapshot of its current value.
|
|
9915
|
+
*/
|
|
9916
|
+
requireActionListenerSignature(symbol, owner, receiverType, expected, pos) {
|
|
9917
|
+
const substitute2 = (type) => {
|
|
9918
|
+
if (receiverType?.kind !== "named" || owner === void 0) return type;
|
|
9919
|
+
return substituteTypeParameters(type, receiverType, owner);
|
|
9920
|
+
};
|
|
9921
|
+
const signature = actionListenerSignature(symbol);
|
|
9922
|
+
if (signature === null) {
|
|
9923
|
+
throw new CompileError(
|
|
9924
|
+
`'${symbol.name}' is not a callable member, so it cannot be an action listener.`,
|
|
9925
|
+
pos
|
|
9926
|
+
);
|
|
9927
|
+
}
|
|
9928
|
+
const parameterTypes = signature.parameterTypes.map(substitute2);
|
|
9929
|
+
const matches = signature.returnsVoid && parameterTypes.length === expected.parameterTypes.length && parameterTypes.every((parameter4, index) => {
|
|
9930
|
+
const slot = expected.parameterTypes[index];
|
|
9931
|
+
return slot !== void 0 && isNeoScriptTypeAssignable(parameter4, slot, this.project) && isNeoScriptTypeAssignable(slot, parameter4, this.project);
|
|
9932
|
+
});
|
|
9933
|
+
if (!matches) {
|
|
9934
|
+
throw new CompileError(
|
|
9935
|
+
`Listener '${symbol.name}' is not assignable to ${this.describe(expected)}.`,
|
|
9936
|
+
pos
|
|
9937
|
+
);
|
|
9938
|
+
}
|
|
9939
|
+
}
|
|
9678
9940
|
resolveExpression(expression, scope, expected) {
|
|
9679
9941
|
if (expected?.kind === "delegate") {
|
|
9680
9942
|
if (expression.kind === "lambda") {
|
|
@@ -9687,6 +9949,12 @@ var init_strict_resolver = __esm({
|
|
|
9687
9949
|
);
|
|
9688
9950
|
if (methodGroup !== null) return methodGroup;
|
|
9689
9951
|
}
|
|
9952
|
+
if (expected?.kind === "action" && expression.kind === "lambda") {
|
|
9953
|
+
throw new CompileError(
|
|
9954
|
+
"A lambda cannot be an action listener: a closure has no identity to deduplicate or remove by. Extract the body to an NSFunction member and subscribe that member instead.",
|
|
9955
|
+
expression.pos
|
|
9956
|
+
);
|
|
9957
|
+
}
|
|
9690
9958
|
switch (expression.kind) {
|
|
9691
9959
|
case "litNull":
|
|
9692
9960
|
return literal(
|
|
@@ -11032,6 +11300,13 @@ var init_strict_resolver = __esm({
|
|
|
11032
11300
|
callee.kind === "member" && callee.optional === true
|
|
11033
11301
|
);
|
|
11034
11302
|
}
|
|
11303
|
+
const action = this.resolveActionCallee(callee, scope);
|
|
11304
|
+
if (action !== null) {
|
|
11305
|
+
throw new CompileError(
|
|
11306
|
+
`${this.describe(action.type)} is void and cannot be used as a value; call it as a statement instead.`,
|
|
11307
|
+
pos
|
|
11308
|
+
);
|
|
11309
|
+
}
|
|
11035
11310
|
if (callee.kind === "ident") {
|
|
11036
11311
|
const vector = vectorKind(callee.name);
|
|
11037
11312
|
if (vector)
|
|
@@ -11254,6 +11529,37 @@ var init_strict_resolver = __esm({
|
|
|
11254
11529
|
throw error;
|
|
11255
11530
|
}
|
|
11256
11531
|
}
|
|
11532
|
+
/**
|
|
11533
|
+
* The action-typed sibling of {@link resolveDelegateCallee}. Kept separate
|
|
11534
|
+
* so an action never leaks into the delegate call path: an action is
|
|
11535
|
+
* statement-only, and its two call sites want opposite outcomes — the
|
|
11536
|
+
* statement path compiles it, the expression path rejects it.
|
|
11537
|
+
*/
|
|
11538
|
+
resolveActionCallee(callee, scope) {
|
|
11539
|
+
if (callee.kind === "ident") {
|
|
11540
|
+
const scoped = scope.lookup(callee.name);
|
|
11541
|
+
const implicit = this.implicitMember(callee.name);
|
|
11542
|
+
if (scoped === null && (implicit === null || implicit.symbol.kind === "function" || implicit.symbol.kind === "method")) {
|
|
11543
|
+
return null;
|
|
11544
|
+
}
|
|
11545
|
+
const resolved = this.resolveIdentifier(callee.name, scope, callee.pos);
|
|
11546
|
+
return resolved.type.kind === "action" ? resolved : null;
|
|
11547
|
+
}
|
|
11548
|
+
if (callee.kind !== "member") return null;
|
|
11549
|
+
try {
|
|
11550
|
+
const resolved = this.resolveMember(
|
|
11551
|
+
callee.receiver,
|
|
11552
|
+
callee.name,
|
|
11553
|
+
scope,
|
|
11554
|
+
callee.pos,
|
|
11555
|
+
callee.optional === true
|
|
11556
|
+
);
|
|
11557
|
+
return resolved.type.kind === "action" ? resolved : null;
|
|
11558
|
+
} catch (error) {
|
|
11559
|
+
if (error instanceof CompileError) return null;
|
|
11560
|
+
throw error;
|
|
11561
|
+
}
|
|
11562
|
+
}
|
|
11257
11563
|
resolveDelegateCall(delegate, args, scope, pos, optional) {
|
|
11258
11564
|
if (delegate.type.kind !== "delegate") {
|
|
11259
11565
|
throw new Error("Delegate call received a non-delegate type.");
|
|
@@ -12448,8 +12754,48 @@ var init_strict_resolver = __esm({
|
|
|
12448
12754
|
writeRoot: inferredWriteRoot ?? "unknown"
|
|
12449
12755
|
};
|
|
12450
12756
|
}
|
|
12757
|
+
/**
|
|
12758
|
+
* P62 §3.1. Statement-position invoke: every listener fires in stored order
|
|
12759
|
+
* and an empty listener set is a successful no-op, so there is nothing to
|
|
12760
|
+
* return and no optional form to carry.
|
|
12761
|
+
*/
|
|
12762
|
+
resolveActionCall(action, actionType, expression, scope) {
|
|
12763
|
+
if (expression.callee.kind === "member" && expression.callee.optional) {
|
|
12764
|
+
throw new CompileError(
|
|
12765
|
+
`${this.describe(actionType)} is never null, so optional-chained invocation is not supported.`,
|
|
12766
|
+
expression.pos
|
|
12767
|
+
);
|
|
12768
|
+
}
|
|
12769
|
+
requireArgCount(
|
|
12770
|
+
"Action",
|
|
12771
|
+
expression.args,
|
|
12772
|
+
actionType.parameterTypes.length,
|
|
12773
|
+
expression.pos
|
|
12774
|
+
);
|
|
12775
|
+
const args = expression.args.map((argument2, index) => {
|
|
12776
|
+
const expected = requiredAt(actionType.parameterTypes, index);
|
|
12777
|
+
const resolved = this.resolveExpression(argument2, scope, expected);
|
|
12778
|
+
this.requireAssignable(
|
|
12779
|
+
resolved.type,
|
|
12780
|
+
expected,
|
|
12781
|
+
argument2.pos,
|
|
12782
|
+
`action argument ${index + 1}`
|
|
12783
|
+
);
|
|
12784
|
+
return resolved.pointer;
|
|
12785
|
+
});
|
|
12786
|
+
return {
|
|
12787
|
+
type: "callAction" /* CallAction */,
|
|
12788
|
+
action: action.pointer,
|
|
12789
|
+
args,
|
|
12790
|
+
callSiteId: this.nextCallSite(expression.pos)
|
|
12791
|
+
};
|
|
12792
|
+
}
|
|
12451
12793
|
resolveFunctionStatement(expression, scope) {
|
|
12452
12794
|
if (expression.kind !== "call") return null;
|
|
12795
|
+
const action = this.resolveActionCallee(expression.callee, scope);
|
|
12796
|
+
if (action?.type.kind === "action") {
|
|
12797
|
+
return this.resolveActionCall(action, action.type, expression, scope);
|
|
12798
|
+
}
|
|
12453
12799
|
const delegate = this.resolveDelegateCallee(expression.callee, scope);
|
|
12454
12800
|
if (delegate?.type.kind === "delegate") {
|
|
12455
12801
|
const delegateType = delegate.type;
|
|
@@ -21797,6 +22143,9 @@ function substituteInheritedSourceMember(member, baseInfo, resolvedBaseType) {
|
|
|
21797
22143
|
parameterTypes: type.parameterTypes.map(substitute2)
|
|
21798
22144
|
};
|
|
21799
22145
|
}
|
|
22146
|
+
if (type.kind === "action") {
|
|
22147
|
+
return { ...type, parameterTypes: type.parameterTypes.map(substitute2) };
|
|
22148
|
+
}
|
|
21800
22149
|
return type;
|
|
21801
22150
|
};
|
|
21802
22151
|
return {
|
|
@@ -21876,6 +22225,14 @@ function sourceTypeRef(type, owner, typeIds) {
|
|
|
21876
22225
|
...nullable ? { nullable } : {}
|
|
21877
22226
|
};
|
|
21878
22227
|
}
|
|
22228
|
+
if (type.name === "NeoAction") {
|
|
22229
|
+
return {
|
|
22230
|
+
kind: "action",
|
|
22231
|
+
parameterTypes: type.typeArguments.map(
|
|
22232
|
+
(argument2) => sourceTypeRef(argument2, owner, typeIds)
|
|
22233
|
+
)
|
|
22234
|
+
};
|
|
22235
|
+
}
|
|
21879
22236
|
if (type.name === "Reference" && type.typeArguments[0]) {
|
|
21880
22237
|
return {
|
|
21881
22238
|
...sourceTypeRef(type.typeArguments[0], owner, typeIds),
|
|
@@ -22606,6 +22963,27 @@ function validateTypeApplication(uri, type, genericParameters, environment, diag
|
|
|
22606
22963
|
}
|
|
22607
22964
|
return;
|
|
22608
22965
|
}
|
|
22966
|
+
if (type.name === "NeoAction") {
|
|
22967
|
+
if (type.typeArguments.length > 16) {
|
|
22968
|
+
diagnose(
|
|
22969
|
+
diagnostics,
|
|
22970
|
+
uri,
|
|
22971
|
+
type.range,
|
|
22972
|
+
"generic-argument-arity",
|
|
22973
|
+
`Type 'NeoAction' expects up to 16 parameter types, but ${type.typeArguments.length} type arguments were provided.`
|
|
22974
|
+
);
|
|
22975
|
+
}
|
|
22976
|
+
if (type.nullable) {
|
|
22977
|
+
diagnose(
|
|
22978
|
+
diagnostics,
|
|
22979
|
+
uri,
|
|
22980
|
+
type.range,
|
|
22981
|
+
"action-nullable",
|
|
22982
|
+
"Type 'NeoAction' cannot be nullable; an action's rest state is an empty listener set, not null."
|
|
22983
|
+
);
|
|
22984
|
+
}
|
|
22985
|
+
return;
|
|
22986
|
+
}
|
|
22609
22987
|
const expected = target?.declaration.kind === "class" ? target.declaration.genericParameters.length : BUILTIN_ARITY.get(type.name) ?? 0;
|
|
22610
22988
|
if (!target && !BUILTIN_TYPES.has(type.name)) return;
|
|
22611
22989
|
if (type.typeArguments.length !== expected) {
|
|
@@ -22653,6 +23031,16 @@ function validateTypeApplication(uri, type, genericParameters, environment, diag
|
|
|
22653
23031
|
});
|
|
22654
23032
|
}
|
|
22655
23033
|
function validateMemberTypeKind(uri, type, context, name, diagnostics) {
|
|
23034
|
+
if (type.name === "NeoAction" && context === "return") {
|
|
23035
|
+
diagnose(
|
|
23036
|
+
diagnostics,
|
|
23037
|
+
uri,
|
|
23038
|
+
type.range,
|
|
23039
|
+
"invalid-member-type",
|
|
23040
|
+
`Function '${name}' cannot return 'NeoAction'; an action is invoked as a statement, never used as a value.`
|
|
23041
|
+
);
|
|
23042
|
+
return;
|
|
23043
|
+
}
|
|
22656
23044
|
if (context === "return") return;
|
|
22657
23045
|
if (type.name !== "void" && type.name !== "null") return;
|
|
22658
23046
|
diagnose(
|
|
@@ -30888,6 +31276,24 @@ function memberFromDocument(record3, members, owners, classNames, context) {
|
|
|
30888
31276
|
)
|
|
30889
31277
|
};
|
|
30890
31278
|
}
|
|
31279
|
+
if (kind === MEMBER_KIND.NSAction) {
|
|
31280
|
+
if (common.required === true) {
|
|
31281
|
+
throw invalidDocument(
|
|
31282
|
+
record3,
|
|
31283
|
+
"required",
|
|
31284
|
+
"an NSAction member is never nullable"
|
|
31285
|
+
);
|
|
31286
|
+
}
|
|
31287
|
+
return {
|
|
31288
|
+
...common,
|
|
31289
|
+
kind: "action",
|
|
31290
|
+
arguments: documentArgumentsToManifest(
|
|
31291
|
+
field("argumentTypes", []),
|
|
31292
|
+
record3,
|
|
31293
|
+
source.span
|
|
31294
|
+
)
|
|
31295
|
+
};
|
|
31296
|
+
}
|
|
30891
31297
|
if (kind === MEMBER_KIND.Generic) {
|
|
30892
31298
|
return {
|
|
30893
31299
|
...common,
|
|
@@ -31033,6 +31439,12 @@ function memberToDocumentFields(member, baseData3) {
|
|
|
31033
31439
|
...manifestTypeToDocument(argument2.type)
|
|
31034
31440
|
}));
|
|
31035
31441
|
}
|
|
31442
|
+
if (member.kind === "action") {
|
|
31443
|
+
fields.argumentTypes = member.arguments.map((argument2) => ({
|
|
31444
|
+
name: argument2.name,
|
|
31445
|
+
...manifestTypeToDocument(argument2.type)
|
|
31446
|
+
}));
|
|
31447
|
+
}
|
|
31036
31448
|
if (member.kind === "generic") {
|
|
31037
31449
|
fields.genericParamId = member.genericParamId;
|
|
31038
31450
|
if (member.partial) fields.partial = true;
|
|
@@ -31248,6 +31660,26 @@ function documentTypeToManifest(value, record3, path) {
|
|
|
31248
31660
|
)
|
|
31249
31661
|
};
|
|
31250
31662
|
}
|
|
31663
|
+
if (kind === MEMBER_KIND.NSAction) {
|
|
31664
|
+
if (nullable) {
|
|
31665
|
+
throw invalidDocument(
|
|
31666
|
+
record3,
|
|
31667
|
+
`${path}.required`,
|
|
31668
|
+
"an NeoAction type is never nullable"
|
|
31669
|
+
);
|
|
31670
|
+
}
|
|
31671
|
+
return {
|
|
31672
|
+
kind: "action",
|
|
31673
|
+
nullable: false,
|
|
31674
|
+
argumentTypes: optionalArray(typeInfo.argumentTypes).map(
|
|
31675
|
+
(argument2, index) => documentTypeToManifest(
|
|
31676
|
+
argument2,
|
|
31677
|
+
record3,
|
|
31678
|
+
`${path}.argumentTypes.${index}`
|
|
31679
|
+
)
|
|
31680
|
+
)
|
|
31681
|
+
};
|
|
31682
|
+
}
|
|
31251
31683
|
throw invalidDocument(
|
|
31252
31684
|
record3,
|
|
31253
31685
|
path,
|
|
@@ -31319,6 +31751,13 @@ function manifestTypeToDocument(type) {
|
|
|
31319
31751
|
argumentTypes: type.argumentTypes.map(manifestTypeToDocument)
|
|
31320
31752
|
};
|
|
31321
31753
|
}
|
|
31754
|
+
if (type.kind === "action") {
|
|
31755
|
+
return {
|
|
31756
|
+
type: MEMBER_KIND.NSAction,
|
|
31757
|
+
required: true,
|
|
31758
|
+
argumentTypes: type.argumentTypes.map(manifestTypeToDocument)
|
|
31759
|
+
};
|
|
31760
|
+
}
|
|
31322
31761
|
if (type.kind !== "lookup") {
|
|
31323
31762
|
throw new Error(`No document type-info mapping for ${type.kind}.`);
|
|
31324
31763
|
}
|
|
@@ -31711,7 +32150,8 @@ var init_codecs = __esm({
|
|
|
31711
32150
|
Interface: 22,
|
|
31712
32151
|
NSFunction: 23,
|
|
31713
32152
|
FunctionRef: 24,
|
|
31714
|
-
NSDelegate: 25
|
|
32153
|
+
NSDelegate: 25,
|
|
32154
|
+
NSAction: 26
|
|
31715
32155
|
};
|
|
31716
32156
|
TYPE_KIND_BY_MEMBER_KIND = /* @__PURE__ */ new Map([
|
|
31717
32157
|
[MEMBER_KIND.Null, "null"],
|
|
@@ -31763,7 +32203,8 @@ var init_codecs = __esm({
|
|
|
31763
32203
|
["generic", MEMBER_KIND.Generic],
|
|
31764
32204
|
["scriptFunction", MEMBER_KIND.NSFunction],
|
|
31765
32205
|
["functionRef", MEMBER_KIND.FunctionRef],
|
|
31766
|
-
["delegate", MEMBER_KIND.NSDelegate]
|
|
32206
|
+
["delegate", MEMBER_KIND.NSDelegate],
|
|
32207
|
+
["action", MEMBER_KIND.NSAction]
|
|
31767
32208
|
]);
|
|
31768
32209
|
TYPE_MEMBER_KIND_BY_KIND = /* @__PURE__ */ new Map([
|
|
31769
32210
|
["null", MEMBER_KIND.Null],
|
|
@@ -33967,6 +34408,16 @@ function assertMember2(value, path) {
|
|
|
33967
34408
|
}
|
|
33968
34409
|
return;
|
|
33969
34410
|
}
|
|
34411
|
+
if (kind === "action") {
|
|
34412
|
+
arrayOf(member.arguments, `${path}.arguments`, assertFunctionArgument);
|
|
34413
|
+
if (Array.isArray(member.arguments) && member.arguments.length > 16) {
|
|
34414
|
+
invalid(`${path}.arguments`, "action arity cannot exceed 16.");
|
|
34415
|
+
}
|
|
34416
|
+
if (member.required !== false) {
|
|
34417
|
+
invalid(`${path}.required`, "an action member is never nullable.");
|
|
34418
|
+
}
|
|
34419
|
+
return;
|
|
34420
|
+
}
|
|
33970
34421
|
if (kind === "generic") {
|
|
33971
34422
|
nonEmptyString(member.genericParamId, `${path}.genericParamId`);
|
|
33972
34423
|
if (member.partial !== void 0) {
|
|
@@ -34289,6 +34740,19 @@ function assertType2(value, path, depth = 0) {
|
|
|
34289
34740
|
}
|
|
34290
34741
|
return;
|
|
34291
34742
|
}
|
|
34743
|
+
if (kind === "action") {
|
|
34744
|
+
knownKeys(type, path, ["kind", "nullable", "argumentTypes"]);
|
|
34745
|
+
exactValue(type.nullable, false, `${path}.nullable`);
|
|
34746
|
+
arrayOf(
|
|
34747
|
+
type.argumentTypes,
|
|
34748
|
+
`${path}.argumentTypes`,
|
|
34749
|
+
(entry, entryPath) => assertType2(entry, entryPath, depth + 1)
|
|
34750
|
+
);
|
|
34751
|
+
if (Array.isArray(type.argumentTypes) && type.argumentTypes.length > 16) {
|
|
34752
|
+
invalid(`${path}.argumentTypes`, "action arity cannot exceed 16.");
|
|
34753
|
+
}
|
|
34754
|
+
return;
|
|
34755
|
+
}
|
|
34292
34756
|
invalid(`${path}.kind`, `unsupported schema type ${JSON.stringify(kind)}.`);
|
|
34293
34757
|
}
|
|
34294
34758
|
function assertInterface(value, path) {
|
|
@@ -35191,7 +35655,10 @@ var init_validate = __esm({
|
|
|
35191
35655
|
scriptFunction: ["returnType", "arguments", "deferred", "script"],
|
|
35192
35656
|
generic: ["genericParamId"],
|
|
35193
35657
|
functionRef: [],
|
|
35194
|
-
delegate: ["returnType", "arguments"]
|
|
35658
|
+
delegate: ["returnType", "arguments"],
|
|
35659
|
+
// P62 §2.1: an action is structurally void, so `arguments` is the only
|
|
35660
|
+
// kind-specific key it carries.
|
|
35661
|
+
action: ["arguments"]
|
|
35195
35662
|
};
|
|
35196
35663
|
PRIMITIVE_TYPE_KINDS = /* @__PURE__ */ new Set([
|
|
35197
35664
|
"null",
|
|
@@ -36255,6 +36722,23 @@ function isNSTypeInfoDelegateInternal(value, ancestors) {
|
|
|
36255
36722
|
ancestors.delete(delegate);
|
|
36256
36723
|
}
|
|
36257
36724
|
}
|
|
36725
|
+
function isNSTypeInfoActionInternal(value, ancestors) {
|
|
36726
|
+
if (!isNSTypeInfoBase(value) || value.type !== 26 /* NSAction */) {
|
|
36727
|
+
return false;
|
|
36728
|
+
}
|
|
36729
|
+
const action = value;
|
|
36730
|
+
if (ancestors.has(action)) return false;
|
|
36731
|
+
ancestors.add(action);
|
|
36732
|
+
try {
|
|
36733
|
+
if (!Array.isArray(action.argumentTypes)) return false;
|
|
36734
|
+
if (action.argumentTypes.length > 16) return false;
|
|
36735
|
+
return action.argumentTypes.every(
|
|
36736
|
+
(argument2) => isNSTypeInfoInternal(argument2, ancestors)
|
|
36737
|
+
);
|
|
36738
|
+
} finally {
|
|
36739
|
+
ancestors.delete(action);
|
|
36740
|
+
}
|
|
36741
|
+
}
|
|
36258
36742
|
function isNSTypeInfoCollection(value) {
|
|
36259
36743
|
return isNSTypeInfoCollectionInternal(value, /* @__PURE__ */ new Set());
|
|
36260
36744
|
}
|
|
@@ -36311,7 +36795,7 @@ function isNSTypeInfo(value) {
|
|
|
36311
36795
|
return isNSTypeInfoInternal(value, /* @__PURE__ */ new Set());
|
|
36312
36796
|
}
|
|
36313
36797
|
function isNSTypeInfoInternal(value, ancestors) {
|
|
36314
|
-
return isNSTypeInfoUnknown(value) || isNSTypeInfoPrimitive(value) || isNSTypeInfoAsset(value) || isNSTypeInfoVector(value) || isNSTypeInfoColor(value) || isNSTypeInfoDialogueLookup(value) || isNSTypeInfoClassInternal(value, ancestors) || isNSTypeInfoInterface(value) || isNSTypeInfoGenericParam(value) || isNSTypeInfoDelegateInternal(value, ancestors) || isNSTypeInfoCollectionInternal(value, ancestors) || isNSTypeInfoLookupInternal(value, ancestors) || isNSTypeInfoEnum(value);
|
|
36798
|
+
return isNSTypeInfoUnknown(value) || isNSTypeInfoPrimitive(value) || isNSTypeInfoAsset(value) || isNSTypeInfoVector(value) || isNSTypeInfoColor(value) || isNSTypeInfoDialogueLookup(value) || isNSTypeInfoClassInternal(value, ancestors) || isNSTypeInfoInterface(value) || isNSTypeInfoGenericParam(value) || isNSTypeInfoDelegateInternal(value, ancestors) || isNSTypeInfoActionInternal(value, ancestors) || isNSTypeInfoCollectionInternal(value, ancestors) || isNSTypeInfoLookupInternal(value, ancestors) || isNSTypeInfoEnum(value);
|
|
36315
36799
|
}
|
|
36316
36800
|
function isNSArgumentTypeInfo(value) {
|
|
36317
36801
|
return isRequiredType(value, isNSArgumentTypeInfoUnsafe);
|
|
@@ -36338,6 +36822,11 @@ function typeInfoContainsUnknown(value, ancestors) {
|
|
|
36338
36822
|
(argument2) => typeInfoContainsUnknown(argument2, ancestors)
|
|
36339
36823
|
);
|
|
36340
36824
|
}
|
|
36825
|
+
if (value.type === 26 /* NSAction */) {
|
|
36826
|
+
return value.argumentTypes.some(
|
|
36827
|
+
(argument2) => typeInfoContainsUnknown(argument2, ancestors)
|
|
36828
|
+
);
|
|
36829
|
+
}
|
|
36341
36830
|
if (value.type !== 7 /* Class */) return false;
|
|
36342
36831
|
return Object.values(value.typeArguments ?? {}).some(
|
|
36343
36832
|
(argument2) => typeInfoContainsUnknown(argument2, ancestors)
|
|
@@ -36488,6 +36977,16 @@ function isNSPointerCallDelegate(value) {
|
|
|
36488
36977
|
}
|
|
36489
36978
|
return v.optional === void 0 || typeof v.optional === "boolean";
|
|
36490
36979
|
}
|
|
36980
|
+
function isNSPointerCallAction(value) {
|
|
36981
|
+
const v = value;
|
|
36982
|
+
if (v?.type !== "callAction" /* callAction */) return false;
|
|
36983
|
+
if (!isNSPointer(v.action)) return false;
|
|
36984
|
+
if (!Array.isArray(v.args) || !v.args.every(isNSPointer)) return false;
|
|
36985
|
+
if (typeof v.callSiteId !== "string" || v.callSiteId.length === 0) {
|
|
36986
|
+
return false;
|
|
36987
|
+
}
|
|
36988
|
+
return v.optional === void 0;
|
|
36989
|
+
}
|
|
36491
36990
|
function isNSCallReceiver(value) {
|
|
36492
36991
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
36493
36992
|
return false;
|
|
@@ -36506,7 +37005,7 @@ function isNSPointerFunctionErrorCheck(value) {
|
|
|
36506
37005
|
return isNSFunctionErrorCheckMode(v.mode);
|
|
36507
37006
|
}
|
|
36508
37007
|
function isNSPointer(value) {
|
|
36509
|
-
return isNSPointerReference(value) || isNSPointerVariable(value) || isNSPointerStaticMember(value) || isNSPointerValue(value) || isNSPointerOperation(value) || isNSPointerFunction(value) || isNSPointerKeyOf(value) || isNSPointerListLiteral(value) || isNSPointerDictLiteral(value) || isNSPointerForceUnwrap(value) || isNSPointerIsCheck(value) || isNSPointerCallGetter(value) || isNSPointerCoalesce(value) || isNSPointerToBool(value) || isNSPointerStringify(value) || isNSPointerCallFunction(value) || isNSPointerCallDelegate(value) || isNSPointerFunctionErrorCheck(value);
|
|
37008
|
+
return isNSPointerReference(value) || isNSPointerVariable(value) || isNSPointerStaticMember(value) || isNSPointerValue(value) || isNSPointerOperation(value) || isNSPointerFunction(value) || isNSPointerKeyOf(value) || isNSPointerListLiteral(value) || isNSPointerDictLiteral(value) || isNSPointerForceUnwrap(value) || isNSPointerIsCheck(value) || isNSPointerCallGetter(value) || isNSPointerCoalesce(value) || isNSPointerToBool(value) || isNSPointerStringify(value) || isNSPointerCallFunction(value) || isNSPointerCallDelegate(value) || isNSPointerCallAction(value) || isNSPointerFunctionErrorCheck(value);
|
|
36510
37009
|
}
|
|
36511
37010
|
function isNSPointers(value) {
|
|
36512
37011
|
return Array.isArray(value) && value.every(isNSPointer);
|
|
@@ -36589,6 +37088,12 @@ function isNSFunctionWithReturnType(value) {
|
|
|
36589
37088
|
if (nsInstructionsContainType(v.instructions, "try" /* try */) && (v.compilerRevision ?? 1) < 6) {
|
|
36590
37089
|
return false;
|
|
36591
37090
|
}
|
|
37091
|
+
if ((v.compilerRevision ?? 1) < 8 && ([
|
|
37092
|
+
"addActionListener" /* addActionListener */,
|
|
37093
|
+
"removeActionListener" /* removeActionListener */
|
|
37094
|
+
].some((type) => nsInstructionsContainType(v.instructions ?? [], type)) || nsIRContainsPointerType(v.instructions, "callAction" /* callAction */))) {
|
|
37095
|
+
return false;
|
|
37096
|
+
}
|
|
36592
37097
|
if (!isNSTypeInfo(v.typeInfo)) return false;
|
|
36593
37098
|
return true;
|
|
36594
37099
|
}
|
|
@@ -36814,18 +37319,39 @@ function isNSInstructionThrow(value) {
|
|
|
36814
37319
|
if (v?.type !== "throw" /* throw */) return false;
|
|
36815
37320
|
return isNSPointer(v.pointer);
|
|
36816
37321
|
}
|
|
37322
|
+
function isNSWriteTarget(value) {
|
|
37323
|
+
const target = value;
|
|
37324
|
+
if (!target) return false;
|
|
37325
|
+
if (!isNSPointer(target.pointer)) return false;
|
|
37326
|
+
if (!isNSTypeInfo(target.typeInfo)) return false;
|
|
37327
|
+
if (target.writability === void 0) return true;
|
|
37328
|
+
return Object.values(NSWritability).includes(target.writability);
|
|
37329
|
+
}
|
|
36817
37330
|
function isNSInstructionAssign(value) {
|
|
36818
37331
|
const v = value;
|
|
36819
37332
|
if (v?.type !== "assign" /* assign */) return false;
|
|
36820
37333
|
if (v.operator === void 0) return false;
|
|
36821
37334
|
if (!Object.values(NSAssignmentOperator).includes(v.operator)) return false;
|
|
36822
37335
|
if (!isNSPointer(v.pointer)) return false;
|
|
36823
|
-
|
|
36824
|
-
|
|
36825
|
-
|
|
36826
|
-
|
|
36827
|
-
if (
|
|
36828
|
-
|
|
37336
|
+
return isNSWriteTarget(v.target);
|
|
37337
|
+
}
|
|
37338
|
+
function isNSInstructionActionListener(value, type) {
|
|
37339
|
+
const v = value;
|
|
37340
|
+
if (v?.type !== type) return false;
|
|
37341
|
+
if (!isNSWriteTarget(v.target)) return false;
|
|
37342
|
+
return isNSPointer(v.listener);
|
|
37343
|
+
}
|
|
37344
|
+
function isNSInstructionAddActionListener(value) {
|
|
37345
|
+
return isNSInstructionActionListener(
|
|
37346
|
+
value,
|
|
37347
|
+
"addActionListener" /* addActionListener */
|
|
37348
|
+
);
|
|
37349
|
+
}
|
|
37350
|
+
function isNSInstructionRemoveActionListener(value) {
|
|
37351
|
+
return isNSInstructionActionListener(
|
|
37352
|
+
value,
|
|
37353
|
+
"removeActionListener" /* removeActionListener */
|
|
37354
|
+
);
|
|
36829
37355
|
}
|
|
36830
37356
|
function isNSInstructionCollectionCall(value) {
|
|
36831
37357
|
const v = value;
|
|
@@ -36834,17 +37360,14 @@ function isNSInstructionCollectionCall(value) {
|
|
|
36834
37360
|
if (!Object.values(NSCollectionMutation).includes(v.mutation)) return false;
|
|
36835
37361
|
if (!Array.isArray(v.args)) return false;
|
|
36836
37362
|
if (!v.args.every(isNSPointer)) return false;
|
|
36837
|
-
|
|
36838
|
-
if (!target) return false;
|
|
36839
|
-
if (!isNSPointer(target.pointer)) return false;
|
|
36840
|
-
if (!isNSTypeInfo(target.typeInfo)) return false;
|
|
36841
|
-
if (target.writability === void 0) return true;
|
|
36842
|
-
return Object.values(NSWritability).includes(target.writability);
|
|
37363
|
+
return isNSWriteTarget(v.target);
|
|
36843
37364
|
}
|
|
36844
37365
|
function isNSInstructionFunctionCall(value) {
|
|
36845
37366
|
const v = value;
|
|
36846
37367
|
if (v?.type !== "functionCall" /* functionCall */) return false;
|
|
36847
|
-
|
|
37368
|
+
if (isNSPointerCallFunction(v.call)) return true;
|
|
37369
|
+
if (isNSPointerCallDelegate(v.call)) return true;
|
|
37370
|
+
return isNSPointerCallAction(v.call);
|
|
36848
37371
|
}
|
|
36849
37372
|
function isNSLoopBinding(value) {
|
|
36850
37373
|
const binding = value;
|
|
@@ -36974,7 +37497,7 @@ function isNSInstructionTry(value) {
|
|
|
36974
37497
|
return true;
|
|
36975
37498
|
}
|
|
36976
37499
|
function isNSInstruction(value) {
|
|
36977
|
-
return isNSInstructionVariable(value) || isNSInstructionIfBranch(value) || isNSInstructionReturn(value) || isNSInstructionThrow(value) || isNSInstructionAssign(value) || isNSInstructionCollectionCall(value) || isNSInstructionFunctionCall(value) || isNSInstructionFor(value) || isNSInstructionForEach(value) || isNSInstructionBreak(value) || isNSInstructionContinue(value) || isNSInstructionSwitch(value) || isNSInstructionTry(value);
|
|
37500
|
+
return isNSInstructionVariable(value) || isNSInstructionIfBranch(value) || isNSInstructionReturn(value) || isNSInstructionThrow(value) || isNSInstructionAssign(value) || isNSInstructionCollectionCall(value) || isNSInstructionFunctionCall(value) || isNSInstructionFor(value) || isNSInstructionForEach(value) || isNSInstructionBreak(value) || isNSInstructionContinue(value) || isNSInstructionSwitch(value) || isNSInstructionTry(value) || isNSInstructionAddActionListener(value) || isNSInstructionRemoveActionListener(value);
|
|
36978
37501
|
}
|
|
36979
37502
|
function nsInstructionsContainType(instructions, type) {
|
|
36980
37503
|
return instructions.some((instruction) => {
|
|
@@ -37000,6 +37523,21 @@ function nsInstructionsContainType(instructions, type) {
|
|
|
37000
37523
|
return false;
|
|
37001
37524
|
});
|
|
37002
37525
|
}
|
|
37526
|
+
function nsIRContainsPointerType(node, type, visited = /* @__PURE__ */ new Set()) {
|
|
37527
|
+
if (Array.isArray(node)) {
|
|
37528
|
+
return node.some((entry) => nsIRContainsPointerType(entry, type, visited));
|
|
37529
|
+
}
|
|
37530
|
+
if (typeof node !== "object" || node === null) return false;
|
|
37531
|
+
if (visited.has(node)) return false;
|
|
37532
|
+
visited.add(node);
|
|
37533
|
+
const record3 = node;
|
|
37534
|
+
if (record3.type === type) return true;
|
|
37535
|
+
const isLiteralValue = "typeInfo" in record3 && "value" in record3 && !("type" in record3);
|
|
37536
|
+
return Object.entries(record3).some(([key, child]) => {
|
|
37537
|
+
if (isLiteralValue && key === "value") return false;
|
|
37538
|
+
return nsIRContainsPointerType(child, type, visited);
|
|
37539
|
+
});
|
|
37540
|
+
}
|
|
37003
37541
|
function isNSInstructions(value) {
|
|
37004
37542
|
return Array.isArray(value) && value.every(isNSInstruction);
|
|
37005
37543
|
}
|
|
@@ -37041,7 +37579,7 @@ function isNSBoolGetter(value) {
|
|
|
37041
37579
|
if (value.typeInfo.type !== 1 /* Bool */) return false;
|
|
37042
37580
|
return value.typeInfo.required === true;
|
|
37043
37581
|
}
|
|
37044
|
-
function
|
|
37582
|
+
function isNSVoidBody(value) {
|
|
37045
37583
|
if (!isNSFunctionWithReturnType(value)) return false;
|
|
37046
37584
|
if (value.typeInfo.type !== 0 /* Null */) return false;
|
|
37047
37585
|
return value.typeInfo.required === true;
|
|
@@ -37177,6 +37715,12 @@ function typeInfosInvariantlyEqual(left, right) {
|
|
|
37177
37715
|
if (left.keyEnumId !== right.keyEnumId) return false;
|
|
37178
37716
|
return typeInfosInvariantlyEqual(left.entryTypeInfo, right.entryTypeInfo);
|
|
37179
37717
|
}
|
|
37718
|
+
if (left.type === 26 /* NSAction */ && right.type === 26 /* NSAction */) {
|
|
37719
|
+
if (left.argumentTypes.length !== right.argumentTypes.length) return false;
|
|
37720
|
+
return left.argumentTypes.every(
|
|
37721
|
+
(argument2, index) => typeInfosInvariantlyEqual(argument2, right.argumentTypes[index])
|
|
37722
|
+
);
|
|
37723
|
+
}
|
|
37180
37724
|
if (left.type === 9 /* Lookup */ && right.type === 9 /* Lookup */) {
|
|
37181
37725
|
if (left.collectionMemberId !== right.collectionMemberId) return false;
|
|
37182
37726
|
if (left.collectionValueId !== right.collectionValueId) return false;
|
|
@@ -37377,6 +37921,7 @@ var init_member_kind_enum = __esm({
|
|
|
37377
37921
|
MemberKind14[MemberKind14["NSFunction"] = 23] = "NSFunction";
|
|
37378
37922
|
MemberKind14[MemberKind14["FunctionRef"] = 24] = "FunctionRef";
|
|
37379
37923
|
MemberKind14[MemberKind14["NSDelegate"] = 25] = "NSDelegate";
|
|
37924
|
+
MemberKind14[MemberKind14["NSAction"] = 26] = "NSAction";
|
|
37380
37925
|
return MemberKind14;
|
|
37381
37926
|
})(MemberKind || {});
|
|
37382
37927
|
}
|
|
@@ -37798,8 +38343,8 @@ function isMemberNSProperty(value) {
|
|
|
37798
38343
|
const setterCode = getField(value, "setterCode");
|
|
37799
38344
|
const setter = getField(value, "setter");
|
|
37800
38345
|
if (setter !== void 0 && setterCode === void 0) return false;
|
|
37801
|
-
if (setterCode !== void 0 && !
|
|
37802
|
-
return setter === void 0 ||
|
|
38346
|
+
if (setterCode !== void 0 && !isNSVoidBody(setter)) return false;
|
|
38347
|
+
return setter === void 0 || isNSVoidBody(setter);
|
|
37803
38348
|
}
|
|
37804
38349
|
function isFileValue(value) {
|
|
37805
38350
|
const v = value;
|
|
@@ -37891,7 +38436,7 @@ function hasValidNSFunctionAction(value, returnTypeInfo, argumentTypes) {
|
|
|
37891
38436
|
);
|
|
37892
38437
|
}
|
|
37893
38438
|
function isNSFunctionUIBody(value) {
|
|
37894
|
-
if (!
|
|
38439
|
+
if (!isNSVoidBody(value)) return false;
|
|
37895
38440
|
if (value.instructions.length !== 1) return false;
|
|
37896
38441
|
const instruction = value.instructions[0];
|
|
37897
38442
|
if (instruction === void 0) return false;
|
|
@@ -38003,6 +38548,44 @@ function isMemberDelegateBase(value) {
|
|
|
38003
38548
|
if (isInitValueContent(defaultValue)) return true;
|
|
38004
38549
|
return isNSDelegateValue(defaultValue.value);
|
|
38005
38550
|
}
|
|
38551
|
+
function nsActionListenerIdentity(listener) {
|
|
38552
|
+
return `${listener.memberId} ${listener.valueId ?? ""}`;
|
|
38553
|
+
}
|
|
38554
|
+
function isNSActionValue(value) {
|
|
38555
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
38556
|
+
const record3 = value;
|
|
38557
|
+
if (!hasExactKeys(record3, ["listeners"])) return false;
|
|
38558
|
+
if (!Array.isArray(record3.listeners)) return false;
|
|
38559
|
+
const identities = /* @__PURE__ */ new Set();
|
|
38560
|
+
for (const listener of record3.listeners) {
|
|
38561
|
+
if (!isMemberDelegateTarget(listener)) return false;
|
|
38562
|
+
const identity2 = nsActionListenerIdentity(listener);
|
|
38563
|
+
if (identities.has(identity2)) return false;
|
|
38564
|
+
identities.add(identity2);
|
|
38565
|
+
}
|
|
38566
|
+
return true;
|
|
38567
|
+
}
|
|
38568
|
+
function isMemberActionBase(value) {
|
|
38569
|
+
const v = asMemberBaseForKind(value, 26 /* NSAction */);
|
|
38570
|
+
if (v === null) return false;
|
|
38571
|
+
if (v.required === true) return false;
|
|
38572
|
+
if (!Array.isArray(v.argumentTypes) || v.argumentTypes.length > 16) {
|
|
38573
|
+
return false;
|
|
38574
|
+
}
|
|
38575
|
+
const names = /* @__PURE__ */ new Set();
|
|
38576
|
+
for (const argument2 of v.argumentTypes) {
|
|
38577
|
+
if (!isNSFunctionArgumentTypeInfo(argument2)) return false;
|
|
38578
|
+
if (!isValidCallableIdentifier(argument2.name)) return false;
|
|
38579
|
+
if (argument2.type === NS_TYPE_UNKNOWN) return false;
|
|
38580
|
+
if (names.has(argument2.name)) return false;
|
|
38581
|
+
names.add(argument2.name);
|
|
38582
|
+
}
|
|
38583
|
+
const defaultValue = v.defaultValue;
|
|
38584
|
+
if (defaultValue === void 0 || defaultValue === null) return true;
|
|
38585
|
+
if (!isMemberValueBase(defaultValue)) return false;
|
|
38586
|
+
if (isInitValueContent(defaultValue)) return true;
|
|
38587
|
+
return isNSActionValue(defaultValue.value);
|
|
38588
|
+
}
|
|
38006
38589
|
function isFunctionRefValue(value) {
|
|
38007
38590
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
38008
38591
|
const record3 = value;
|
|
@@ -38067,7 +38650,7 @@ function isMemberBase(value) {
|
|
|
38067
38650
|
if (partial !== void 0 && v?.kind !== 7 /* Class */ && v?.kind !== 21 /* Generic */) {
|
|
38068
38651
|
return false;
|
|
38069
38652
|
}
|
|
38070
|
-
const matchesConcreteType = isMemberNullBase(value) || isMemberBoolBase(value) || isMemberIntBase(value) || isMemberStringBase(value) || isMemberFloatBase(value) || isMemberDictionaryBase(value) || isMemberListBase(value) || isMemberClassBase(value) || isMemberEnumBase(value) || isMemberLookupBase(value) || isMemberDialogueLookupBase(value) || isMemberNSPropertyBase(value) || isMemberNSPropertyContractBase(value) || isMemberSpriteBase(value) || isMemberAudioBase(value) || isMemberFunctionBase(value) || isMemberNSFunctionBase(value) || isMemberNSFunction(value) || isMemberDelegateBase(value) || isMemberFunctionRefBase(value) || isMemberVector2Base(value) || isMemberVector2IntBase(value) || isMemberVector3Base(value) || isMemberVector3IntBase(value) || isMemberColorBase(value) || isMemberDecimalBase(value) || isMemberGenericBase(value);
|
|
38653
|
+
const matchesConcreteType = isMemberNullBase(value) || isMemberBoolBase(value) || isMemberIntBase(value) || isMemberStringBase(value) || isMemberFloatBase(value) || isMemberDictionaryBase(value) || isMemberListBase(value) || isMemberClassBase(value) || isMemberEnumBase(value) || isMemberLookupBase(value) || isMemberDialogueLookupBase(value) || isMemberNSPropertyBase(value) || isMemberNSPropertyContractBase(value) || isMemberSpriteBase(value) || isMemberAudioBase(value) || isMemberFunctionBase(value) || isMemberNSFunctionBase(value) || isMemberNSFunction(value) || isMemberDelegateBase(value) || isMemberActionBase(value) || isMemberFunctionRefBase(value) || isMemberVector2Base(value) || isMemberVector2IntBase(value) || isMemberVector3Base(value) || isMemberVector3IntBase(value) || isMemberColorBase(value) || isMemberDecimalBase(value) || isMemberGenericBase(value);
|
|
38071
38654
|
if (!matchesConcreteType) return false;
|
|
38072
38655
|
if (!isValidDocsText(v?.docsText)) return false;
|
|
38073
38656
|
if (typeof v?.name !== "string") return false;
|
|
@@ -38258,8 +38841,8 @@ function isMemberOverrideProps(value) {
|
|
|
38258
38841
|
if (!isEpochMillis(v?.updatedAt)) return false;
|
|
38259
38842
|
if (v.getter !== void 0 && !isNSGetter(v.getter)) return false;
|
|
38260
38843
|
if (v.setter !== void 0 && v.setterCode === void 0) return false;
|
|
38261
|
-
if (v.setterCode !== void 0 && !
|
|
38262
|
-
if (v.setter !== void 0 && !
|
|
38844
|
+
if (v.setterCode !== void 0 && !isNSVoidBody(v.setter)) return false;
|
|
38845
|
+
if (v.setter !== void 0 && !isNSVoidBody(v.setter)) return false;
|
|
38263
38846
|
const isCallableOverride = v.kind === 13 /* Function */ || v.kind === 23 /* NSFunction */;
|
|
38264
38847
|
if (isCallableOverride) {
|
|
38265
38848
|
if (!isValidCallableIdentifier(v.name)) return false;
|
|
@@ -40142,6 +40725,18 @@ function substituteMember(member, env, members) {
|
|
|
40142
40725
|
};
|
|
40143
40726
|
return substituted;
|
|
40144
40727
|
}
|
|
40728
|
+
if (isMemberActionBase(resolved)) {
|
|
40729
|
+
let argumentsChanged = false;
|
|
40730
|
+
const argumentTypes = resolved.argumentTypes.map((argument2) => {
|
|
40731
|
+
const substituted2 = substituteNestedTypeInfo(argument2, env, members);
|
|
40732
|
+
if (substituted2 === argument2) return argument2;
|
|
40733
|
+
argumentsChanged = true;
|
|
40734
|
+
return { ...substituted2, name: argument2.name };
|
|
40735
|
+
});
|
|
40736
|
+
if (!argumentsChanged) return resolved;
|
|
40737
|
+
const substituted = { ...resolved, argumentTypes };
|
|
40738
|
+
return substituted;
|
|
40739
|
+
}
|
|
40145
40740
|
return resolved;
|
|
40146
40741
|
}
|
|
40147
40742
|
function substituteNestedTypeInfo(typeInfo, env, members) {
|
|
@@ -40199,6 +40794,14 @@ function substituteNestedTypeInfo(typeInfo, env, members) {
|
|
|
40199
40794
|
)
|
|
40200
40795
|
};
|
|
40201
40796
|
}
|
|
40797
|
+
if (typeInfo.type === 26 /* NSAction */) {
|
|
40798
|
+
return {
|
|
40799
|
+
...typeInfo,
|
|
40800
|
+
argumentTypes: typeInfo.argumentTypes.map(
|
|
40801
|
+
(argument2) => substituteNestedTypeInfo(argument2, env, members)
|
|
40802
|
+
)
|
|
40803
|
+
};
|
|
40804
|
+
}
|
|
40202
40805
|
return typeInfo;
|
|
40203
40806
|
}
|
|
40204
40807
|
function genericBindingTypeInfo(rawMember, env, members) {
|
|
@@ -40551,6 +41154,9 @@ var init_generics = __esm({
|
|
|
40551
41154
|
23 /* NSFunction */,
|
|
40552
41155
|
24 /* FunctionRef */,
|
|
40553
41156
|
25 /* NSDelegate */,
|
|
41157
|
+
// A signature carrier, not a binding target (P62 §2.1): `NeoAction<T>`
|
|
41158
|
+
// threads T through substitution, but no `T` is ever *bound* to an action.
|
|
41159
|
+
26 /* NSAction */,
|
|
40554
41160
|
21 /* Generic */
|
|
40555
41161
|
]);
|
|
40556
41162
|
}
|
|
@@ -42857,6 +43463,9 @@ function primitiveFallbackValue(document, member) {
|
|
|
42857
43463
|
}
|
|
42858
43464
|
};
|
|
42859
43465
|
}
|
|
43466
|
+
if (member.kind === 26 /* NSAction */) {
|
|
43467
|
+
return { value: { listeners: [] } };
|
|
43468
|
+
}
|
|
42860
43469
|
if (member.kind === 21 /* Generic */) {
|
|
42861
43470
|
throw new Error(
|
|
42862
43471
|
`Unreachable: Generic member "${member.name}" must be substituted through its binding environment before default value construction \u2014 a substitution site was skipped upstream (https://github.com/ryanbliss/neo-compose-specs/tree/main/new-features/complete/class-generics.md \xA74.1).`
|
|
@@ -44744,13 +45353,23 @@ function renderMemberType(context, member, enclosingClassId) {
|
|
|
44744
45353
|
)
|
|
44745
45354
|
].join(", ")}>`;
|
|
44746
45355
|
break;
|
|
45356
|
+
case "action":
|
|
45357
|
+
value = renderActionType(
|
|
45358
|
+
member.arguments.map((argument2) => renderType(context, argument2.type))
|
|
45359
|
+
);
|
|
45360
|
+
break;
|
|
44747
45361
|
}
|
|
44748
45362
|
if ((member.kind === "class" || member.kind === "generic") && member.partial === true) {
|
|
44749
45363
|
value = `Partial<${value}>`;
|
|
44750
45364
|
}
|
|
44751
45365
|
if (member.kind === "generic") return value;
|
|
45366
|
+
if (member.kind === "action") return value;
|
|
44752
45367
|
return nullable && value !== "null" ? `${value}?` : value;
|
|
44753
45368
|
}
|
|
45369
|
+
function renderActionType(argumentTypes) {
|
|
45370
|
+
if (argumentTypes.length === 0) return "NeoAction";
|
|
45371
|
+
return `NeoAction<${argumentTypes.join(", ")}>`;
|
|
45372
|
+
}
|
|
44754
45373
|
function renderLookupEntryType(context, collectionMemberId) {
|
|
44755
45374
|
const collection = required(
|
|
44756
45375
|
context.members,
|
|
@@ -44837,6 +45456,10 @@ function renderType(context, type) {
|
|
|
44837
45456
|
...type.argumentTypes.map((argument2) => renderType(context, argument2))
|
|
44838
45457
|
].join(", ")}>`;
|
|
44839
45458
|
break;
|
|
45459
|
+
case "action":
|
|
45460
|
+
return renderActionType(
|
|
45461
|
+
type.argumentTypes.map((argument2) => renderType(context, argument2))
|
|
45462
|
+
);
|
|
44840
45463
|
}
|
|
44841
45464
|
return type.nullable && value !== "null" ? `${value}?` : value;
|
|
44842
45465
|
}
|
|
@@ -44851,6 +45474,38 @@ function renderDefault(context, member) {
|
|
|
44851
45474
|
if ("init" in value) return value.init.code;
|
|
44852
45475
|
return renderDefaultValue(context, member, value);
|
|
44853
45476
|
}
|
|
45477
|
+
function renderActionListeners(context, member, value) {
|
|
45478
|
+
if (!isObject2(value)) {
|
|
45479
|
+
throw new Error(
|
|
45480
|
+
`NeoAction member ${member.name} stores a default that is not a listener set.`
|
|
45481
|
+
);
|
|
45482
|
+
}
|
|
45483
|
+
const { listeners } = value;
|
|
45484
|
+
if (!Array.isArray(listeners)) {
|
|
45485
|
+
throw new Error(
|
|
45486
|
+
`NeoAction member ${member.name} stores a default with no listeners array.`
|
|
45487
|
+
);
|
|
45488
|
+
}
|
|
45489
|
+
const names = listeners.map((listener, index) => {
|
|
45490
|
+
if (!isObject2(listener)) {
|
|
45491
|
+
throw new Error(
|
|
45492
|
+
`NeoAction member ${member.name} listener ${index} is not a member target.`
|
|
45493
|
+
);
|
|
45494
|
+
}
|
|
45495
|
+
if (typeof listener.memberId !== "string") {
|
|
45496
|
+
throw new Error(
|
|
45497
|
+
`NeoAction member ${member.name} listener ${index} is missing memberId.`
|
|
45498
|
+
);
|
|
45499
|
+
}
|
|
45500
|
+
if (listener.valueId !== null && listener.valueId !== void 0) {
|
|
45501
|
+
throw new Error(
|
|
45502
|
+
`NeoAction member ${member.name} listener ${index} is instance-bound, which no declaration default can spell.`
|
|
45503
|
+
);
|
|
45504
|
+
}
|
|
45505
|
+
return required(context.members, listener.memberId, "action listener").name;
|
|
45506
|
+
});
|
|
45507
|
+
return `[${names.join(", ")}]`;
|
|
45508
|
+
}
|
|
44854
45509
|
function initDefaultSource(member) {
|
|
44855
45510
|
const value = member.defaultValue;
|
|
44856
45511
|
if (value === null || value === void 0) return void 0;
|
|
@@ -44902,6 +45557,9 @@ function renderDefaultValue(context, member, wrapper) {
|
|
|
44902
45557
|
}
|
|
44903
45558
|
return `new ${target.name}${assignments.length ? ` { ${assignments.join(", ")} }` : "()"}`;
|
|
44904
45559
|
}
|
|
45560
|
+
if (member.kind === "action") {
|
|
45561
|
+
return renderActionListeners(context, member, value);
|
|
45562
|
+
}
|
|
44905
45563
|
if (member.kind === "functionRef" && isObject2(value) && typeof value.functionMemberId === "string") {
|
|
44906
45564
|
return required(
|
|
44907
45565
|
context.members,
|
|
@@ -46962,7 +47620,7 @@ function isNSBoolGetter2(value) {
|
|
|
46962
47620
|
if (value.typeInfo.type !== 1 /* Bool */) return false;
|
|
46963
47621
|
return value.typeInfo.required === true;
|
|
46964
47622
|
}
|
|
46965
|
-
function
|
|
47623
|
+
function isNSVoidBody2(value) {
|
|
46966
47624
|
if (!isNSGetter(value)) return false;
|
|
46967
47625
|
if (value.typeInfo.type !== 0 /* Null */) return false;
|
|
46968
47626
|
return value.typeInfo.required === true;
|
|
@@ -46995,7 +47653,7 @@ function isUILogicAction(value) {
|
|
|
46995
47653
|
if (typeof v !== "object") return false;
|
|
46996
47654
|
if (v === null) return false;
|
|
46997
47655
|
if (v.type !== 0 /* UI */) return false;
|
|
46998
|
-
if (!
|
|
47656
|
+
if (!isNSVoidBody2(v.action)) return false;
|
|
46999
47657
|
return isUIRenderableAction(v.action);
|
|
47000
47658
|
}
|
|
47001
47659
|
function isCodeLogicAction(value) {
|
|
@@ -47006,7 +47664,7 @@ function isCodeLogicAction(value) {
|
|
|
47006
47664
|
if (!isNonEmptyString(v.sourceFunctionId)) return false;
|
|
47007
47665
|
if (!isDialogueSourceIdentifier(v.sourceFunctionName)) return false;
|
|
47008
47666
|
if (typeof v.code !== "string") return false;
|
|
47009
|
-
return
|
|
47667
|
+
return isNSVoidBody2(v.action);
|
|
47010
47668
|
}
|
|
47011
47669
|
function isNonEmptyString(value) {
|
|
47012
47670
|
return typeof value === "string" && value.length > 0;
|
|
@@ -50678,6 +51336,30 @@ function lowerFieldMember(context, ownerClass, declaration, id2, commonInput, ba
|
|
|
50678
51336
|
}))
|
|
50679
51337
|
};
|
|
50680
51338
|
}
|
|
51339
|
+
if (name === "NeoAction") {
|
|
51340
|
+
if (partial) {
|
|
51341
|
+
throw new Error("Partial<T> requires a Class or Class generic target.");
|
|
51342
|
+
}
|
|
51343
|
+
if (declaration.type.nullable) {
|
|
51344
|
+
throw new Error(
|
|
51345
|
+
`NeoAction member ${ownerClass.name}.${declaration.name} cannot be nullable; an action's rest state is an empty listener list.`
|
|
51346
|
+
);
|
|
51347
|
+
}
|
|
51348
|
+
return {
|
|
51349
|
+
...common,
|
|
51350
|
+
kind: "action",
|
|
51351
|
+
// An action is structurally void, so every type argument is a
|
|
51352
|
+
// parameter — there is no leading return slot to skip. `required` is
|
|
51353
|
+
// fixed false because nullability has no meaning here (P62 §2.1).
|
|
51354
|
+
required: false,
|
|
51355
|
+
arguments: fieldType.arguments.map((argumentType, index) => ({
|
|
51356
|
+
name: `p${index + 1}`,
|
|
51357
|
+
type: lowerType(context, argumentType, ownerClass),
|
|
51358
|
+
source: span(declaration),
|
|
51359
|
+
selectionSpan: span(declaration)
|
|
51360
|
+
}))
|
|
51361
|
+
};
|
|
51362
|
+
}
|
|
50681
51363
|
if (name === "bool" || name === "null") {
|
|
50682
51364
|
return { ...common, kind: name };
|
|
50683
51365
|
}
|
|
@@ -51267,6 +51949,20 @@ function lowerType(context, type, ownerClass) {
|
|
|
51267
51949
|
argumentTypes: type.arguments.slice(1).map((argument2) => lowerType(context, argument2, ownerClass))
|
|
51268
51950
|
};
|
|
51269
51951
|
}
|
|
51952
|
+
if (type.name === "NeoAction") {
|
|
51953
|
+
if (nullable) {
|
|
51954
|
+
throw new Error(
|
|
51955
|
+
"NeoAction cannot be nullable; an action's rest state is an empty listener list."
|
|
51956
|
+
);
|
|
51957
|
+
}
|
|
51958
|
+
return {
|
|
51959
|
+
kind: "action",
|
|
51960
|
+
nullable: false,
|
|
51961
|
+
argumentTypes: type.arguments.map(
|
|
51962
|
+
(argument2) => lowerType(context, argument2, ownerClass)
|
|
51963
|
+
)
|
|
51964
|
+
};
|
|
51965
|
+
}
|
|
51270
51966
|
const classId = context.classIdsByName.get(type.name);
|
|
51271
51967
|
if (classId) {
|
|
51272
51968
|
const parameters = context.genericParametersByClass.get(classId);
|
|
@@ -51371,6 +52067,77 @@ function manifestTypeFromAstType(type) {
|
|
|
51371
52067
|
arguments: (type.typeArguments ?? []).map(manifestTypeFromAstType)
|
|
51372
52068
|
};
|
|
51373
52069
|
}
|
|
52070
|
+
function lowerActionDefault(context, expression, ownerClass, path) {
|
|
52071
|
+
const elements = expression.kind === "litList" ? expression.elements : [expression];
|
|
52072
|
+
const listeners = [];
|
|
52073
|
+
const identities = /* @__PURE__ */ new Set();
|
|
52074
|
+
elements.forEach((element, index) => {
|
|
52075
|
+
const memberId = lowerActionListenerId(
|
|
52076
|
+
context,
|
|
52077
|
+
element,
|
|
52078
|
+
ownerClass,
|
|
52079
|
+
`${path}[${index}]`
|
|
52080
|
+
);
|
|
52081
|
+
if (identities.has(memberId)) {
|
|
52082
|
+
throw new Error(
|
|
52083
|
+
`NeoAction listener ${path}[${index}] repeats an earlier listener; a listener set holds each target once.`
|
|
52084
|
+
);
|
|
52085
|
+
}
|
|
52086
|
+
identities.add(memberId);
|
|
52087
|
+
listeners.push({ memberId, valueId: null });
|
|
52088
|
+
});
|
|
52089
|
+
return { listeners };
|
|
52090
|
+
}
|
|
52091
|
+
function lowerActionListenerId(context, element, ownerClass, path) {
|
|
52092
|
+
let current = element;
|
|
52093
|
+
while (current.kind === "annotated") current = current.expression;
|
|
52094
|
+
if (current.kind === "lambda") {
|
|
52095
|
+
throw new Error(
|
|
52096
|
+
`NeoAction listener ${path} is a lambda. A listener must be a member reference: extract the body to an NSFunction member and subscribe that member instead.`
|
|
52097
|
+
);
|
|
52098
|
+
}
|
|
52099
|
+
const name = actionListenerSymbol(current);
|
|
52100
|
+
if (name === null) {
|
|
52101
|
+
throw new Error(
|
|
52102
|
+
`NeoAction listener ${path} must name a callable member on the current Class.`
|
|
52103
|
+
);
|
|
52104
|
+
}
|
|
52105
|
+
const classId = materializedId(ownerClass, "class", ownerClass.name);
|
|
52106
|
+
const memberId = effectiveMemberIdByName(context, classId, name);
|
|
52107
|
+
if (memberId === null) {
|
|
52108
|
+
throw new Error(
|
|
52109
|
+
`NeoAction listener ${path} names ${JSON.stringify(name)}, which ${ownerClass.name} does not declare or inherit.`
|
|
52110
|
+
);
|
|
52111
|
+
}
|
|
52112
|
+
const declaration = context.sourceMembersById.get(memberId)?.member;
|
|
52113
|
+
if (declaration === void 0) return memberId;
|
|
52114
|
+
if (declaration.kind === "function") {
|
|
52115
|
+
if (declaration.type.name !== "void") {
|
|
52116
|
+
throw new Error(
|
|
52117
|
+
`NeoAction listener ${path} targets ${declaration.name}, which returns a value; a listener must be void.`
|
|
52118
|
+
);
|
|
52119
|
+
}
|
|
52120
|
+
if (declaration.modifiers.includes("async")) {
|
|
52121
|
+
throw new Error(
|
|
52122
|
+
`NeoAction listener ${path} targets deferred ${declaration.name}; listeners are immediate-only.`
|
|
52123
|
+
);
|
|
52124
|
+
}
|
|
52125
|
+
return memberId;
|
|
52126
|
+
}
|
|
52127
|
+
if (declaration.type.name !== "NeoAction" && declaration.type.name !== "NeoDelegate") {
|
|
52128
|
+
throw new Error(
|
|
52129
|
+
`NeoAction listener ${path} targets ${declaration.name}, which is not a function, NSFunction, NSDelegate, or NeoAction member.`
|
|
52130
|
+
);
|
|
52131
|
+
}
|
|
52132
|
+
return memberId;
|
|
52133
|
+
}
|
|
52134
|
+
function actionListenerSymbol(expression) {
|
|
52135
|
+
if (expression.kind === "ident") return expression.name;
|
|
52136
|
+
if (expression.kind !== "member") return null;
|
|
52137
|
+
if (expression.receiver.kind !== "ident") return null;
|
|
52138
|
+
if (expression.receiver.name !== "this") return null;
|
|
52139
|
+
return expression.name;
|
|
52140
|
+
}
|
|
51374
52141
|
function lowerExpressionValue(context, expression, declaredExpected, ownerClass, path, genericEnvironment = EMPTY_GENERIC_TYPE_ENVIRONMENT, sourceText) {
|
|
51375
52142
|
const expected = substituteGenericTypeNames(
|
|
51376
52143
|
declaredExpected,
|
|
@@ -51390,6 +52157,9 @@ function lowerExpressionValue(context, expression, declaredExpected, ownerClass,
|
|
|
51390
52157
|
sourceText
|
|
51391
52158
|
);
|
|
51392
52159
|
}
|
|
52160
|
+
if (expected.name === "NeoAction") {
|
|
52161
|
+
return lowerActionDefault(context, expression, ownerClass, path);
|
|
52162
|
+
}
|
|
51393
52163
|
switch (expression.kind) {
|
|
51394
52164
|
case "litNull":
|
|
51395
52165
|
if (!expected.nullable) {
|
|
@@ -51644,6 +52414,7 @@ function lowerExpressionValue(context, expression, declaredExpected, ownerClass,
|
|
|
51644
52414
|
}
|
|
51645
52415
|
function positionRequiresEvaluation(context, expression, expected, ownerClass) {
|
|
51646
52416
|
if (isStoredDelegateLiteral(expected, expression)) return false;
|
|
52417
|
+
if (isStoredActionLiteral(expected, expression)) return false;
|
|
51647
52418
|
return initializerRequiresEvaluation(
|
|
51648
52419
|
context.declaredConstructors,
|
|
51649
52420
|
expression,
|
|
@@ -51660,6 +52431,12 @@ function isStoredDelegateLiteral(type, expression) {
|
|
|
51660
52431
|
while (current.kind === "annotated") current = current.expression;
|
|
51661
52432
|
return current.kind === "lambda";
|
|
51662
52433
|
}
|
|
52434
|
+
function isStoredActionLiteral(type, expression) {
|
|
52435
|
+
if (type.name !== "NeoAction") return false;
|
|
52436
|
+
let current = expression;
|
|
52437
|
+
while (current.kind === "annotated") current = current.expression;
|
|
52438
|
+
return current.kind === "litList";
|
|
52439
|
+
}
|
|
51663
52440
|
function lambdaExpressionSource(source, pos) {
|
|
51664
52441
|
let start = 0;
|
|
51665
52442
|
for (let line = 1; line < pos.line; line += 1) {
|
|
@@ -51852,6 +52629,15 @@ function manifestTypeForMember(context, member) {
|
|
|
51852
52629
|
]
|
|
51853
52630
|
};
|
|
51854
52631
|
}
|
|
52632
|
+
if (member.kind === "action") {
|
|
52633
|
+
return {
|
|
52634
|
+
name: "NeoAction",
|
|
52635
|
+
nullable: false,
|
|
52636
|
+
arguments: member.arguments.map(
|
|
52637
|
+
(argument2) => manifestTypeForSchemaType(context, argument2.type)
|
|
52638
|
+
)
|
|
52639
|
+
};
|
|
52640
|
+
}
|
|
51855
52641
|
if (member.kind === "enum") {
|
|
51856
52642
|
return {
|
|
51857
52643
|
name: context.baseEnums.get(member.enumId)?.name ?? "object",
|
|
@@ -51952,6 +52738,14 @@ function manifestTypeForSchemaType(context, type) {
|
|
|
51952
52738
|
)
|
|
51953
52739
|
]
|
|
51954
52740
|
};
|
|
52741
|
+
case "action":
|
|
52742
|
+
return {
|
|
52743
|
+
name: "NeoAction",
|
|
52744
|
+
nullable: false,
|
|
52745
|
+
arguments: type.argumentTypes.map(
|
|
52746
|
+
(argument2) => manifestTypeForSchemaType(context, argument2)
|
|
52747
|
+
)
|
|
52748
|
+
};
|
|
51955
52749
|
}
|
|
51956
52750
|
}
|
|
51957
52751
|
function genericParameterName(context, genericParamId) {
|
|
@@ -53286,6 +54080,15 @@ function memberRuntimeType(record3, context, seen = /* @__PURE__ */ new Set(), g
|
|
|
53286
54080
|
),
|
|
53287
54081
|
nullable: !required2
|
|
53288
54082
|
};
|
|
54083
|
+
case 26 /* NSAction */:
|
|
54084
|
+
if (!isMemberActionBase(member)) return UNKNOWN_TYPE2;
|
|
54085
|
+
return {
|
|
54086
|
+
kind: "action",
|
|
54087
|
+
parameterTypes: member.argumentTypes.map(
|
|
54088
|
+
(argument2) => toLanguageType(argument2, context, genericEnvironment)
|
|
54089
|
+
),
|
|
54090
|
+
nullable: false
|
|
54091
|
+
};
|
|
53289
54092
|
case 21 /* Generic */: {
|
|
53290
54093
|
const genericParamId = getOptionalString(member, "genericParamId");
|
|
53291
54094
|
if (!genericParamId) return UNKNOWN_TYPE2;
|
|
@@ -53493,6 +54296,14 @@ function toLanguageType(type, context, genericEnvironment) {
|
|
|
53493
54296
|
),
|
|
53494
54297
|
nullable: !required2
|
|
53495
54298
|
};
|
|
54299
|
+
case 26 /* NSAction */:
|
|
54300
|
+
return {
|
|
54301
|
+
kind: "action",
|
|
54302
|
+
parameterTypes: type.argumentTypes.map(
|
|
54303
|
+
(argument2) => toLanguageType(argument2, context, genericEnvironment)
|
|
54304
|
+
),
|
|
54305
|
+
nullable: false
|
|
54306
|
+
};
|
|
53496
54307
|
case 21 /* Generic */: {
|
|
53497
54308
|
const environmentEntry = genericEnvironment?.get(type.genericParamId);
|
|
53498
54309
|
if (environmentEntry?.kind === "member") {
|
|
@@ -53785,7 +54596,7 @@ function compileNSGetter(code, ctx) {
|
|
|
53785
54596
|
})
|
|
53786
54597
|
);
|
|
53787
54598
|
}
|
|
53788
|
-
function
|
|
54599
|
+
function compileNSVoidBody(code, ctx) {
|
|
53789
54600
|
const context = createContext(ctx, {
|
|
53790
54601
|
scriptKind: "action",
|
|
53791
54602
|
dialogueContext: ctx.dialogueContext
|
|
@@ -53985,12 +54796,12 @@ __export(compiler_adapter_exports, {
|
|
|
53985
54796
|
CompileError: () => CompileError,
|
|
53986
54797
|
NEOSCRIPT_COMPILER_ADAPTER_REVISION: () => NEOSCRIPT_COMPILER_ADAPTER_REVISION,
|
|
53987
54798
|
clearNeoScriptBodyCompileCache: () => clearNeoScriptBodyCompileCache,
|
|
53988
|
-
compileNSAction: () => compileNSAction,
|
|
53989
54799
|
compileNSConstructor: () => compileNSConstructor,
|
|
53990
54800
|
compileNSFunction: () => compileNSFunction,
|
|
53991
54801
|
compileNSGetter: () => compileNSGetter,
|
|
53992
54802
|
compileNSInitializer: () => compileNSInitializer,
|
|
53993
54803
|
compileNSSetter: () => compileNSSetter,
|
|
54804
|
+
compileNSVoidBody: () => compileNSVoidBody,
|
|
53994
54805
|
createNeoScriptCompilationProject: () => createNeoScriptCompilationProject
|
|
53995
54806
|
});
|
|
53996
54807
|
var init_compiler_adapter = __esm({
|
|
@@ -54494,6 +55305,14 @@ function substituteConstructorBaseType(typeInfo, owner, args) {
|
|
|
54494
55305
|
)
|
|
54495
55306
|
};
|
|
54496
55307
|
}
|
|
55308
|
+
if (typeInfo.type === 26 /* NSAction */) {
|
|
55309
|
+
return {
|
|
55310
|
+
...typeInfo,
|
|
55311
|
+
argumentTypes: typeInfo.argumentTypes.map(
|
|
55312
|
+
(argument2) => substituteConstructorBaseType(argument2, owner, args)
|
|
55313
|
+
)
|
|
55314
|
+
};
|
|
55315
|
+
}
|
|
54497
55316
|
if (typeInfo.type === 6 /* List */ || typeInfo.type === 5 /* Dictionary */ || typeInfo.type === 9 /* Lookup */) {
|
|
54498
55317
|
return {
|
|
54499
55318
|
...typeInfo,
|
|
@@ -54727,6 +55546,17 @@ function resolveMemberDeclaredTypeInfoInternal(member, members, seen) {
|
|
|
54727
55546
|
})
|
|
54728
55547
|
};
|
|
54729
55548
|
}
|
|
55549
|
+
if (isMemberActionBase(resolved)) {
|
|
55550
|
+
return {
|
|
55551
|
+
type: 26 /* NSAction */,
|
|
55552
|
+
required: false,
|
|
55553
|
+
argumentTypes: resolved.argumentTypes.map((argument2) => {
|
|
55554
|
+
const { name, ...typeInfo } = argument2;
|
|
55555
|
+
void name;
|
|
55556
|
+
return typeInfo;
|
|
55557
|
+
})
|
|
55558
|
+
};
|
|
55559
|
+
}
|
|
54730
55560
|
if (isMemberListBase(resolved) || isMemberDictionaryBase(resolved)) {
|
|
54731
55561
|
const entry = members.find(
|
|
54732
55562
|
(candidate) => candidate.id === resolved.entryMemberId
|
|
@@ -57010,8 +57840,20 @@ function pushConstructionFrame(ctx, label) {
|
|
|
57010
57840
|
state.constructionStack.pop();
|
|
57011
57841
|
};
|
|
57012
57842
|
}
|
|
57843
|
+
function schemaRevisionUnchanged(previous, next) {
|
|
57844
|
+
if (previous.length !== next.length) return false;
|
|
57845
|
+
return previous.every((cell, index) => cell === next[index]);
|
|
57846
|
+
}
|
|
57013
57847
|
function evaluatorResolutionCache(ctx) {
|
|
57014
|
-
ctx.__resolutionCache
|
|
57848
|
+
if (ctx.__resolutionCache !== void 0) return ctx.__resolutionCache;
|
|
57849
|
+
const { project, members, classes } = ctx.vm;
|
|
57850
|
+
const schemaRevision = ctx.vm.schemaRevision ?? NO_SCHEMA_REVISION;
|
|
57851
|
+
const entry = resolutionCacheByMembers.get(members);
|
|
57852
|
+
if (entry !== void 0 && entry.project === project && entry.classes === classes && schemaRevisionUnchanged(entry.schemaRevision, schemaRevision)) {
|
|
57853
|
+
ctx.__resolutionCache = entry.cache;
|
|
57854
|
+
return entry.cache;
|
|
57855
|
+
}
|
|
57856
|
+
const cache = {
|
|
57015
57857
|
schemaKeyByMemberId: /* @__PURE__ */ new Map(),
|
|
57016
57858
|
mergedSchemaByClassId: /* @__PURE__ */ new Map(),
|
|
57017
57859
|
callableSignatureByKey: /* @__PURE__ */ new Map(),
|
|
@@ -57020,7 +57862,14 @@ function evaluatorResolutionCache(ctx) {
|
|
|
57020
57862
|
compiledSetterByMemberId: /* @__PURE__ */ new Map(),
|
|
57021
57863
|
effectiveStorageResolver: void 0
|
|
57022
57864
|
};
|
|
57023
|
-
|
|
57865
|
+
resolutionCacheByMembers.set(members, {
|
|
57866
|
+
project,
|
|
57867
|
+
classes,
|
|
57868
|
+
schemaRevision,
|
|
57869
|
+
cache
|
|
57870
|
+
});
|
|
57871
|
+
ctx.__resolutionCache = cache;
|
|
57872
|
+
return cache;
|
|
57024
57873
|
}
|
|
57025
57874
|
function createdSessionValuesSince(session, existingIds) {
|
|
57026
57875
|
const created = [];
|
|
@@ -57089,7 +57938,7 @@ function evaluateNSGetterWithEffects(getter, ctx, argumentValues = []) {
|
|
|
57089
57938
|
finalizeConstructorAllocations(runtimeCtx, void 0, ownsInvocationState);
|
|
57090
57939
|
throw new NSGetterRuntimeError("Function ended without a return statement");
|
|
57091
57940
|
}
|
|
57092
|
-
function
|
|
57941
|
+
function evaluateNSVoidBody(action, ctx) {
|
|
57093
57942
|
const ownsInvocationState = ctx.__executionState === void 0;
|
|
57094
57943
|
const writes = [];
|
|
57095
57944
|
const runtimeCtx = withEvaluationRuntime(ctx, writes);
|
|
@@ -58006,6 +58855,11 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
58006
58855
|
});
|
|
58007
58856
|
break;
|
|
58008
58857
|
}
|
|
58858
|
+
case "addActionListener" /* addActionListener */:
|
|
58859
|
+
case "removeActionListener" /* removeActionListener */: {
|
|
58860
|
+
evalActionListenerInstruction(ins, scope, ctx, options);
|
|
58861
|
+
break;
|
|
58862
|
+
}
|
|
58009
58863
|
case "collectionCall" /* collectionCall */: {
|
|
58010
58864
|
evalCollectionMutationInstruction(ins, scope, ctx, options);
|
|
58011
58865
|
break;
|
|
@@ -58187,6 +59041,61 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
58187
59041
|
}
|
|
58188
59042
|
return { kind: "fallthrough" };
|
|
58189
59043
|
}
|
|
59044
|
+
function evalActionListenerInstruction(ins, scope, ctx, options) {
|
|
59045
|
+
const operator = ins.type === "addActionListener" /* addActionListener */ ? "+=" : "-=";
|
|
59046
|
+
if (ins.target.pointer.type === "variable" /* variable */) {
|
|
59047
|
+
throw new NSGetterRuntimeError(
|
|
59048
|
+
`NeoAction '${operator}' target must be a member, not a local variable.`
|
|
59049
|
+
);
|
|
59050
|
+
}
|
|
59051
|
+
if (ins.target.writability === "setter" /* Setter */) {
|
|
59052
|
+
throw new NSGetterRuntimeError(
|
|
59053
|
+
`NeoAction '${operator}' cannot route through a property setter; a listener set is stored data, not a computed value.`
|
|
59054
|
+
);
|
|
59055
|
+
}
|
|
59056
|
+
const listener = evalPointer(ins.listener, scope, ctx);
|
|
59057
|
+
if (!isMemberDelegateTarget(listener)) {
|
|
59058
|
+
throw new NSGetterRuntimeError(
|
|
59059
|
+
`NeoAction '${operator}' listener must resolve to a member target; closures are not listeners.`
|
|
59060
|
+
);
|
|
59061
|
+
}
|
|
59062
|
+
const current = actionListenersOf(
|
|
59063
|
+
evalPointer(ins.target.pointer, scope, ctx),
|
|
59064
|
+
() => `'${operator}' target`
|
|
59065
|
+
);
|
|
59066
|
+
const identity2 = nsActionListenerIdentity(listener);
|
|
59067
|
+
const present = current.some(
|
|
59068
|
+
(entry) => nsActionListenerIdentity(entry) === identity2
|
|
59069
|
+
);
|
|
59070
|
+
let listeners;
|
|
59071
|
+
if (ins.type === "addActionListener" /* addActionListener */) {
|
|
59072
|
+
if (present) return;
|
|
59073
|
+
listeners = [
|
|
59074
|
+
...current,
|
|
59075
|
+
{ memberId: listener.memberId, valueId: listener.valueId }
|
|
59076
|
+
];
|
|
59077
|
+
} else {
|
|
59078
|
+
if (!present) return;
|
|
59079
|
+
listeners = current.filter(
|
|
59080
|
+
(entry) => nsActionListenerIdentity(entry) !== identity2
|
|
59081
|
+
);
|
|
59082
|
+
}
|
|
59083
|
+
const value = { listeners };
|
|
59084
|
+
validateAssignmentTarget(ins.target.pointer, scope, ctx);
|
|
59085
|
+
applyOverlayAssignment(
|
|
59086
|
+
ins.target.pointer,
|
|
59087
|
+
ins.target.typeInfo,
|
|
59088
|
+
value,
|
|
59089
|
+
scope,
|
|
59090
|
+
ctx
|
|
59091
|
+
);
|
|
59092
|
+
options.writes.push({
|
|
59093
|
+
kind: "assign",
|
|
59094
|
+
target: ins.target,
|
|
59095
|
+
value,
|
|
59096
|
+
...resolvedDestinationFieldsForAssign(ins.target.pointer, scope, ctx)
|
|
59097
|
+
});
|
|
59098
|
+
}
|
|
58190
59099
|
function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx) {
|
|
58191
59100
|
if (target.type === "staticMember" /* staticMember */) {
|
|
58192
59101
|
if (ctx.storedConstructionReplay === true) {
|
|
@@ -59030,6 +59939,23 @@ function evalPointer(pointer, scope, ctx) {
|
|
|
59030
59939
|
const args = pointer.args.map((arg) => evalPointer(arg, scope, ctx));
|
|
59031
59940
|
return invokeDelegateValue(delegate, args, ctx, pointer.callSiteId);
|
|
59032
59941
|
}
|
|
59942
|
+
case "callAction" /* callAction */: {
|
|
59943
|
+
const read = readActionWithOwner(pointer.action, scope, ctx);
|
|
59944
|
+
const args = pointer.args.map((arg) => evalPointer(arg, scope, ctx));
|
|
59945
|
+
consumeBudget(ctx, "workUnits", 1, "work unit");
|
|
59946
|
+
invokeActionListeners(
|
|
59947
|
+
actionListenersOf(
|
|
59948
|
+
read.action,
|
|
59949
|
+
() => actionPointerLabel(pointer.action, ctx)
|
|
59950
|
+
),
|
|
59951
|
+
args,
|
|
59952
|
+
ctx,
|
|
59953
|
+
() => actionInvocationFrame(pointer.action, read.owner, ctx),
|
|
59954
|
+
read.owner,
|
|
59955
|
+
pointer.callSiteId
|
|
59956
|
+
);
|
|
59957
|
+
return null;
|
|
59958
|
+
}
|
|
59033
59959
|
case "functionErrorCheck" /* functionErrorCheck */: {
|
|
59034
59960
|
try {
|
|
59035
59961
|
evalPointer(pointer.call, scope, ctx);
|
|
@@ -59077,7 +60003,7 @@ function resolveEffectiveCallableMember(pointer, receiver, ctx) {
|
|
|
59077
60003
|
const runtimeMember = resolveRuntimeSchemaMember(receiver, schemaKey, ctx);
|
|
59078
60004
|
return runtimeMember ?? staticMember;
|
|
59079
60005
|
}
|
|
59080
|
-
function invokeDelegateValue(value, args, ctx, callSiteId) {
|
|
60006
|
+
function invokeDelegateValue(value, args, ctx, callSiteId, ownerReceiver) {
|
|
59081
60007
|
if (isNSDelegateClosureValueDraft(value)) {
|
|
59082
60008
|
throw new NSGetterRuntimeError(
|
|
59083
60009
|
"NeoDelegate closure has source code but no compiled action."
|
|
@@ -59097,6 +60023,11 @@ function invokeDelegateValue(value, args, ctx, callSiteId) {
|
|
|
59097
60023
|
value.action.typeInfo.type === 0 /* Null */
|
|
59098
60024
|
);
|
|
59099
60025
|
}
|
|
60026
|
+
if (isNSActionValue(value)) {
|
|
60027
|
+
throw new NSGetterRuntimeError(
|
|
60028
|
+
"An NSAction listener set is not a callable value; invoke the action member as a statement instead."
|
|
60029
|
+
);
|
|
60030
|
+
}
|
|
59100
60031
|
if (!isMemberDelegateTarget(value)) {
|
|
59101
60032
|
throw new NSGetterRuntimeError(
|
|
59102
60033
|
"NeoDelegate value is neither a closure nor a bound member target."
|
|
@@ -59128,6 +60059,8 @@ function invokeDelegateValue(value, args, ctx, callSiteId) {
|
|
|
59128
60059
|
);
|
|
59129
60060
|
}
|
|
59130
60061
|
receiver = row.value;
|
|
60062
|
+
} else if (ownerReceiver !== null && ownerReceiver !== void 0) {
|
|
60063
|
+
receiver = listenerReceiverOnOwner(member.id, ownerReceiver, ctx);
|
|
59131
60064
|
}
|
|
59132
60065
|
if (receiver !== null) {
|
|
59133
60066
|
const schemaKey = cachedSchemaKeyForMember(member.id, ctx);
|
|
@@ -59211,6 +60144,17 @@ function invokeDelegateValue(value, args, ctx, callSiteId) {
|
|
|
59211
60144
|
}
|
|
59212
60145
|
return invokeDelegateValue(nested, args, ctx, callSiteId);
|
|
59213
60146
|
}
|
|
60147
|
+
if (member.kind === 26 /* NSAction */) {
|
|
60148
|
+
invokeActionListeners(
|
|
60149
|
+
storedActionListeners(member, receiver, ctx),
|
|
60150
|
+
args,
|
|
60151
|
+
ctx,
|
|
60152
|
+
() => frame,
|
|
60153
|
+
receiver,
|
|
60154
|
+
callSiteId
|
|
60155
|
+
);
|
|
60156
|
+
return null;
|
|
60157
|
+
}
|
|
59214
60158
|
throw new NSGetterRuntimeError(
|
|
59215
60159
|
`NeoDelegate target '${member.name}' resolves to non-callable member kind ${MemberKind[member.kind]}.`
|
|
59216
60160
|
);
|
|
@@ -59218,6 +60162,107 @@ function invokeDelegateValue(value, args, ctx, callSiteId) {
|
|
|
59218
60162
|
state.delegateStack.pop();
|
|
59219
60163
|
}
|
|
59220
60164
|
}
|
|
60165
|
+
function actionListenersOf(value, describe2) {
|
|
60166
|
+
if (value === null || value === void 0) return [];
|
|
60167
|
+
if (!isNSActionValue(value)) {
|
|
60168
|
+
throw new NSGetterRuntimeError(
|
|
60169
|
+
`NeoAction ${describe2()} holds a value that is not a valid listener set \u2014 every entry must be a distinct member target.`
|
|
60170
|
+
);
|
|
60171
|
+
}
|
|
60172
|
+
return value.listeners;
|
|
60173
|
+
}
|
|
60174
|
+
function storedActionListeners(member, receiver, ctx) {
|
|
60175
|
+
const describe2 = () => `target '${member.name}'`;
|
|
60176
|
+
if (receiver !== null) {
|
|
60177
|
+
const schemaKey = cachedSchemaKeyForMember(member.id, ctx);
|
|
60178
|
+
if (schemaKey === null) {
|
|
60179
|
+
throw new NSGetterRuntimeError(
|
|
60180
|
+
`NeoAction target '${member.name}' has no schema key on its owning class.`
|
|
60181
|
+
);
|
|
60182
|
+
}
|
|
60183
|
+
if (typeof receiver !== "object" || !Object.prototype.hasOwnProperty.call(receiver, schemaKey)) {
|
|
60184
|
+
throw new NSGetterRuntimeError(
|
|
60185
|
+
`NeoAction target '${member.name}' is missing from its receiver.`
|
|
60186
|
+
);
|
|
60187
|
+
}
|
|
60188
|
+
return actionListenersOf(
|
|
60189
|
+
resolveValueIfIdForMember(
|
|
60190
|
+
receiver[schemaKey],
|
|
60191
|
+
member,
|
|
60192
|
+
ctx
|
|
60193
|
+
),
|
|
60194
|
+
describe2
|
|
60195
|
+
);
|
|
60196
|
+
}
|
|
60197
|
+
if (member.isStatic === true) {
|
|
60198
|
+
return actionListenersOf(evalStaticMember(member.id, ctx), describe2);
|
|
60199
|
+
}
|
|
60200
|
+
if (member.defaultValue === void 0 || member.defaultValue === null) {
|
|
60201
|
+
return [];
|
|
60202
|
+
}
|
|
60203
|
+
if (!isLiteralValueContent(member.defaultValue)) {
|
|
60204
|
+
throw new NSGetterRuntimeError(
|
|
60205
|
+
`NeoAction target '${member.name}' has an unevaluated initializer instead of a declaration default listener set.`
|
|
60206
|
+
);
|
|
60207
|
+
}
|
|
60208
|
+
return actionListenersOf(member.defaultValue.value, describe2);
|
|
60209
|
+
}
|
|
60210
|
+
function listenerReceiverOnOwner(memberId, ownerReceiver, ctx) {
|
|
60211
|
+
const schemaKey = cachedSchemaKeyForMember(memberId, ctx);
|
|
60212
|
+
if (schemaKey === null) return null;
|
|
60213
|
+
const onOwner = resolveRuntimeSchemaMember(ownerReceiver, schemaKey, ctx);
|
|
60214
|
+
if (onOwner === null) return null;
|
|
60215
|
+
return ownerReceiver;
|
|
60216
|
+
}
|
|
60217
|
+
function invokeActionListeners(listeners, args, ctx, frame, ownerReceiver, callSiteId) {
|
|
60218
|
+
for (let index = 0; index < listeners.length; index += 1) {
|
|
60219
|
+
try {
|
|
60220
|
+
invokeDelegateValue(
|
|
60221
|
+
listeners[index],
|
|
60222
|
+
args,
|
|
60223
|
+
ctx,
|
|
60224
|
+
callSiteId,
|
|
60225
|
+
ownerReceiver
|
|
60226
|
+
);
|
|
60227
|
+
} catch (error) {
|
|
60228
|
+
if (!isCatchableNeoScriptRuntimeError(error)) throw error;
|
|
60229
|
+
throw new NSGetterRuntimeError(
|
|
60230
|
+
`${frame()} listener ${index} threw: ${error.message}`
|
|
60231
|
+
);
|
|
60232
|
+
}
|
|
60233
|
+
}
|
|
60234
|
+
}
|
|
60235
|
+
function readActionWithOwner(pointer, scope, ctx) {
|
|
60236
|
+
if (pointer.type !== "keyOf" /* keyOf */) {
|
|
60237
|
+
return { action: evalPointer(pointer, scope, ctx), owner: null };
|
|
60238
|
+
}
|
|
60239
|
+
let owner = null;
|
|
60240
|
+
const action = evalKeyOf(
|
|
60241
|
+
pointer.keyOf,
|
|
60242
|
+
scope,
|
|
60243
|
+
ctx,
|
|
60244
|
+
pointer.optional === true,
|
|
60245
|
+
pointer.memberId,
|
|
60246
|
+
(receiver) => {
|
|
60247
|
+
owner = receiver;
|
|
60248
|
+
}
|
|
60249
|
+
);
|
|
60250
|
+
return { action, owner };
|
|
60251
|
+
}
|
|
60252
|
+
function actionPointerLabel(pointer, ctx) {
|
|
60253
|
+
if (pointer.type === "staticMember" /* staticMember */) {
|
|
60254
|
+
return evalMemberById(ctx.vm, pointer.memberId)?.name ?? pointer.memberId;
|
|
60255
|
+
}
|
|
60256
|
+
if (pointer.type === "keyOf" /* keyOf */ && pointer.memberId !== void 0) {
|
|
60257
|
+
return evalMemberById(ctx.vm, pointer.memberId)?.name ?? pointer.memberId;
|
|
60258
|
+
}
|
|
60259
|
+
return "action";
|
|
60260
|
+
}
|
|
60261
|
+
function actionInvocationFrame(pointer, owner, ctx) {
|
|
60262
|
+
const name = actionPointerLabel(pointer, ctx);
|
|
60263
|
+
if (owner === null || owner === void 0) return `${name}[default]`;
|
|
60264
|
+
return `${name}[${findKnownRowIdByValueReference(owner, ctx) ?? "default"}]`;
|
|
60265
|
+
}
|
|
59221
60266
|
function nativeReceiverDescription(member, receiver, receiverId) {
|
|
59222
60267
|
if (receiverId !== void 0) return `, receiver value id '${receiverId}'`;
|
|
59223
60268
|
return member.isStatic === true || receiver === null ? ", static receiver" : ", untracked instance receiver";
|
|
@@ -59762,6 +60807,8 @@ function runtimeTypeCheck(value, checkType, ctx, seenCollections = /* @__PURE__
|
|
|
59762
60807
|
return typeof value === "string";
|
|
59763
60808
|
case 25 /* NSDelegate */:
|
|
59764
60809
|
return isNSDelegateClosureValue(value) || isMemberDelegateTarget(value);
|
|
60810
|
+
case 26 /* NSAction */:
|
|
60811
|
+
return isNSActionValue(value);
|
|
59765
60812
|
case 11 /* Sprite */:
|
|
59766
60813
|
return isRuntimeSpriteValue(value);
|
|
59767
60814
|
case 12 /* Audio */:
|
|
@@ -59904,8 +60951,9 @@ function isRuntimeSpriteValue(value) {
|
|
|
59904
60951
|
const sliceIndex = value.sliceIndex;
|
|
59905
60952
|
return typeof sliceIndex === "number" && Number.isInteger(sliceIndex) && sliceIndex >= 0;
|
|
59906
60953
|
}
|
|
59907
|
-
function evalKeyOf(keyOf, scope, ctx, optional = false, memberId) {
|
|
60954
|
+
function evalKeyOf(keyOf, scope, ctx, optional = false, memberId, onReceiver) {
|
|
59908
60955
|
const receiver = evalPointer(keyOf.pointer, scope, ctx);
|
|
60956
|
+
onReceiver?.(receiver);
|
|
59909
60957
|
if (optional && (receiver === null || receiver === void 0)) {
|
|
59910
60958
|
return null;
|
|
59911
60959
|
}
|
|
@@ -60565,11 +61613,16 @@ function evalFunction(fn, scope, ctx) {
|
|
|
60565
61613
|
}
|
|
60566
61614
|
return c.includes(target);
|
|
60567
61615
|
}
|
|
60568
|
-
|
|
60569
|
-
|
|
60570
|
-
|
|
60571
|
-
|
|
60572
|
-
|
|
61616
|
+
const targetReferenceId = typeof target === "string" ? target : findKnownRowIdByValueReference(target, ctx);
|
|
61617
|
+
let containsResolvedEntry = false;
|
|
61618
|
+
iterateCollection(c, ctx, (entry, _key, valueId) => {
|
|
61619
|
+
if (valueId !== null && valueId === targetReferenceId || jsEqual(entry, target)) {
|
|
61620
|
+
containsResolvedEntry = true;
|
|
61621
|
+
return 1 /* Break */;
|
|
61622
|
+
}
|
|
61623
|
+
return 0 /* Continue */;
|
|
61624
|
+
});
|
|
61625
|
+
return containsResolvedEntry;
|
|
60573
61626
|
}
|
|
60574
61627
|
case "decimalOp" /* decimalOp */: {
|
|
60575
61628
|
const info = fn.info;
|
|
@@ -60724,6 +61777,7 @@ function evalFunction(fn, scope, ctx) {
|
|
|
60724
61777
|
out[String(key)] = valueId ?? entry;
|
|
60725
61778
|
}
|
|
60726
61779
|
}
|
|
61780
|
+
return 0 /* Continue */;
|
|
60727
61781
|
});
|
|
60728
61782
|
return out;
|
|
60729
61783
|
}
|
|
@@ -60735,10 +61789,9 @@ function evalFunction(fn, scope, ctx) {
|
|
|
60735
61789
|
const sentinel = /* @__PURE__ */ Symbol("not-found");
|
|
60736
61790
|
let found = sentinel;
|
|
60737
61791
|
iterateCollection(c, ctx, (entry, key) => {
|
|
60738
|
-
if (found !== sentinel) return;
|
|
60739
61792
|
if (!innerFn) {
|
|
60740
61793
|
found = entry;
|
|
60741
|
-
return
|
|
61794
|
+
return 1 /* Break */;
|
|
60742
61795
|
}
|
|
60743
61796
|
consumeBudget(ctx, "workUnits", 1, "work unit");
|
|
60744
61797
|
const innerScope = pushParams(
|
|
@@ -60755,7 +61808,9 @@ function evalFunction(fn, scope, ctx) {
|
|
|
60755
61808
|
);
|
|
60756
61809
|
if (result.kind === "return" && result.value === true) {
|
|
60757
61810
|
found = entry;
|
|
61811
|
+
return 1 /* Break */;
|
|
60758
61812
|
}
|
|
61813
|
+
return 0 /* Continue */;
|
|
60759
61814
|
});
|
|
60760
61815
|
if (found !== sentinel) return found;
|
|
60761
61816
|
if (fn.type === "first" /* first */) {
|
|
@@ -60793,6 +61848,7 @@ function evalFunction(fn, scope, ctx) {
|
|
|
60793
61848
|
);
|
|
60794
61849
|
out.push(result.value);
|
|
60795
61850
|
}
|
|
61851
|
+
return 0 /* Continue */;
|
|
60796
61852
|
});
|
|
60797
61853
|
return out;
|
|
60798
61854
|
}
|
|
@@ -63256,6 +64312,7 @@ function snapshotCollectionMembership(collection, ctx) {
|
|
|
63256
64312
|
const valid = forEachRawCollectionEntry(collection, ({ raw }) => {
|
|
63257
64313
|
consumeBudget(ctx, "collectionVisits", 1, "collection visit");
|
|
63258
64314
|
membership.push(raw);
|
|
64315
|
+
return 0 /* Continue */;
|
|
63259
64316
|
});
|
|
63260
64317
|
if (valid) return membership;
|
|
63261
64318
|
throw new NSGetterRuntimeError(
|
|
@@ -63266,21 +64323,23 @@ function forEachRawCollectionEntry(c, callback) {
|
|
|
63266
64323
|
if (Array.isArray(c)) {
|
|
63267
64324
|
for (let key = 0; key < c.length; key += 1) {
|
|
63268
64325
|
const raw = c[key];
|
|
63269
|
-
callback({
|
|
64326
|
+
const control = callback({
|
|
63270
64327
|
raw,
|
|
63271
64328
|
key,
|
|
63272
64329
|
valueId: typeof raw === "string" ? raw : null
|
|
63273
64330
|
});
|
|
64331
|
+
if (control === 1 /* Break */) break;
|
|
63274
64332
|
}
|
|
63275
64333
|
return true;
|
|
63276
64334
|
}
|
|
63277
64335
|
if (typeof c === "object" && c !== null) {
|
|
63278
64336
|
for (const [key, raw] of Object.entries(c)) {
|
|
63279
|
-
callback({
|
|
64337
|
+
const control = callback({
|
|
63280
64338
|
raw,
|
|
63281
64339
|
key,
|
|
63282
64340
|
valueId: typeof raw === "string" ? raw : null
|
|
63283
64341
|
});
|
|
64342
|
+
if (control === 1 /* Break */) break;
|
|
63284
64343
|
}
|
|
63285
64344
|
return true;
|
|
63286
64345
|
}
|
|
@@ -63291,6 +64350,7 @@ function collectionEntries(c, ctx) {
|
|
|
63291
64350
|
forEachRawCollectionEntry(c, ({ raw }) => {
|
|
63292
64351
|
consumeBudget(ctx, "collectionVisits", 1, "collection visit");
|
|
63293
64352
|
entries.push(resolveValueIfId(raw, ctx));
|
|
64353
|
+
return 0 /* Continue */;
|
|
63294
64354
|
});
|
|
63295
64355
|
return entries;
|
|
63296
64356
|
}
|
|
@@ -63298,7 +64358,7 @@ function iterateCollection(c, ctx, callback) {
|
|
|
63298
64358
|
forEachRawCollectionEntry(c, ({ raw, key, valueId }) => {
|
|
63299
64359
|
consumeBudget(ctx, "collectionVisits", 1, "collection visit");
|
|
63300
64360
|
const entry = resolveValueIfId(raw, ctx);
|
|
63301
|
-
callback(entry, key, valueId);
|
|
64361
|
+
return callback(entry, key, valueId);
|
|
63302
64362
|
});
|
|
63303
64363
|
}
|
|
63304
64364
|
function pushParams(parent, parameters, positional, isList) {
|
|
@@ -63312,7 +64372,7 @@ function pushParams(parent, parameters, positional, isList) {
|
|
|
63312
64372
|
}
|
|
63313
64373
|
return child;
|
|
63314
64374
|
}
|
|
63315
|
-
var DELEGATE_LEXICAL_THIS, DELEGATE_LEXICAL_ROOT, NonCatchableNSGetterRuntimeError, NativeFunctionDelegateUnavailableError, CorruptNeoScriptIRError, NeoScriptResourceLimitError, NeoScriptWallClockTimeoutError, DEFAULT_NEO_SCRIPT_EXECUTION_BUDGET_LIMITS, liveListIndexesByProject, evaluatorOwnershipCachesByBase, MAX_CONSTRUCTION_DEPTH, MAX_LOOP_ITERATIONS, LazyValueOverlay, readonlyBindingErrorsByScope, READONLY_FOREACH_BINDING_ERROR, READONLY_CATCH_BINDING_ERROR;
|
|
64375
|
+
var DELEGATE_LEXICAL_THIS, DELEGATE_LEXICAL_ROOT, NonCatchableNSGetterRuntimeError, NativeFunctionDelegateUnavailableError, CorruptNeoScriptIRError, NeoScriptResourceLimitError, NeoScriptWallClockTimeoutError, DEFAULT_NEO_SCRIPT_EXECUTION_BUDGET_LIMITS, liveListIndexesByProject, evaluatorOwnershipCachesByBase, MAX_CONSTRUCTION_DEPTH, MAX_LOOP_ITERATIONS, resolutionCacheByMembers, NO_SCHEMA_REVISION, LazyValueOverlay, readonlyBindingErrorsByScope, READONLY_FOREACH_BINDING_ERROR, READONLY_CATCH_BINDING_ERROR;
|
|
63316
64376
|
var init_evaluateNSGetter = __esm({
|
|
63317
64377
|
"../src/view-models/neoscript-evaluator/evaluateNSGetter.ts"() {
|
|
63318
64378
|
"use strict";
|
|
@@ -63366,6 +64426,8 @@ var init_evaluateNSGetter = __esm({
|
|
|
63366
64426
|
evaluatorOwnershipCachesByBase = /* @__PURE__ */ new WeakMap();
|
|
63367
64427
|
MAX_CONSTRUCTION_DEPTH = 64;
|
|
63368
64428
|
MAX_LOOP_ITERATIONS = 1e4;
|
|
64429
|
+
resolutionCacheByMembers = /* @__PURE__ */ new WeakMap();
|
|
64430
|
+
NO_SCHEMA_REVISION = [];
|
|
63369
64431
|
LazyValueOverlay = class extends Map {
|
|
63370
64432
|
constructor(vm) {
|
|
63371
64433
|
super();
|
|
@@ -75849,7 +76911,7 @@ function compileProjectMigrationAction(document, migration) {
|
|
|
75849
76911
|
const thisClass = migration.targetClassId === null ? null : document.classes.find(
|
|
75850
76912
|
(schemaClass2) => schemaClass2.id === migration.targetClassId
|
|
75851
76913
|
) ?? null;
|
|
75852
|
-
return
|
|
76914
|
+
return compileNSVoidBody(migration.code, {
|
|
75853
76915
|
project: document.project,
|
|
75854
76916
|
members: document.members,
|
|
75855
76917
|
classes: document.classes,
|
|
@@ -76306,7 +77368,7 @@ function compileDialogueLogicWithProjectData(request, projectData) {
|
|
|
76306
77368
|
});
|
|
76307
77369
|
return {
|
|
76308
77370
|
target: 1 /* Action */,
|
|
76309
|
-
action:
|
|
77371
|
+
action: compileNSVoidBody(request.code, ctx)
|
|
76310
77372
|
};
|
|
76311
77373
|
}
|
|
76312
77374
|
function stringifyCompiledTextGetter(getter) {
|
|
@@ -76536,8 +77598,8 @@ function recompileDialogueNode(args) {
|
|
|
76536
77598
|
if (nodeType === 2 /* Actions */) {
|
|
76537
77599
|
const actions = args.node.actions;
|
|
76538
77600
|
if (!Array.isArray(actions)) return false;
|
|
76539
|
-
for (const
|
|
76540
|
-
const action = asObject(
|
|
77601
|
+
for (const actionValue2 of actions) {
|
|
77602
|
+
const action = asObject(actionValue2);
|
|
76541
77603
|
if (action?.type !== 0 /* EditMember */) continue;
|
|
76542
77604
|
const logic = asObject(action.logic);
|
|
76543
77605
|
if (!isCodeLogic(logic)) continue;
|
|
@@ -77051,13 +78113,16 @@ var init_project_version_static_value_writes = __esm({
|
|
|
77051
78113
|
);
|
|
77052
78114
|
}
|
|
77053
78115
|
const normalizedExpected = normalizeMapKey(args.expectedMapKey);
|
|
78116
|
+
const normalizedStored = normalizeMapKey(value.mapKey);
|
|
77054
78117
|
if (this.createdValueIds.has(value.id)) {
|
|
77055
78118
|
this.visitedCreatedValueIds.add(value.id);
|
|
77056
78119
|
if (normalizedExpected === null) delete value.mapKey;
|
|
77057
78120
|
else value.mapKey = normalizedExpected;
|
|
77058
|
-
} else if (
|
|
78121
|
+
} else if (normalizedStored === null && normalizedExpected !== null) {
|
|
78122
|
+
value.mapKey = normalizedExpected;
|
|
78123
|
+
} else if (normalizedStored !== normalizedExpected) {
|
|
77059
78124
|
throw new Error(
|
|
77060
|
-
`${args.path} cannot bind value "${value.id}" from storage partition ${JSON.stringify(
|
|
78125
|
+
`${args.path} cannot bind value "${value.id}" from storage partition ${JSON.stringify(normalizedStored ?? "main")}; expected ${JSON.stringify(normalizedExpected ?? "main")}.`
|
|
77061
78126
|
);
|
|
77062
78127
|
}
|
|
77063
78128
|
if (args.graphValueIds.has(value.id)) {
|
|
@@ -77094,7 +78159,7 @@ var init_project_version_static_value_writes = __esm({
|
|
|
77094
78159
|
}
|
|
77095
78160
|
return;
|
|
77096
78161
|
}
|
|
77097
|
-
if (member.kind !== 7 /* Class */ && value.classId !== void 0) {
|
|
78162
|
+
if (member.kind !== 7 /* Class */ && value.classId !== void 0 && value.classId !== null) {
|
|
77098
78163
|
throw new Error(
|
|
77099
78164
|
`${path} value "${value.id}" has classId but the member is not Class.`
|
|
77100
78165
|
);
|
|
@@ -77230,6 +78295,14 @@ var init_project_version_static_value_writes = __esm({
|
|
|
77230
78295
|
}
|
|
77231
78296
|
return;
|
|
77232
78297
|
}
|
|
78298
|
+
if (isMemberActionBase(member)) {
|
|
78299
|
+
if (!isNSActionValue(value.value)) {
|
|
78300
|
+
throw new Error(
|
|
78301
|
+
`${path} must store an NSAction listener set: { listeners: [...] } with a unique (memberId, valueId) identity per entry.`
|
|
78302
|
+
);
|
|
78303
|
+
}
|
|
78304
|
+
return;
|
|
78305
|
+
}
|
|
77233
78306
|
if (isMemberClassBase(member)) {
|
|
77234
78307
|
this.validateClass({ ...args, member, value });
|
|
77235
78308
|
return;
|
|
@@ -80942,8 +82015,8 @@ function stripDialogueNodeDerivedBodies(node) {
|
|
|
80942
82015
|
stripConditionCompanions(next.conditions);
|
|
80943
82016
|
stripTextVariableCompanions(next.variables);
|
|
80944
82017
|
if (Array.isArray(next.actions)) {
|
|
80945
|
-
for (const
|
|
80946
|
-
const action = asRecord(
|
|
82018
|
+
for (const actionValue2 of next.actions) {
|
|
82019
|
+
const action = asRecord(actionValue2);
|
|
80947
82020
|
const logic = asRecord(action?.logic);
|
|
80948
82021
|
if (logic?.type === 1 && typeof logic.code === "string") {
|
|
80949
82022
|
delete logic.action;
|
|
@@ -81796,6 +82869,7 @@ function assertProjectVersionWholeGraphWritesValid(args) {
|
|
|
81796
82869
|
changes: args.changes
|
|
81797
82870
|
});
|
|
81798
82871
|
assertStagedSchemaIdentifiersValid(projected, args.changes);
|
|
82872
|
+
assertStagedActionListenersValid(projected, args.changes);
|
|
81799
82873
|
assertStagedUnitySingletonValid(projected, args.changes);
|
|
81800
82874
|
assertStagedProjectInterfaceValid(projected, args.changes);
|
|
81801
82875
|
assertStagedTileGridReferencesValid(args.document, projected, args.changes);
|
|
@@ -82271,6 +83345,207 @@ function assertStagedSchemaIdentifiersValid(projected, changes) {
|
|
|
82271
83345
|
}
|
|
82272
83346
|
}
|
|
82273
83347
|
}
|
|
83348
|
+
function assertStagedActionListenersValid(projected, changes) {
|
|
83349
|
+
if (!changes.some(
|
|
83350
|
+
(change) => ACTION_LISTENER_TRIGGER_RECORD_KINDS.has(change.recordKind)
|
|
83351
|
+
)) {
|
|
83352
|
+
return;
|
|
83353
|
+
}
|
|
83354
|
+
const actions = projected.members.filter(
|
|
83355
|
+
(member) => member.kind === 26 /* NSAction */
|
|
83356
|
+
);
|
|
83357
|
+
if (actions.length === 0) return;
|
|
83358
|
+
const membersById = new Map(
|
|
83359
|
+
projected.members.map((member) => [member.id, member])
|
|
83360
|
+
);
|
|
83361
|
+
const valueIds = new Set(projected.values.map((value) => value.id));
|
|
83362
|
+
const graded = [];
|
|
83363
|
+
for (const action of actions) {
|
|
83364
|
+
const listeners = authoredActionListeners(action);
|
|
83365
|
+
if (listeners.length === 0) continue;
|
|
83366
|
+
graded.push({
|
|
83367
|
+
listeners,
|
|
83368
|
+
declaration: substituteMemberForListenerGrading(action, projected),
|
|
83369
|
+
label: describeActionMember(action, projected.classes)
|
|
83370
|
+
});
|
|
83371
|
+
}
|
|
83372
|
+
const candidateRowIds = candidateActionListenerRowIds(projected, actions);
|
|
83373
|
+
if (candidateRowIds.size > 0) {
|
|
83374
|
+
const rowsById = new Map(
|
|
83375
|
+
projected.values.map((value) => [value.id, value])
|
|
83376
|
+
);
|
|
83377
|
+
const owners = resolveOwnerMembersForValues(projected, candidateRowIds);
|
|
83378
|
+
for (const [rowId, owner] of owners) {
|
|
83379
|
+
if (owner.kind !== 26 /* NSAction */) continue;
|
|
83380
|
+
const row = rowsById.get(rowId);
|
|
83381
|
+
if (row === void 0) continue;
|
|
83382
|
+
const listeners = storedRowActionListeners(row);
|
|
83383
|
+
if (listeners.length === 0) continue;
|
|
83384
|
+
const ownerId = getMemberId(owner);
|
|
83385
|
+
if (ownerId === null) continue;
|
|
83386
|
+
const action = membersById.get(ownerId);
|
|
83387
|
+
if (action === void 0) continue;
|
|
83388
|
+
graded.push({
|
|
83389
|
+
listeners,
|
|
83390
|
+
declaration: owner,
|
|
83391
|
+
label: `${describeActionMember(action, projected.classes)} row "${rowId}"`
|
|
83392
|
+
});
|
|
83393
|
+
}
|
|
83394
|
+
}
|
|
83395
|
+
for (const entry of graded) {
|
|
83396
|
+
const expected = callableArgumentTypes(entry.declaration);
|
|
83397
|
+
if (expected === null) continue;
|
|
83398
|
+
assertActionListenerSetValid({
|
|
83399
|
+
listeners: entry.listeners,
|
|
83400
|
+
expected,
|
|
83401
|
+
owner: entry.label,
|
|
83402
|
+
projected,
|
|
83403
|
+
membersById,
|
|
83404
|
+
valueIds
|
|
83405
|
+
});
|
|
83406
|
+
}
|
|
83407
|
+
}
|
|
83408
|
+
function candidateActionListenerRowIds(projected, actions) {
|
|
83409
|
+
const actionIds = new Set(actions.map((action) => action.id));
|
|
83410
|
+
const actionSchemaKeys = /* @__PURE__ */ new Set();
|
|
83411
|
+
for (const schemaClass2 of projected.classes) {
|
|
83412
|
+
for (const [schemaKey, memberId] of Object.entries(schemaClass2.schema)) {
|
|
83413
|
+
if (actionIds.has(memberId)) actionSchemaKeys.add(schemaKey);
|
|
83414
|
+
}
|
|
83415
|
+
}
|
|
83416
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
83417
|
+
for (const action of actions) {
|
|
83418
|
+
if (typeof action.valueId === "string") candidates.add(action.valueId);
|
|
83419
|
+
}
|
|
83420
|
+
if (actionSchemaKeys.size === 0) return candidates;
|
|
83421
|
+
for (const row of projected.values) {
|
|
83422
|
+
if (!isPlainRecord4(row.value)) continue;
|
|
83423
|
+
for (const schemaKey of actionSchemaKeys) {
|
|
83424
|
+
const childId = row.value[schemaKey];
|
|
83425
|
+
if (typeof childId === "string") candidates.add(childId);
|
|
83426
|
+
}
|
|
83427
|
+
}
|
|
83428
|
+
return candidates;
|
|
83429
|
+
}
|
|
83430
|
+
function storedRowActionListeners(row) {
|
|
83431
|
+
const body = row.value;
|
|
83432
|
+
if (!isPlainRecord4(body)) return [];
|
|
83433
|
+
const listeners = body.listeners;
|
|
83434
|
+
return Array.isArray(listeners) ? listeners : [];
|
|
83435
|
+
}
|
|
83436
|
+
function getMemberId(member) {
|
|
83437
|
+
const id2 = Reflect.get(member, "id");
|
|
83438
|
+
return typeof id2 === "string" ? id2 : null;
|
|
83439
|
+
}
|
|
83440
|
+
function assertActionListenerSetValid(args) {
|
|
83441
|
+
const { expected, owner, projected, membersById, valueIds } = args;
|
|
83442
|
+
const identities = /* @__PURE__ */ new Map();
|
|
83443
|
+
args.listeners.forEach((listener, index) => {
|
|
83444
|
+
if (!isMemberDelegateTarget(listener)) {
|
|
83445
|
+
throw new Error(
|
|
83446
|
+
`${owner} listener ${index} is not a member target; a listener is always a { memberId, valueId } reference, never a closure.`
|
|
83447
|
+
);
|
|
83448
|
+
}
|
|
83449
|
+
const identity2 = nsActionListenerIdentity(listener);
|
|
83450
|
+
const firstIndex = identities.get(identity2);
|
|
83451
|
+
if (firstIndex !== void 0) {
|
|
83452
|
+
throw new Error(
|
|
83453
|
+
`${owner} listener ${index} repeats the target identity of listener ${firstIndex} (member "${listener.memberId}", value ${listener.valueId ?? "default"}); a listener set holds each target once.`
|
|
83454
|
+
);
|
|
83455
|
+
}
|
|
83456
|
+
identities.set(identity2, index);
|
|
83457
|
+
if (listener.valueId !== null && !valueIds.has(listener.valueId)) {
|
|
83458
|
+
throw new Error(
|
|
83459
|
+
`${owner} listener ${index} names receiver value "${listener.valueId}", which this project version does not contain.`
|
|
83460
|
+
);
|
|
83461
|
+
}
|
|
83462
|
+
const target = membersById.get(listener.memberId);
|
|
83463
|
+
if (target === void 0) {
|
|
83464
|
+
throw new Error(
|
|
83465
|
+
`${owner} listener ${index} names member "${listener.memberId}", which this project version does not contain.`
|
|
83466
|
+
);
|
|
83467
|
+
}
|
|
83468
|
+
if (!ACTION_LISTENER_TARGET_KINDS.has(target.kind)) {
|
|
83469
|
+
throw new Error(
|
|
83470
|
+
`${owner} listener ${index} targets member "${target.name}" (${target.id}), whose kind ${MemberKind[target.kind]} is not callable; a listener must be a Function, NSFunction, NSDelegate, or NSAction member.`
|
|
83471
|
+
);
|
|
83472
|
+
}
|
|
83473
|
+
const signature = listenerTargetSignature(
|
|
83474
|
+
substituteMemberForListenerGrading(target, projected)
|
|
83475
|
+
);
|
|
83476
|
+
if (signature === null) {
|
|
83477
|
+
throw new Error(
|
|
83478
|
+
`${owner} listener ${index} targets member "${target.name}" (${target.id}), whose callable signature could not be resolved.`
|
|
83479
|
+
);
|
|
83480
|
+
}
|
|
83481
|
+
if (signature.deferred) {
|
|
83482
|
+
throw new Error(
|
|
83483
|
+
`${owner} listener ${index} targets deferred member "${target.name}" (${target.id}); listeners are immediate-only.`
|
|
83484
|
+
);
|
|
83485
|
+
}
|
|
83486
|
+
if (!signature.returnsVoid) {
|
|
83487
|
+
throw new Error(
|
|
83488
|
+
`${owner} listener ${index} targets member "${target.name}" (${target.id}), which returns a value; a listener must be void.`
|
|
83489
|
+
);
|
|
83490
|
+
}
|
|
83491
|
+
if (signature.argumentTypes.length !== expected.length) {
|
|
83492
|
+
throw new Error(
|
|
83493
|
+
`${owner} listener ${index} targets member "${target.name}" (${target.id}), which takes ${signature.argumentTypes.length} parameters; the action declares ${expected.length}.`
|
|
83494
|
+
);
|
|
83495
|
+
}
|
|
83496
|
+
expected.forEach((argument2, position) => {
|
|
83497
|
+
const candidate = signature.argumentTypes[position];
|
|
83498
|
+
if (typeInfosInvariantlyEqual(argument2, candidate)) return;
|
|
83499
|
+
throw new Error(
|
|
83500
|
+
`${owner} listener ${index} targets member "${target.name}" (${target.id}), whose parameter ${position + 1} "${candidate.name}" does not match the action's parameter "${argument2.name}" after generic substitution.`
|
|
83501
|
+
);
|
|
83502
|
+
});
|
|
83503
|
+
});
|
|
83504
|
+
}
|
|
83505
|
+
function authoredActionListeners(action) {
|
|
83506
|
+
const defaultValue = action.defaultValue;
|
|
83507
|
+
if (defaultValue === void 0 || defaultValue === null) return [];
|
|
83508
|
+
if (!isLiteralValueContent(defaultValue)) return [];
|
|
83509
|
+
const body = defaultValue.value;
|
|
83510
|
+
if (!isPlainRecord4(body)) return [];
|
|
83511
|
+
const listeners = body.listeners;
|
|
83512
|
+
return Array.isArray(listeners) ? listeners : [];
|
|
83513
|
+
}
|
|
83514
|
+
function substituteMemberForListenerGrading(member, projected) {
|
|
83515
|
+
const env = resolveDeclaringClassGenericEnv(member.id, projected.classes);
|
|
83516
|
+
try {
|
|
83517
|
+
return substituteMember(member, env, projected.members);
|
|
83518
|
+
} catch {
|
|
83519
|
+
return resolveMember2(member, projected.members);
|
|
83520
|
+
}
|
|
83521
|
+
}
|
|
83522
|
+
function listenerTargetSignature(target) {
|
|
83523
|
+
const argumentTypes = callableArgumentTypes(target);
|
|
83524
|
+
if (argumentTypes === null) return null;
|
|
83525
|
+
if (target.kind === 26 /* NSAction */) {
|
|
83526
|
+
return { returnsVoid: true, argumentTypes, deferred: false };
|
|
83527
|
+
}
|
|
83528
|
+
const returnTypeInfo = Reflect.get(target, "returnTypeInfo");
|
|
83529
|
+
if (!isNSFunctionReturnTypeInfo(returnTypeInfo)) return null;
|
|
83530
|
+
return {
|
|
83531
|
+
returnsVoid: returnTypeInfo.type === NS_TYPE_VOID,
|
|
83532
|
+
argumentTypes,
|
|
83533
|
+
deferred: Reflect.get(target, "deferred") === true
|
|
83534
|
+
};
|
|
83535
|
+
}
|
|
83536
|
+
function callableArgumentTypes(member) {
|
|
83537
|
+
const argumentTypes = Reflect.get(member, "argumentTypes");
|
|
83538
|
+
if (!Array.isArray(argumentTypes)) return null;
|
|
83539
|
+
const typed = argumentTypes.filter(isNSFunctionArgumentTypeInfo);
|
|
83540
|
+
return typed.length === argumentTypes.length ? typed : null;
|
|
83541
|
+
}
|
|
83542
|
+
function describeActionMember(action, classes) {
|
|
83543
|
+
const placement = findSchemaPlacement(action.id, classes);
|
|
83544
|
+
if (placement === null) {
|
|
83545
|
+
return `NSAction member "${action.name}" (${action.id})`;
|
|
83546
|
+
}
|
|
83547
|
+
return `NSAction member "${placement.ownerClass.name}.${action.name}" (${action.id})`;
|
|
83548
|
+
}
|
|
82274
83549
|
function assertStagedUnitySingletonValid(projected, changes) {
|
|
82275
83550
|
if (!changes.some(
|
|
82276
83551
|
(change) => change.recordKind === "project" || change.recordKind === "member"
|
|
@@ -82328,7 +83603,7 @@ function assertStagedTileGridReferencesValid(current, projected, changes) {
|
|
|
82328
83603
|
tileGridReferenceDeleteBlockedErrorData(blockers)
|
|
82329
83604
|
);
|
|
82330
83605
|
}
|
|
82331
|
-
var INTERFACE_VALIDATED_RECORD_KINDS;
|
|
83606
|
+
var INTERFACE_VALIDATED_RECORD_KINDS, ACTION_LISTENER_TRIGGER_RECORD_KINDS, ACTION_LISTENER_TARGET_KINDS;
|
|
82332
83607
|
var init_project_version_whole_graph_validation = __esm({
|
|
82333
83608
|
"../src/database/project-version-whole-graph-validation.ts"() {
|
|
82334
83609
|
"use strict";
|
|
@@ -82342,12 +83617,22 @@ var init_project_version_whole_graph_validation = __esm({
|
|
|
82342
83617
|
init_project_version_schema_commit();
|
|
82343
83618
|
init_project_version_system_protection_writes();
|
|
82344
83619
|
init_members();
|
|
83620
|
+
init_generics();
|
|
83621
|
+
init_inheritance();
|
|
83622
|
+
init_neoscript();
|
|
82345
83623
|
init_value_row_owner_members();
|
|
82346
83624
|
init_init_backed_value_materialization();
|
|
82347
83625
|
init_world_system_classes();
|
|
82348
83626
|
init_project_world_reference_graph();
|
|
82349
83627
|
init_project_record_semantics();
|
|
82350
83628
|
INTERFACE_VALIDATED_RECORD_KINDS = /* @__PURE__ */ new Set(["member", "class", "constructor", "interface"]);
|
|
83629
|
+
ACTION_LISTENER_TRIGGER_RECORD_KINDS = /* @__PURE__ */ new Set(["member", "class", "value"]);
|
|
83630
|
+
ACTION_LISTENER_TARGET_KINDS = /* @__PURE__ */ new Set([
|
|
83631
|
+
13 /* Function */,
|
|
83632
|
+
23 /* NSFunction */,
|
|
83633
|
+
25 /* NSDelegate */,
|
|
83634
|
+
26 /* NSAction */
|
|
83635
|
+
]);
|
|
82351
83636
|
}
|
|
82352
83637
|
});
|
|
82353
83638
|
|
|
@@ -85164,6 +86449,7 @@ function buildValueLowerContext(state, manifest, options = {}) {
|
|
|
85164
86449
|
pendingValues: registry.pendingValues,
|
|
85165
86450
|
pendingLocalizedTexts: registry.pendingLocalizedTexts,
|
|
85166
86451
|
loweredMemberIdByValueId: /* @__PURE__ */ new Map(),
|
|
86452
|
+
storedClassSchemaMemberIds: /* @__PURE__ */ new Map(),
|
|
85167
86453
|
pendingBindingMembersByClassId: registry.pendingBindingMembersByClassId,
|
|
85168
86454
|
declaredConstructors: declaredConstructorIndex,
|
|
85169
86455
|
initAuthoredRowIds: seedInitAuthoredRowIds(
|
|
@@ -85387,14 +86673,12 @@ function lowerMemberDefaultSourcesV4(state, analysis, manifest, options = {}) {
|
|
|
85387
86673
|
(row) => !existingPendingValueIds.has(row.id)
|
|
85388
86674
|
);
|
|
85389
86675
|
if (pendingRows.length > 0) {
|
|
85390
|
-
const existingRows =
|
|
85391
|
-
|
|
85392
|
-
|
|
85393
|
-
|
|
85394
|
-
|
|
85395
|
-
|
|
85396
|
-
)
|
|
85397
|
-
);
|
|
86676
|
+
const existingRows = pendingSeedGraphRows({
|
|
86677
|
+
context,
|
|
86678
|
+
reconstructedBefore: existingReconstructedKeys,
|
|
86679
|
+
pendingRows,
|
|
86680
|
+
rootBody: lowered.value
|
|
86681
|
+
});
|
|
85398
86682
|
const bindingMembers = [
|
|
85399
86683
|
...context.pendingBindingMembersByClassId.values()
|
|
85400
86684
|
].filter(
|
|
@@ -85977,21 +87261,49 @@ function lowerRowBackedDefault(context, member, backed, baseData3, binding) {
|
|
|
85977
87261
|
`Default value ${binding.label}.${assignment.name} is constructor-projected and must be set through its named constructor argument.`
|
|
85978
87262
|
);
|
|
85979
87263
|
}
|
|
87264
|
+
const childValueMember = recursivePartialMember(member, childMember);
|
|
87265
|
+
const childSlice = assignmentSlices.get(assignment.name);
|
|
85980
87266
|
const existingId = isObjectRecord2(baseBody) ? baseBody[assignment.name] : void 0;
|
|
85981
|
-
const
|
|
85982
|
-
|
|
87267
|
+
const annotatedId = annotatedValue(assignment.value).id;
|
|
87268
|
+
const storedId = typeof existingId === "string" ? existingId : annotatedId;
|
|
87269
|
+
if (storedId !== null && storedId !== void 0) {
|
|
87270
|
+
if (typeof existingId === "string" || context.state[`value:${storedId}`] !== void 0) {
|
|
87271
|
+
body[assignment.name] = lowerValueRow(
|
|
87272
|
+
context,
|
|
87273
|
+
childValueMember,
|
|
87274
|
+
assignment.value,
|
|
87275
|
+
storedId,
|
|
87276
|
+
binding,
|
|
87277
|
+
environment,
|
|
87278
|
+
childSlice
|
|
87279
|
+
);
|
|
87280
|
+
continue;
|
|
87281
|
+
}
|
|
87282
|
+
if (!isPendingId(storedId) && !isUuidV4Id(storedId)) {
|
|
87283
|
+
context.loweringFailures.push({
|
|
87284
|
+
message: `Default value ${binding.label}.${assignment.name} is annotated @id("${storedId}"), which names no existing row, and a new row's durable identity must be a UUID v4. Fix the id if it meant an existing row, or drop the @id to mint a fresh identity.`,
|
|
87285
|
+
site: referenceSite(binding, assignment.value)
|
|
87286
|
+
});
|
|
87287
|
+
}
|
|
87288
|
+
}
|
|
87289
|
+
const placedId = sourceValueSymbol(context, assignment.value);
|
|
87290
|
+
if (placedId !== null) {
|
|
85983
87291
|
throw new Error(
|
|
85984
|
-
`Default value ${binding.label}.${assignment.name}
|
|
87292
|
+
`Default value ${binding.label}.${assignment.name} cannot place existing value ${placedId} into a new structural slot. Create the nested value inline so the atomic construction transaction can own it.`
|
|
85985
87293
|
);
|
|
85986
87294
|
}
|
|
85987
|
-
body[assignment.name] =
|
|
87295
|
+
body[assignment.name] = lowerSeedChild(
|
|
85988
87296
|
context,
|
|
85989
|
-
|
|
87297
|
+
childValueMember,
|
|
85990
87298
|
assignment.value,
|
|
85991
|
-
childId,
|
|
85992
87299
|
binding,
|
|
87300
|
+
`${binding.label}.${assignment.name}`,
|
|
87301
|
+
/* @__PURE__ */ new Map(),
|
|
87302
|
+
/* @__PURE__ */ new Map(),
|
|
87303
|
+
void 0,
|
|
85993
87304
|
environment,
|
|
85994
|
-
|
|
87305
|
+
void 0,
|
|
87306
|
+
childSlice
|
|
85995
87307
|
);
|
|
85996
87308
|
}
|
|
85997
87309
|
return {
|
|
@@ -86132,14 +87444,13 @@ function lowerStoredBinding(context, binding, memberValueIds, seeds) {
|
|
|
86132
87444
|
);
|
|
86133
87445
|
if (pendingRows.length > 0) {
|
|
86134
87446
|
const root = reconstructedOrStateValue(context, valueId);
|
|
86135
|
-
const existingRows =
|
|
86136
|
-
|
|
86137
|
-
|
|
86138
|
-
|
|
86139
|
-
|
|
86140
|
-
|
|
86141
|
-
|
|
86142
|
-
);
|
|
87447
|
+
const existingRows = pendingSeedGraphRows({
|
|
87448
|
+
context,
|
|
87449
|
+
reconstructedBefore: existingReconstructedKeys,
|
|
87450
|
+
pendingRows,
|
|
87451
|
+
rootBody: root.value,
|
|
87452
|
+
rootValueId: valueId
|
|
87453
|
+
});
|
|
86143
87454
|
const bindingMembers = [
|
|
86144
87455
|
...context.pendingBindingMembersByClassId.values()
|
|
86145
87456
|
].filter((pending) => !existingPendingBindingMemberIds.has(pending.id));
|
|
@@ -86174,6 +87485,105 @@ function memberValueId(memberId) {
|
|
|
86174
87485
|
function reconstructedOrStateValue(context, valueId) {
|
|
86175
87486
|
return context.reconstructed.get(`value:${valueId}`)?.fileFields ?? valueBase(context, valueId);
|
|
86176
87487
|
}
|
|
87488
|
+
function pendingSeedGraphRows(args) {
|
|
87489
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
87490
|
+
for (const [key, record3] of args.context.reconstructed) {
|
|
87491
|
+
if (args.reconstructedBefore.has(key)) continue;
|
|
87492
|
+
if (record3.recordKind !== "value") continue;
|
|
87493
|
+
if (record3.recordId === args.rootValueId) continue;
|
|
87494
|
+
candidates.set(record3.recordId, record3.fileFields);
|
|
87495
|
+
}
|
|
87496
|
+
const pendingIds = new Set(args.pendingRows.map((row) => row.id));
|
|
87497
|
+
const bodies = /* @__PURE__ */ new Map();
|
|
87498
|
+
for (const [id2, fields] of candidates) bodies.set(id2, fields.value);
|
|
87499
|
+
for (const row of args.pendingRows) bodies.set(row.id, row.value);
|
|
87500
|
+
const containedIds = /* @__PURE__ */ new Map();
|
|
87501
|
+
const addContained = (containerId, id2) => {
|
|
87502
|
+
if (typeof containerId !== "string") return;
|
|
87503
|
+
const siblings = containedIds.get(containerId);
|
|
87504
|
+
if (siblings === void 0) containedIds.set(containerId, [id2]);
|
|
87505
|
+
else siblings.push(id2);
|
|
87506
|
+
};
|
|
87507
|
+
for (const [id2, fields] of candidates) addContained(fields.containerId, id2);
|
|
87508
|
+
for (const row of args.pendingRows) addContained(row.containerId, row.id);
|
|
87509
|
+
const collectReferenced = (body, into) => {
|
|
87510
|
+
if (typeof body === "string") {
|
|
87511
|
+
if (bodies.has(body)) into.add(body);
|
|
87512
|
+
return;
|
|
87513
|
+
}
|
|
87514
|
+
if (Array.isArray(body)) {
|
|
87515
|
+
for (const entry of body) collectReferenced(entry, into);
|
|
87516
|
+
return;
|
|
87517
|
+
}
|
|
87518
|
+
if (!isObjectRecord2(body)) return;
|
|
87519
|
+
for (const entry of Object.values(body)) collectReferenced(entry, into);
|
|
87520
|
+
};
|
|
87521
|
+
const childIds = (id2) => {
|
|
87522
|
+
const children = new Set(containedIds.get(id2) ?? []);
|
|
87523
|
+
collectReferenced(bodies.get(id2), children);
|
|
87524
|
+
children.delete(id2);
|
|
87525
|
+
return children;
|
|
87526
|
+
};
|
|
87527
|
+
const reachesPending = /* @__PURE__ */ new Map();
|
|
87528
|
+
const visit = (id2) => {
|
|
87529
|
+
const settled = reachesPending.get(id2);
|
|
87530
|
+
if (settled !== void 0) return settled;
|
|
87531
|
+
reachesPending.set(id2, false);
|
|
87532
|
+
let reaches = pendingIds.has(id2);
|
|
87533
|
+
for (const childId of childIds(id2)) {
|
|
87534
|
+
if (visit(childId)) reaches = true;
|
|
87535
|
+
}
|
|
87536
|
+
reachesPending.set(id2, reaches);
|
|
87537
|
+
return reaches;
|
|
87538
|
+
};
|
|
87539
|
+
const roots = new Set(
|
|
87540
|
+
args.rootValueId === void 0 ? [] : containedIds.get(args.rootValueId) ?? []
|
|
87541
|
+
);
|
|
87542
|
+
collectReferenced(args.rootBody, roots);
|
|
87543
|
+
for (const id2 of roots) visit(id2);
|
|
87544
|
+
const rows = [];
|
|
87545
|
+
for (const [id2, fields] of candidates) {
|
|
87546
|
+
if (reachesPending.get(id2) !== true) continue;
|
|
87547
|
+
rows.push(
|
|
87548
|
+
staticValueSeedRow(fields, args.context.loweredMemberIdByValueId.get(id2))
|
|
87549
|
+
);
|
|
87550
|
+
}
|
|
87551
|
+
return rows;
|
|
87552
|
+
}
|
|
87553
|
+
function retainedStoredClassBody(context, storedClassId, baseBody) {
|
|
87554
|
+
const storedMemberIds = storedClassSchemaMemberIds(context, storedClassId);
|
|
87555
|
+
const body = {};
|
|
87556
|
+
for (const [key, childId] of Object.entries(baseBody)) {
|
|
87557
|
+
const storedMemberId = storedMemberIds.get(key);
|
|
87558
|
+
if (storedMemberId !== void 0 && !context.members.has(storedMemberId)) {
|
|
87559
|
+
continue;
|
|
87560
|
+
}
|
|
87561
|
+
body[key] = childId;
|
|
87562
|
+
}
|
|
87563
|
+
return body;
|
|
87564
|
+
}
|
|
87565
|
+
function storedClassSchemaMemberIds(context, classId) {
|
|
87566
|
+
const cached = context.storedClassSchemaMemberIds.get(classId);
|
|
87567
|
+
if (cached !== void 0) return cached;
|
|
87568
|
+
const memberIds = /* @__PURE__ */ new Map();
|
|
87569
|
+
let current = classId;
|
|
87570
|
+
const visited = /* @__PURE__ */ new Set();
|
|
87571
|
+
while (current !== null && !visited.has(current)) {
|
|
87572
|
+
visited.add(current);
|
|
87573
|
+
const data = stateData(context, "class", current);
|
|
87574
|
+
if (data === null) break;
|
|
87575
|
+
if (isObjectRecord2(data.schema)) {
|
|
87576
|
+
for (const [key, memberId] of Object.entries(data.schema)) {
|
|
87577
|
+
if (typeof memberId === "string" && !memberIds.has(key)) {
|
|
87578
|
+
memberIds.set(key, memberId);
|
|
87579
|
+
}
|
|
87580
|
+
}
|
|
87581
|
+
}
|
|
87582
|
+
current = stringOrNull(data.extendsClassId);
|
|
87583
|
+
}
|
|
87584
|
+
context.storedClassSchemaMemberIds.set(classId, memberIds);
|
|
87585
|
+
return memberIds;
|
|
87586
|
+
}
|
|
86177
87587
|
function staticValueSeedRow(value, loweredMemberId) {
|
|
86178
87588
|
const id2 = stringOrNull(value.id);
|
|
86179
87589
|
if (id2 === null) throw new Error("Authored value row is missing id.");
|
|
@@ -86258,7 +87668,7 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
|
|
|
86258
87668
|
member,
|
|
86259
87669
|
inheritedEnvironment
|
|
86260
87670
|
);
|
|
86261
|
-
if (resolvedMember.kind
|
|
87671
|
+
if (!isStoredCallableLiteral(resolvedMember.kind, expression) && initializerRequiresEvaluation(
|
|
86262
87672
|
context.declaredConstructors,
|
|
86263
87673
|
expression,
|
|
86264
87674
|
memberClassName(context, resolvedMember),
|
|
@@ -86694,7 +88104,7 @@ function lowerValueRow(context, member, sourceExpression, expectedValueId, sourc
|
|
|
86694
88104
|
member,
|
|
86695
88105
|
environment
|
|
86696
88106
|
);
|
|
86697
|
-
if (resolvedMember.kind
|
|
88107
|
+
if (!isStoredCallableLiteral(resolvedMember.kind, expression) && initializerRequiresEvaluation(
|
|
86698
88108
|
context.declaredConstructors,
|
|
86699
88109
|
expression,
|
|
86700
88110
|
memberClassName(context, resolvedMember),
|
|
@@ -86848,6 +88258,11 @@ function lowerValueBody(context, member, expression, base, source, environment,
|
|
|
86848
88258
|
authoredSlice
|
|
86849
88259
|
)
|
|
86850
88260
|
};
|
|
88261
|
+
case "action":
|
|
88262
|
+
return {
|
|
88263
|
+
...next,
|
|
88264
|
+
value: lowerActionValue(context, expression, source.ownerClassId)
|
|
88265
|
+
};
|
|
86851
88266
|
case "class":
|
|
86852
88267
|
return lowerClassValue(
|
|
86853
88268
|
context,
|
|
@@ -86920,7 +88335,11 @@ function lowerClassValue(context, member, expression, base, source, outerEnviron
|
|
|
86920
88335
|
String(base.id ?? member.name)
|
|
86921
88336
|
);
|
|
86922
88337
|
const baseBody = isObjectRecord2(base.value) ? base.value : {};
|
|
86923
|
-
const body =
|
|
88338
|
+
const body = retainedStoredClassBody(
|
|
88339
|
+
context,
|
|
88340
|
+
currentClassId,
|
|
88341
|
+
baseBody
|
|
88342
|
+
);
|
|
86924
88343
|
const assignmentSlices = objectInitializerSlices(authoredSlice);
|
|
86925
88344
|
if (materializedConstruction !== "preserve") {
|
|
86926
88345
|
lowerConstructorProjections(
|
|
@@ -88628,6 +90047,65 @@ function lowerFunctionReference(context, expression, ownerClassId) {
|
|
|
88628
90047
|
}
|
|
88629
90048
|
return { functionMemberId: target.id };
|
|
88630
90049
|
}
|
|
90050
|
+
function isStoredCallableLiteral(kind, expression) {
|
|
90051
|
+
if (kind === "delegate") return true;
|
|
90052
|
+
if (kind !== "action") return false;
|
|
90053
|
+
return expression.kind === "litList";
|
|
90054
|
+
}
|
|
90055
|
+
function lowerActionValue(context, expression, ownerClassId) {
|
|
90056
|
+
const elements = expression.kind === "litList" ? expression.elements : [expression];
|
|
90057
|
+
const listeners = [];
|
|
90058
|
+
const identities = /* @__PURE__ */ new Set();
|
|
90059
|
+
elements.forEach((element, index) => {
|
|
90060
|
+
const listener = lowerActionListener(context, element, ownerClassId, index);
|
|
90061
|
+
if (identities.has(listener.memberId)) {
|
|
90062
|
+
throw new Error(
|
|
90063
|
+
`NeoAction listener ${index} repeats an earlier listener; a listener set holds each target once.`
|
|
90064
|
+
);
|
|
90065
|
+
}
|
|
90066
|
+
identities.add(listener.memberId);
|
|
90067
|
+
listeners.push(listener);
|
|
90068
|
+
});
|
|
90069
|
+
return { listeners };
|
|
90070
|
+
}
|
|
90071
|
+
function lowerActionListener(context, element, ownerClassId, index) {
|
|
90072
|
+
const { expression } = annotatedValue(element);
|
|
90073
|
+
if (expression.kind === "lambda") {
|
|
90074
|
+
throw new Error(
|
|
90075
|
+
`NeoAction listener ${index} is a lambda. A listener must be a member reference: extract the body to an NSFunction member and subscribe that member instead.`
|
|
90076
|
+
);
|
|
90077
|
+
}
|
|
90078
|
+
const path = memberPath(expression);
|
|
90079
|
+
const symbol = path?.startsWith("this.") ? path.slice("this.".length) : path;
|
|
90080
|
+
if (symbol === null || symbol === void 0 || symbol.includes(".")) {
|
|
90081
|
+
throw new Error(
|
|
90082
|
+
`NeoAction listener ${index} must name a function, NSFunction, NSDelegate, or NeoAction member on the current Class.`
|
|
90083
|
+
);
|
|
90084
|
+
}
|
|
90085
|
+
if (ownerClassId === void 0) {
|
|
90086
|
+
throw new Error(
|
|
90087
|
+
`NeoAction listener ${symbol} cannot be resolved without its owning Class.`
|
|
90088
|
+
);
|
|
90089
|
+
}
|
|
90090
|
+
const target = classMemberByName(context, ownerClassId, symbol);
|
|
90091
|
+
if (target.kind === "action") return { memberId: target.id, valueId: null };
|
|
90092
|
+
if (target.kind !== "function" && target.kind !== "scriptFunction" && target.kind !== "delegate") {
|
|
90093
|
+
throw new Error(
|
|
90094
|
+
`NeoAction listener ${symbol} does not resolve to a function, NSFunction, NSDelegate, or NeoAction member.`
|
|
90095
|
+
);
|
|
90096
|
+
}
|
|
90097
|
+
if (target.returnType.kind !== "void") {
|
|
90098
|
+
throw new Error(
|
|
90099
|
+
`NeoAction listener ${symbol} returns a value; a listener must be void.`
|
|
90100
|
+
);
|
|
90101
|
+
}
|
|
90102
|
+
if (target.kind !== "delegate" && target.deferred) {
|
|
90103
|
+
throw new Error(
|
|
90104
|
+
`NeoAction listener ${symbol} is deferred; listeners are immediate-only.`
|
|
90105
|
+
);
|
|
90106
|
+
}
|
|
90107
|
+
return { memberId: target.id, valueId: null };
|
|
90108
|
+
}
|
|
88631
90109
|
function lowerDelegateValue(context, expression, ownerClassId, authoredSlice) {
|
|
88632
90110
|
if (expression.kind === "lambda") {
|
|
88633
90111
|
const code = initializerExpressionSlice(authoredSlice);
|
|
@@ -88838,6 +90316,7 @@ function emitValueBody(context, member, value, visited, targetTyped, environment
|
|
|
88838
90316
|
if (kind === 18) return referenceValue(context, member, body, true);
|
|
88839
90317
|
if (kind === 24) return functionReferenceValue(context, body);
|
|
88840
90318
|
if (kind === 25) return delegateValue(context, body);
|
|
90319
|
+
if (kind === 26) return actionValue(context, body);
|
|
88841
90320
|
if (kind === 12) {
|
|
88842
90321
|
return fileValue(
|
|
88843
90322
|
context,
|
|
@@ -89209,6 +90688,8 @@ function storedConstructorArgumentSource(context, type, value, environment, visi
|
|
|
89209
90688
|
);
|
|
89210
90689
|
case "delegate":
|
|
89211
90690
|
return delegateValue(context, value);
|
|
90691
|
+
case "action":
|
|
90692
|
+
return actionValue(context, value);
|
|
89212
90693
|
case "class": {
|
|
89213
90694
|
if (typeof value !== "string") {
|
|
89214
90695
|
throw new Error(
|
|
@@ -89417,6 +90898,12 @@ function schemaTypeForBindingMember(context, memberId, environment, visited = /*
|
|
|
89417
90898
|
returnType: member.returnType,
|
|
89418
90899
|
argumentTypes: member.arguments.map((argument2) => argument2.type)
|
|
89419
90900
|
};
|
|
90901
|
+
case "action":
|
|
90902
|
+
return {
|
|
90903
|
+
kind: "action",
|
|
90904
|
+
nullable: false,
|
|
90905
|
+
argumentTypes: member.arguments.map((argument2) => argument2.type)
|
|
90906
|
+
};
|
|
89420
90907
|
case "generic":
|
|
89421
90908
|
return schemaTypeForBindingMember(
|
|
89422
90909
|
context,
|
|
@@ -89524,6 +91011,8 @@ function storedSchemaTypeName(context, type, environment, valueId) {
|
|
|
89524
91011
|
return "Dialogue";
|
|
89525
91012
|
case "delegate":
|
|
89526
91013
|
return "object";
|
|
91014
|
+
case "action":
|
|
91015
|
+
return "object";
|
|
89527
91016
|
case "null":
|
|
89528
91017
|
return "null";
|
|
89529
91018
|
}
|
|
@@ -90139,6 +91628,45 @@ function delegateValue(context, body) {
|
|
|
90139
91628
|
}
|
|
90140
91629
|
return target.name;
|
|
90141
91630
|
}
|
|
91631
|
+
function actionValue(context, body) {
|
|
91632
|
+
if (!isObjectRecord2(body)) {
|
|
91633
|
+
throw new Error("NSAction value is not a listener set.");
|
|
91634
|
+
}
|
|
91635
|
+
if (!Array.isArray(body.listeners)) {
|
|
91636
|
+
throw new Error("NSAction value is missing its listeners array.");
|
|
91637
|
+
}
|
|
91638
|
+
const names = body.listeners.map(
|
|
91639
|
+
(listener, index) => actionListenerName(context, listener, index)
|
|
91640
|
+
);
|
|
91641
|
+
return `[${names.join(", ")}]`;
|
|
91642
|
+
}
|
|
91643
|
+
function actionListenerName(context, listener, index) {
|
|
91644
|
+
if (!isObjectRecord2(listener)) {
|
|
91645
|
+
throw new Error(`NSAction listener ${index} is not a member target.`);
|
|
91646
|
+
}
|
|
91647
|
+
if (typeof listener.code === "string") {
|
|
91648
|
+
throw new Error(
|
|
91649
|
+
`NSAction listener ${index} stores a closure; only member targets are listeners.`
|
|
91650
|
+
);
|
|
91651
|
+
}
|
|
91652
|
+
if (typeof listener.memberId !== "string") {
|
|
91653
|
+
throw new Error(`NSAction listener ${index} is missing memberId.`);
|
|
91654
|
+
}
|
|
91655
|
+
if (listener.valueId !== null && listener.valueId !== void 0) {
|
|
91656
|
+
throw new Error(
|
|
91657
|
+
`NSAction listener ${index} is instance-bound and cannot be represented by current project source.`
|
|
91658
|
+
);
|
|
91659
|
+
}
|
|
91660
|
+
const target = context.members.get(listener.memberId);
|
|
91661
|
+
if (target === void 0 || typeof target.name !== "string") {
|
|
91662
|
+
throw new Error(`NSAction listener ${listener.memberId} was not pulled.`);
|
|
91663
|
+
}
|
|
91664
|
+
const kind = numberField(target, "kind");
|
|
91665
|
+
if (kind !== 13 && kind !== 23 && kind !== 25 && kind !== 26) {
|
|
91666
|
+
throw new Error(`NSAction listener ${listener.memberId} is not callable.`);
|
|
91667
|
+
}
|
|
91668
|
+
return target.name;
|
|
91669
|
+
}
|
|
90142
91670
|
function fileValue(context, kind, label, body, required2) {
|
|
90143
91671
|
if (body === null || body === void 0) {
|
|
90144
91672
|
if (required2) {
|
|
@@ -95572,7 +97100,7 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
|
|
|
95572
97100
|
);
|
|
95573
97101
|
assertMigrationCheckWorkspaceIsValid(status);
|
|
95574
97102
|
const candidate = localMigrationCheckCandidate(status);
|
|
95575
|
-
const compileAction = dependencies.compileAction ??
|
|
97103
|
+
const compileAction = dependencies.compileAction ?? compileNSVoidBody;
|
|
95576
97104
|
const bodySourceLocator = createNeoScriptBodySourceLocator(
|
|
95577
97105
|
workspace,
|
|
95578
97106
|
status
|
|
@@ -95983,7 +97511,7 @@ async function runPendingMigrations(workspace, client, raw, migrations, onlyRef,
|
|
|
95983
97511
|
const pinned = migration.action;
|
|
95984
97512
|
const migrationCode = migration.code;
|
|
95985
97513
|
const compiled = pinned !== void 0 && pinned !== null ? pinned : compileNeoScriptBodyOrThrow(
|
|
95986
|
-
() =>
|
|
97514
|
+
() => compileNSVoidBody(migrationCode, {
|
|
95987
97515
|
project: document.project,
|
|
95988
97516
|
members: document.members,
|
|
95989
97517
|
classes: document.classes,
|
|
@@ -96008,7 +97536,7 @@ async function runPendingMigrations(workspace, client, raw, migrations, onlyRef,
|
|
|
96008
97536
|
for (const instance of instances) {
|
|
96009
97537
|
let result;
|
|
96010
97538
|
try {
|
|
96011
|
-
result =
|
|
97539
|
+
result = evaluateNSVoidBody(
|
|
96012
97540
|
compiled,
|
|
96013
97541
|
{
|
|
96014
97542
|
vm: {
|
|
@@ -97281,7 +98809,7 @@ async function runScript(workspace, command, options, dependencies = {}) {
|
|
|
97281
98809
|
);
|
|
97282
98810
|
} else if (command === "apply" || options.mode === "action") {
|
|
97283
98811
|
compiled = compileNeoScriptBodyOrThrow(
|
|
97284
|
-
() =>
|
|
98812
|
+
() => compileNSVoidBody(source, compileContext),
|
|
97285
98813
|
bodySite("action"),
|
|
97286
98814
|
null
|
|
97287
98815
|
);
|
|
@@ -97445,7 +98973,10 @@ ${JSON.stringify(report2, null, 2)}`
|
|
|
97445
98973
|
);
|
|
97446
98974
|
return;
|
|
97447
98975
|
}
|
|
97448
|
-
const result =
|
|
98976
|
+
const result = evaluateNSVoidBody(
|
|
98977
|
+
compiled,
|
|
98978
|
+
evaluatorContext2
|
|
98979
|
+
);
|
|
97449
98980
|
const report = {
|
|
97450
98981
|
ok: true,
|
|
97451
98982
|
writes: result.writes,
|
|
@@ -97695,12 +99226,12 @@ function buildStoredNeoScriptChecks(document) {
|
|
|
97695
99226
|
}
|
|
97696
99227
|
if (node.type === 2 /* Actions */) {
|
|
97697
99228
|
if (!Array.isArray(node.actions)) continue;
|
|
97698
|
-
node.actions.forEach((
|
|
97699
|
-
if (!isObjectRecord2(
|
|
97700
|
-
if (
|
|
97701
|
-
const logic = isObjectRecord2(
|
|
99229
|
+
node.actions.forEach((actionValue2, actionIndex) => {
|
|
99230
|
+
if (!isObjectRecord2(actionValue2)) return;
|
|
99231
|
+
if (actionValue2.type !== 0 /* EditMember */) return;
|
|
99232
|
+
const logic = isObjectRecord2(actionValue2.logic) ? actionValue2.logic : null;
|
|
97702
99233
|
if (logic?.type !== 1 /* Code */) return;
|
|
97703
|
-
const actionId = stableRecordId(
|
|
99234
|
+
const actionId = stableRecordId(actionValue2, `action-${actionIndex}`);
|
|
97704
99235
|
checks.push({
|
|
97705
99236
|
recordKind: "dialogue-node",
|
|
97706
99237
|
id: nodeId,
|
|
@@ -99567,7 +101098,9 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
|
|
|
99567
101098
|
changes: status.changes,
|
|
99568
101099
|
binaryChanges: status.binaryChanges ?? []
|
|
99569
101100
|
});
|
|
99570
|
-
if (status.changes.length === 0
|
|
101101
|
+
if (status.changes.length === 0 && status.authoredValueSeeds.size === 0) {
|
|
101102
|
+
return status;
|
|
101103
|
+
}
|
|
99571
101104
|
const initConversions = status.initConversions ?? [];
|
|
99572
101105
|
if (initConversions.length > 0 && options.json !== true) {
|
|
99573
101106
|
for (const line of describeInitConversions(initConversions)) warn(line);
|
|
@@ -99672,7 +101205,7 @@ async function runPush(workspace, options, preparationOverride) {
|
|
|
99672
101205
|
const status = candidate.status;
|
|
99673
101206
|
const local = candidate.preparedLocal;
|
|
99674
101207
|
preparation?.stop();
|
|
99675
|
-
if (status.changes.length === 0) {
|
|
101208
|
+
if (status.changes.length === 0 && status.authoredValueSeeds.size === 0) {
|
|
99676
101209
|
if (options.json === true) {
|
|
99677
101210
|
console.log(
|
|
99678
101211
|
JSON.stringify({
|
|
@@ -100188,7 +101721,7 @@ async function prepareLocalCandidateV4(workspace, options = {}) {
|
|
|
100188
101721
|
let sourceHash;
|
|
100189
101722
|
let preparedLocal = null;
|
|
100190
101723
|
let documentStatus = status;
|
|
100191
|
-
if (status.changes.length > 0) {
|
|
101724
|
+
if (status.changes.length > 0 || status.authoredValueSeeds.size > 0) {
|
|
100192
101725
|
try {
|
|
100193
101726
|
documentStatus = pushOptions.dryRun ? cloneStatusForDryRun(status) : status;
|
|
100194
101727
|
preparedLocal = await prepareLocalPushArtifactsV4(
|
|
@@ -101616,7 +103149,7 @@ function compileMigrationAction(schema, migrationData, locator) {
|
|
|
101616
103149
|
) ?? null : null;
|
|
101617
103150
|
const code = String(migrationData.code);
|
|
101618
103151
|
return compileNeoScriptBodyOrThrow(
|
|
101619
|
-
() =>
|
|
103152
|
+
() => compileNSVoidBody2(code, {
|
|
101620
103153
|
project: schema.project,
|
|
101621
103154
|
members: schema.members,
|
|
101622
103155
|
classes: schema.classes,
|
|
@@ -101637,7 +103170,7 @@ function compileMigrationAction(schema, migrationData, locator) {
|
|
|
101637
103170
|
locator
|
|
101638
103171
|
);
|
|
101639
103172
|
}
|
|
101640
|
-
var
|
|
103173
|
+
var compileNSVoidBody2, compileNSFunction2, compileNSGetter2, compileNSSetter2, ProjectTransactionInterruptedError, ProjectTransactionFailedError, PROJECT_TRANSACTION_POLL_DELAYS_MS, LocalCandidateArtifactError, SERVER_MINTED_PUSH_RECORD_KINDS;
|
|
101641
103174
|
var init_push = __esm({
|
|
101642
103175
|
"src/commands/push.ts"() {
|
|
101643
103176
|
"use strict";
|
|
@@ -101673,7 +103206,12 @@ var init_push = __esm({
|
|
|
101673
103206
|
init_merge();
|
|
101674
103207
|
init_push_change_intent();
|
|
101675
103208
|
init_push_body_diagnostics();
|
|
101676
|
-
({
|
|
103209
|
+
({
|
|
103210
|
+
compileNSVoidBody: compileNSVoidBody2,
|
|
103211
|
+
compileNSFunction: compileNSFunction2,
|
|
103212
|
+
compileNSGetter: compileNSGetter2,
|
|
103213
|
+
compileNSSetter: compileNSSetter2
|
|
103214
|
+
} = compiler_adapter_exports);
|
|
101677
103215
|
ProjectTransactionInterruptedError = class extends Error {
|
|
101678
103216
|
constructor(transactionId) {
|
|
101679
103217
|
super(
|
|
@@ -101724,7 +103262,7 @@ var init_registry2 = __esm({
|
|
|
101724
103262
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
101725
103263
|
formatVersion: 3,
|
|
101726
103264
|
contractVersion: "3.9",
|
|
101727
|
-
cliVersion: "0.
|
|
103265
|
+
cliVersion: "0.25.1",
|
|
101728
103266
|
projectFileUploadBatchSize: 32,
|
|
101729
103267
|
documentRecords: {
|
|
101730
103268
|
member: {
|
|
@@ -103179,7 +104717,11 @@ function preparedHookCandidate(workspace) {
|
|
|
103179
104717
|
}
|
|
103180
104718
|
try {
|
|
103181
104719
|
const directory = realpathSync(configuredDirectory);
|
|
103182
|
-
const cacheRoot = resolve4(
|
|
104720
|
+
const cacheRoot = resolve4(
|
|
104721
|
+
realpathSync(workspace.root),
|
|
104722
|
+
".neo",
|
|
104723
|
+
"test-build"
|
|
104724
|
+
);
|
|
103183
104725
|
const pathFromRoot = relative6(cacheRoot, directory);
|
|
103184
104726
|
if (isAbsolute2(pathFromRoot)) {
|
|
103185
104727
|
throw new NeoTestPreparedCandidateError(
|
|
@@ -105792,7 +107334,7 @@ function runActions(node, label, subject, world, report, violate) {
|
|
|
105792
107334
|
const ctx = evaluatorContext(subject, world);
|
|
105793
107335
|
let result;
|
|
105794
107336
|
try {
|
|
105795
|
-
result =
|
|
107337
|
+
result = evaluateNSVoidBody(compiled, ctx);
|
|
105796
107338
|
} catch (error) {
|
|
105797
107339
|
if (error instanceof NativeFunctionDelegateUnavailableError) {
|
|
105798
107340
|
const message = error.message;
|
|
@@ -108415,7 +109957,12 @@ async function main() {
|
|
|
108415
109957
|
`${paintChangeKind(binary.action === "create" ? "create" : "update")} project-file bytes ${binary.symbol} (${binary.path}) \u2014 ${binary.action}`
|
|
108416
109958
|
);
|
|
108417
109959
|
}
|
|
108418
|
-
if (status.
|
|
109960
|
+
if (status.authoredValueSeeds.size > 0) {
|
|
109961
|
+
console.log(
|
|
109962
|
+
` ${paintChangeKind("create")} ${status.authoredValueSeeds.size} member value seed(s)`
|
|
109963
|
+
);
|
|
109964
|
+
}
|
|
109965
|
+
if (status.conflictedFiles.length === 0 && status.parseErrors.length === 0 && status.changes.length === 0 && status.authoredValueSeeds.size === 0 && (status.binaryChanges?.length ?? 0) === 0) {
|
|
108419
109966
|
console.log(`${sym.ok} Working copy is clean.`);
|
|
108420
109967
|
}
|
|
108421
109968
|
return;
|