Matchers: Don't return twice when value to capture is missing
We called return_from_matcher once inside matcher_evaluate_capturing_instruction and outside of it. That way we returned not to the parent call stack entry but to the grandparent.
This commit is contained in:
parent
20c2880f4c
commit
3d7bef187c
3 changed files with 19 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
18
src/functional-tests/variadic-functions.at
Normal file
18
src/functional-tests/variadic-functions.at
Normal file
|
|
@ -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
|
||||
Loading…
Reference in a new issue