Skip to content

Commit cc1fa93

Browse files
gh-173: Make MATCH accept late kwargs even if early ones aren't present.
1 parent 65229bc commit cc1fa93

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/builtins.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7350,9 +7350,9 @@ static Value builtin_match(Interpreter* interp, Value* args, int argc, Expr** ar
73507350
(void)arg_nodes; (void)env; (void)argc;
73517351
if (args[0].type != VAL_MAP || args[1].type != VAL_MAP) RUNTIME_ERROR(interp, "MATCH expects two MAP arguments", line, col);
73527352
int typing = 0, recurse = 0, shape = 0;
7353-
if (argc >= 3) { EXPECT_INT(args[2], "MATCH", interp, line, col); typing = args[2].as.i ? 1 : 0; }
7354-
if (argc >= 4) { EXPECT_INT(args[3], "MATCH", interp, line, col); recurse = args[3].as.i ? 1 : 0; }
7355-
if (argc >= 5) { EXPECT_INT(args[4], "MATCH", interp, line, col); shape = args[4].as.i ? 1 : 0; }
7353+
if (argc >= 3 && args[2].type != VAL_NULL) { EXPECT_INT(args[2], "MATCH", interp, line, col); typing = args[2].as.i ? 1 : 0; }
7354+
if (argc >= 4 && args[3].type != VAL_NULL) { EXPECT_INT(args[3], "MATCH", interp, line, col); recurse = args[3].as.i ? 1 : 0; }
7355+
if (argc >= 5 && args[4].type != VAL_NULL) { EXPECT_INT(args[4], "MATCH", interp, line, col); shape = args[4].as.i ? 1 : 0; }
73567356
Map* m = args[0].as.map;
73577357
Map* tpl = args[1].as.map;
73587358
int ok = match_map_internal(m, tpl, typing, recurse, shape);

0 commit comments

Comments
 (0)