From 34276d720c8b7fc4394bbb6c2a559852a2446472 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sat, 6 Jan 2024 17:47:38 +0200 Subject: [PATCH] fix: remove sparse call arguments --- src/me/topchetoeu/jscript/parsing/Parsing.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/me/topchetoeu/jscript/parsing/Parsing.java b/src/me/topchetoeu/jscript/parsing/Parsing.java index 6131677..1053225 100644 --- a/src/me/topchetoeu/jscript/parsing/Parsing.java +++ b/src/me/topchetoeu/jscript/parsing/Parsing.java @@ -1178,8 +1178,7 @@ public class Parsing { prevArg = true; } else if (argRes.isError()) return argRes.transform(); - else if (isOperator(tokens, i + n, Operator.COMMA)) { - if (!prevArg) args.add(null); + else if (prevArg && isOperator(tokens, i + n, Operator.COMMA)) { prevArg = false; n++; } @@ -1187,7 +1186,7 @@ public class Parsing { n++; break; } - else return ParseRes.failed(); + else return ParseRes.error(getLoc(filename, tokens, i + n), prevArg ? "Expected a comma or a closing paren." : "Expected an expression or a closing paren."); } return ParseRes.res(new CallStatement(loc, false, prev, args.toArray(Statement[]::new)), n);