Mercurial > pub > dyncall > dyncall
diff test/call_suite_aggrs/mk-cases.lua @ 510:f0080b53635d
test/call_suite_aggrs:
- less confusing and simpler generated code (with first arg in V_?[0] output)
- avoid using same test reference value for retval and last arg
author | Tassilo Philipp |
---|---|
date | Sat, 09 Apr 2022 23:45:44 +0200 |
parents | ed7d1f5e7973 |
children | 4d0541bf9b38 |
line wrap: on
line diff
--- a/test/call_suite_aggrs/mk-cases.lua Sat Apr 09 23:00:24 2022 +0200 +++ b/test/call_suite_aggrs/mk-cases.lua Sat Apr 09 23:45:44 2022 +0200 @@ -26,7 +26,7 @@ local fsig = put_sig_rtype_first(sig) local h = { "/* ",id,":",sig," */ " } local t = { "" } - local pos = 0 + local pos = -1 local n_nest = 0 local aggr = { } local aggr_sig = { } @@ -87,7 +87,7 @@ end -- is return type or func arg? - if pos == 0 then + if pos == -1 then h[#h+1] = " f"..id.."(" h[#h+1] = '' t[#t] = '' -- clear; aggr return type handled explicitly @@ -100,12 +100,12 @@ end end end - max_numargs = math.max(max_numargs, pos-1) + max_numargs = math.max(max_numargs, pos) h[#h] = "){" if #h[6] == 1 then - t[#t+1] = "ret_"..h[6].."("..(pos-1)..")}\n" + t[#t+1] = "ret_"..h[6].."("..pos..")}\n" else - t[#t+1] = "ret_a("..(pos-1)..","..h[6]..")}\n" + t[#t+1] = "ret_a("..pos..","..h[6]..")}\n" end return table.concat(h,"")..table.concat(t,"") end