From f05ccdffcc77109642db2887acb853a21f13736a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Reuh=20Fildadut?= Date: Sun, 16 Jan 2022 00:19:25 +0100 Subject: [PATCH] Fix _!_ binop call with more than 2 arguments --- parser/expression.lua | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/parser/expression.lua b/parser/expression.lua index ce8a367..41235e7 100644 --- a/parser/expression.lua +++ b/parser/expression.lua @@ -271,11 +271,23 @@ local function expression(s, state, namespace, current_priority, operating_on) if not args then args = operating_on else - args = { - type = "list", - left = operating_on, - right = args - } + if args.type == "list" then -- insert as first element + local first_list = args + while first_list.left.type == "list" do + first_list = first_list.left + end + first_list.left = { + type = "list", + left = operating_on, + right = first_list.left + } + else + args = { + type = "list", + left = operating_on, + right = args + } + end end -- find compatible variant local variant, err = find_function(state, namespace, name, args, paren_call)