From: Eshel Yaron Date: Sun, 1 Jan 2023 20:17:22 +0000 (+0200) Subject: FIXED: find next predicate definition more reliably X-Git-Tag: V9.1.2-sweep-0.11.0~4 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=922895279eb090c1a63ddb35dfe4e7194865e8b1;p=dict.git FIXED: find next predicate definition more reliably * sweep.pl (sweeprolog_beginning_of_last_predicate/2) (sweeprolog_beginning_of_last_predicate/2): explicitly sort results, don't assume xref_defined/3 yields ordered results. --- diff --git a/sweep.pl b/sweep.pl index 5b0b13b..f859eea 100644 --- a/sweep.pl +++ b/sweep.pl @@ -755,13 +755,19 @@ sweep_beginning_of_last_predicate(Start, Next) :- L < Start ), Ls), - reverse(Ls, [Next|_]). + sort(Ls, Sorted), + reverse(Sorted, [Next|_]). sweep_beginning_of_next_predicate(Start, Next) :- sweep_source_id(Path), xref_source(Path, [comments(store)]), - xref_defined(Path, _, H), xref_definition_line(H, Next), - Start < Next. + findall(L, + ( xref_defined(Path, _, H), + xref_definition_line(H, L), + Start < L + ), + Ls), + sort(Ls, [Next|_]). sweep_source_id(Path) :- sweep_main_thread,