Fixed #382 dice roll functions not working

This commit is contained in:
ThaumRystra
2024-12-01 22:02:47 +02:00
parent 0e56421c3a
commit 75fe3e8fe2
6 changed files with 62 additions and 11 deletions

View File

@@ -172,16 +172,17 @@ const call: CallFactory = {
expectedType = argumentsExpected[index];
}
if (expectedType === 'parseNode') return;
failed = !(
const argFailed = !(
node.parseType === expectedType
|| (node.parseType === 'constant' && node.valueType === expectedType)
);
if (failed && fn === 'reduce') {
if (argFailed && fn === 'reduce') {
const typeName = typeof expectedType === 'string' ? expectedType : expectedType.constructor.name;
const nodeName = node.parseType === 'constant' ? node.valueType : node.parseType;
context.error(`Incorrect arguments to ${callNode.functionName} function` +
`expected ${typeName} got ${nodeName}`);
}
failed = failed || argFailed;
});
return failed;
}