]> Repositorios git - scryer-prolog.git/commitdiff
mark term_variables type errors with blame
authorMark Thom <[email protected]>
Thu, 4 Oct 2018 05:08:25 +0000 (23:08 -0600)
committerMark Thom <[email protected]>
Thu, 4 Oct 2018 05:08:25 +0000 (23:08 -0600)
src/prolog/lib/builtins.pl

index 66638a3566acbe0a054f4ebac3f96cefa79eb874..a8a0023f99bfe07967cb9bc9173c11913ce03200 100644 (file)
@@ -206,11 +206,15 @@ get_args([Arg|Args], Func, I0, N) :-
     '$call_with_default_policy'(get_args(Args, Func, I1, N)).
 
 % term_variables.
-    
+
+can_be(Type, Term) :- error:can_be(Type, Term).
+
 term_variables(Term, Vars) :-
-    error:can_be(list, Vars),
+    catch(can_be(list, Vars), error(E, Ctx),
+         ( ( var(Ctx) -> Ctx = term_variables/2 ; true ),
+           throw(error(E, Ctx)) ) ),
     '$term_variables'(Term, Vars).
-    
+
 % setup_call_cleanup.
 
 setup_call_cleanup(S, G, C) :- '$get_b_value'(B),