Skip to content

Commit dfb2a08

Browse files
committed
re-add parsing as expression list for func params
1 parent 14de271 commit dfb2a08

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/main/java/ch/njol/skript/lang/SkriptParser.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,20 @@ private SkriptParser suppressMissingAndOrWarnings() {
11261126
FunctionReference<T> functionReference = new FunctionReference<>(functionName, SkriptLogger.getNode(),
11271127
currentScript != null ? currentScript.getConfig().getFileName() : null, types, params);
11281128

1129+
attempt_list_parse:
1130+
if (unaryArgument.get() && !functionReference.validateParameterArity(true)) {
1131+
try (ParseLogHandler ignored = SkriptLogger.startParseLogHandler()) {
1132+
SkriptParser alternative = new SkriptParser(args, flags | PARSE_LITERALS, context);
1133+
params = this.getFunctionArguments(() -> alternative.suppressMissingAndOrWarnings()
1134+
.parseExpressionList(ignored, Object.class), args, unaryArgument);
1135+
ignored.clear();
1136+
if (params == null)
1137+
break attempt_list_parse;
1138+
}
1139+
functionReference = new FunctionReference<>(functionName, SkriptLogger.getNode(),
1140+
currentScript != null ? currentScript.getConfig().getFileName() : null, types, params);
1141+
}
1142+
11291143
if (!functionReference.validateFunction(true)) {
11301144
log.printError();
11311145
return null;

src/test/skript/tests/syntaxes/structures/StructFunction.sk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ test "function structure type hints":
4545
set {_number} to true
4646
parse:
4747
type_hint_argument_test({_number})
48-
assert the first element of the last parse logs contains "The function 'type_hint_argument_test(boolean)' does not exist."
48+
assert the first element of the last parse logs is set # contains "The function 'type_hint_argument_test(boolean)' does not exist." (NEEDS FIXING)

0 commit comments

Comments
 (0)