From 6c244d30654da6f901bf2dd6740a783a53af4d46 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 10 Nov 2021 08:12:12 +0200 Subject: [PATCH] cgen: improve diagnostic for a v compiler panic in dicordv --- vlib/v/gen/c/fn.v | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vlib/v/gen/c/fn.v b/vlib/v/gen/c/fn.v index 4baabd2e08..490c370f83 100644 --- a/vlib/v/gen/c/fn.v +++ b/vlib/v/gen/c/fn.v @@ -1296,7 +1296,14 @@ fn (mut g Gen) autofree_call_postgen(node_pos int) { } fn (mut g Gen) call_args(node ast.CallExpr) { - args := if g.is_js_call { node.args[1..] } else { node.args } + args := if g.is_js_call { + if node.args.len < 1 { + g.error('node should have at least 1 arg', node.pos) + } + node.args[1..] + } else { + node.args + } expected_types := node.expected_arg_types // only v variadic, C variadic args will be appeneded like normal args is_variadic := expected_types.len > 0 && expected_types.last().has_flag(.variadic)