]> git.eshelyaron.com Git - dict.git/commitdiff
FIXED: find user predicate definitions more reliably
authorEshel Yaron <me@eshelyaron.com>
Thu, 10 Nov 2022 18:13:16 +0000 (20:13 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 10 Nov 2022 18:13:16 +0000 (20:13 +0200)
sweep.pl

index 9f42fd05646aea5ab6953ec4384f2df328e353ac..ffde94b2b2329d62bc102348d95b7ccb9a56d162 100644 (file)
--- 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),