diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3abf973..11d758a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,6 +67,7 @@ functionaltest("while") functionaltest("eq") functionaltest("chained-assignments") functionaltest("dictionary-assignments") +functionaltest("variadic-functions") install(TARGETS apfl DESTINATION lib) install(TARGETS apfl-bin DESTINATION bin) diff --git a/src/eval.c b/src/eval.c index 5d877b1..31be76d 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1159,7 +1159,6 @@ matcher_evaluate_capturing_instruction( struct apfl_value cur; if (!matcher_current_val(ctx, cse, &cur)) { - return_from_matcher(ctx, false); return false; } diff --git a/src/functional-tests/variadic-functions.at b/src/functional-tests/variadic-functions.at new file mode 100644 index 0000000..f425772 --- /dev/null +++ b/src/functional-tests/variadic-functions.at @@ -0,0 +1,18 @@ +===== script ===== +foo = { +x y z -> 3 +x y -> 2 +x -> 1 +-> 0 +} + +print (foo 1 1 1) +print (foo 1 1) +print (foo 1) +print (foo) + +===== output ===== +3 +2 +1 +0