From ef28a363df2eb9521b070150009cbf382b4fb821 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Thu, 10 Nov 2022 20:13:16 +0200 Subject: [PATCH] FIXED: find user predicate definitions more reliably --- sweep.pl | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/sweep.pl b/sweep.pl index 9f42fd0..ffde94b 100644 --- a/sweep.pl +++ b/sweep.pl @@ -349,12 +349,12 @@ sweep_predicate_location_(H, Path, Line) :- !, atom_string(Path0, Path). sweep_predicate_location_(H, Path, Line) :- - xref_defined(Path0, H, How), - atom_string(Path0, Path), - ( xref_definition_line(How, Line) + ( xref_defined(Path0, H, How), + xref_definition_line(How, Line) -> true - ; Line = [] - ). + ; xref_defined(Path0, H, _), Line = [] + ), + atom_string(Path0, Path). sweep_predicate_location_(M, H, Path, Line) :- predicate_property(M:H, file(Path0)), @@ -362,12 +362,16 @@ sweep_predicate_location_(M, H, Path, Line) :- !, atom_string(Path0, Path). sweep_predicate_location_(M, H, Path, Line) :- - xref_defined(Path0, M:H, How), - atom_string(Path0, Path), - ( xref_definition_line(How, Line) + ( xref_defined(Path0, M:H, How), + xref_definition_line(How, Line) -> true - ; Line = [] - ). + ; xref_defined(Path0, H, How), + xref_definition_line(How, Line), + xref_module(Path0, M) + -> true + ; xref_defined(Path0, M:H, _), Line = [] + ), + atom_string(Path0, Path). sweep_local_predicate_completion(Sub, Preds) :- sweep_current_module(M), -- 2.39.2