]> Repositorios git - scryer-prolog.git/commitdiff
Fix throw/1 control construct to throw an instantiation error when the argument is...
authorPaulo Moura <>
Sun, 9 May 2021 11:42:51 +0000 (12:42 +0100)
committerPaulo Moura <>
Sun, 9 May 2021 11:42:51 +0000 (12:42 +0100)
src/lib/builtins.pl

index 502827b6cf3dd7c85c66877147472ab40e27fb69..bd11ac1617fecb15203df48e52e2951b71b0bc6b 100644 (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) :-