Fix throw/1 control construct to throw an instantiation error when the argument is not bound

This commit is contained in:
Paulo Moura
2021-05-09 12:42:51 +01:00
parent 9b483d381f
commit 07dd2b279e

View File

@@ -615,8 +615,12 @@ handle_ball(C, C, R) :-
handle_ball(_, _, _) :-
'$unwind_stack'.
throw(Ball) :- '$set_ball'(Ball), '$unwind_stack'.
throw(Ball) :-
( var(Ball) ->
'$set_ball'(error(instantiation_error,throw/1))
; '$set_ball'(Ball)
),
'$unwind_stack'.
:- non_counted_backtracking '$iterate_find_all'/4.
'$iterate_find_all'(Template, Goal, _, LhOffset) :-