diff --git a/pl/boot.yap b/pl/boot.yap index 3b240c7cf..bbe4e19a3 100755 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -461,9 +461,14 @@ true :- true. '$$compile'(G1, G0, N, HeadMod). '$prepare_term'(G, V, Pos, G0, G1, BodyMod, SourceMod, Source) :- - ( get_value('$syntaxcheckflag',on) -> - '$check_term'(Source, V, Pos, BodyMod) ; true ), - '$precompile_term'(G, G0, G1, BodyMod, SourceMod). + '$precompile_term'(G, G0, G1, BodyMod, SourceMod), + ( + get_value('$syntaxcheckflag',on) + -> + '$check_term'(G0, V, Pos, Source, BodyMod) + ; + true + ). % process an input clause '$$compile'(G, G0, L, Mod) :- diff --git a/pl/checker.yap b/pl/checker.yap index 05a3ee24e..3405c2b17 100644 --- a/pl/checker.yap +++ b/pl/checker.yap @@ -120,20 +120,22 @@ no_style_check([H|T]) :- no_style_check(H), no_style_check(T). '$values'('$syntaxcheckmultiple',O,N). -'$check_term'(T,_,P,M) :- +'$check_term'(T,_,P,_Source,M) :- get_value('$syntaxcheckdiscontiguous',on), '$xtract_head'(T,M,NM,_,F,A), '$handle_discontiguous'(F,A,NM), fail. -'$check_term'(T,_,P,M) :- +'$check_term'(T,_,P,_Source,M) :- get_value('$syntaxcheckmultiple',on), '$xtract_head'(T,M,NM,_,F,A), '$handle_multiple'(F,A,NM), fail. -'$check_term'(T,VL,P,_) :- +'$check_term'(T,VL,P,_Source,_) :- get_value('$syntaxchecksinglevar',on), ( '$chk_binding_vars'(T), - '$sv_list'(VL,Sv) -> - '$sv_warning'(Sv,T) ), fail. -'$check_term'(_,_,_,_). + '$sv_list'(VL,Sv) + -> + '$sv_warning'(Sv,T) + ), fail. +'$check_term'(_,_,_,_,_). '$chk_binding_vars'(V) :- var(V), !, V = '$V'(_). '$chk_binding_vars'('$V'(off)) :- !.