Skip to content

Commit 9c3cff7

Browse files
committed
Set dedicated phase of getModules for early filtering
Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent 1f60b0a commit 9c3cff7

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

tcl/modfind.tcl.in

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3169,20 +3169,27 @@ proc getModules {dir {mod {}} {fetch_mtime 0} {search {}} {filter {}}} {
31693169
}
31703170
}
31713171

3172-
# Phase #2: filter-out dynamically hidden or expired elements
3172+
# Phase #2: early filtering of non-matching elements
3173+
3174+
defineModEqProc $icase [getConf extended_default]
3175+
3176+
if {$earlyfilter} {
3177+
foreach elt [array names found_list] {
3178+
if {![modEq $modroot $elt eqstart]} {
3179+
unset found_list($elt)
3180+
}
3181+
}
3182+
}
3183+
3184+
# Phase #3: filter-out dynamically hidden or expired elements
31733185

31743186
# define module name and version comparison procs
31753187
defineModStartNbProc $icase
3176-
defineModEqProc $icase [getConf extended_default]
31773188
defineModEqStaticProc $icase [getConf extended_default] $mod
31783189

31793190
# remove hidden elements unless they are (or their symbols) targeted by
31803191
# search query.
31813192
foreach elt [array names found_list] {
3182-
if {$earlyfilter && ![modEq $modroot $elt eqstart]} {
3183-
unset found_list($elt)
3184-
continue
3185-
}
31863193
if {[lassign [isModuleHidden $elt $mod 1 [lindex $found_list($elt) 2]]\
31873194
hidlvl hidmatch hidbydef]} {
31883195
# is there a symbol that matches query (bare module name query
@@ -3230,7 +3237,7 @@ proc getModules {dir {mod {}} {fetch_mtime 0} {search {}} {filter {}}} {
32303237
}
32313238
}
32323239

3233-
# Phase #3: elaborate directory content with default element selection
3240+
# Phase #4: elaborate directory content with default element selection
32343241

32353242
array set dir_list {}
32363243
array set autosym_list {}
@@ -3298,7 +3305,7 @@ proc getModules {dir {mod {}} {fetch_mtime 0} {search {}} {filter {}}} {
32983305
}
32993306
}
33003307

3301-
# Phase #4: perform extra match search
3308+
# Phase #5: perform extra match search
33023309

33033310
if {$ems_required} {
33043311
scanExtraMatchSearch $dir $mod found_list
@@ -3309,7 +3316,7 @@ proc getModules {dir {mod {}} {fetch_mtime 0} {search {}} {filter {}}} {
33093316
# during scan evaluation)
33103317
defineModEqStaticProc $icase [getConf extended_default] $mod
33113318

3312-
# Phase #5: filter results to keep those matching search query
3319+
# Phase #6: filter results to keep those matching search query
33133320

33143321
# define module name and version comparison procs
33153322
defineDoesModMatchAtDepthProc $contains $querydepth $mtest

0 commit comments

Comments
 (0)