Skip to content

Commit f17e663

Browse files
committed
py: Issue an error when compiling Viper functions with more than 4 args.
Otherwise it can be very hard to track down bugs.
1 parent e45c1db commit f17e663

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

py/emitnative.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,12 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
675675

676676
if (emit->do_viper_types) {
677677

678+
// right now we have a restriction of maximum of 4 arguments
679+
if (scope->num_pos_args >= 5) {
680+
EMIT_NATIVE_VIPER_TYPE_ERROR(emit, "Viper functions don't currently support more than 4 arguments (while compiling '%q')", scope->simple_name); return;
681+
return;
682+
}
683+
678684
// entry to function
679685
int num_locals = 0;
680686
if (pass > MP_PASS_SCOPE) {

0 commit comments

Comments
 (0)