@@ -198,18 +198,16 @@ proc module-sc {command args} {
198198
199199proc recordScanModuleElt {name args} {
200200 set mod [currentState modulename]
201+ set modpath [currentState modulepath]
201202 if {![info exists ::g_scanModuleElt]} {
202203 set ::g_scanModuleElt [dict create]
203204 }
204205 foreach elt $args {
205- if {![dict exists $::g_scanModuleElt $elt ]} {
206- dict set ::g_scanModuleElt $elt {}
207- }
208- if {![dict exists $::g_scanModuleElt $elt $name ]} {
209- dict set ::g_scanModuleElt $elt $name [list $mod ]
206+ if {![dict exists $::g_scanModuleElt $modpath $elt $name ]} {
207+ dict set ::g_scanModuleElt $modpath $elt $name [list $mod ]
210208 } else {
211209 # #nagelfar ignore Suspicious variable name
212- dict with ::g_scanModuleElt $elt {lappend $name $mod }
210+ dict with ::g_scanModuleElt $modpath $ elt {lappend $name $mod }
213211 }
214212 reportDebug " Module $mod defines $elt :$name "
215213 }
@@ -248,29 +246,32 @@ proc doesModVariantMatch {mod pvrlist} {
248246}
249247
250248# collect list of modules matching all extra specifier criteria
251- proc getModMatchingExtraSpec {pxtlist} {
249+ proc getModMatchingExtraSpec {modpath pxtlist} {
252250 set res [list ]
253- if {[info exists ::g_scanModuleElt]} {
251+ if {[info exists ::g_scanModuleElt] && [dict exists $::g_scanModuleElt \
252+ $modpath ]} {
254253 foreach pxt $pxtlist {
255254 lassign $pxt elt name
256255 set one_crit_res [list ]
257256 if {$elt in {require incompat load unload prereq conflict prereq-all\
258257 prereq-any depends-on always-load load-any try-load switch\
259258 switch -on switch-off}} {
260- if {[dict exists $::g_scanModuleElt $elt ]} {
261- foreach {modspec values} [dict get $::g_scanModuleElt $elt ] {
259+ if {[dict exists $::g_scanModuleElt $modpath $elt ]} {
260+ foreach {modspec values} [dict get $::g_scanModuleElt $modpath \
261+ $elt ] {
262262 # modEq proc has been initialized in getModules phase #2
263263 if {[modEq $modspec $name eqstart 1 5 1]} {
264264 # possible duplicate module entry in result list
265265 lappend one_crit_res {*}[dict get $::g_scanModuleElt \
266- $elt $modspec ]
266+ $modpath $ elt $modspec ]
267267 }
268268 }
269269 }
270270 } else {
271271 # get modules matching one simple extra specifier criterion
272- if {[dict exists $::g_scanModuleElt $elt $name ]} {
273- set one_crit_res [dict get $::g_scanModuleElt $elt $name ]
272+ if {[dict exists $::g_scanModuleElt $modpath $elt $name ]} {
273+ set one_crit_res [dict get $::g_scanModuleElt $modpath \
274+ $elt $name ]
274275 }
275276 }
276277 lappend all_crit_res $one_crit_res
@@ -299,7 +300,7 @@ proc isExtraMatchSearchRequired {mod} {
299300}
300301
301302# perform extra match search on currently being built module search result
302- proc filterExtraMatchSearch {mod res_arrname versmod_arrname} {
303+ proc filterExtraMatchSearch {modpath mod res_arrname versmod_arrname} {
303304 # link to variables/arrays from upper context
304305 upvar $res_arrname found_list
305306 upvar $versmod_arrname versmod_list
@@ -329,7 +330,7 @@ proc filterExtraMatchSearch {mod res_arrname versmod_arrname} {
329330 if {![isModuleTagged $elt forbidden 0]} {
330331 # #nagelfar ignore Suspicious variable name
331332 execute-modulefile [lindex $found_list($elt) 2] $elt $elt $elt \
332- 0 0
333+ 0 0 $modpath
333334 }
334335 }
335336 }
@@ -358,7 +359,7 @@ proc filterExtraMatchSearch {mod res_arrname versmod_arrname} {
358359 # get list of modules matching extra specifiers to determine those to not
359360 # matching that need to be withdrawn from result
360361 if {$check_extra } {
361- set extra_keep_list [getModMatchingExtraSpec $spec_xt_list ]
362+ set extra_keep_list [getModMatchingExtraSpec $modpath $ spec_xt_list ]
362363 lassign [getDiffBetweenList $keep_list $extra_keep_list ]\
363364 extra_unset_list
364365 set unset_list [list {*}$unset_list {*}$extra_unset_list ]
0 commit comments