Skip to content

Refactored duplicated code in SrcModule function calls traversing

Lukasz Butkowski requested to merge iterateModules into master

While reading the code, I saw that the function call of SrcModules procedures follows the same pattern. Every method is recursively from last children to parent. Therefore I wrote a generic iterateSrcModules procedure. This procedure execute an arbitrary code block in every SrcModule namespace and it sets its TclPath while during so. This allows to reduce the size of the code.

I also added default (void) handle stubs and a flag (IsSrcModule) to the SrcModule definition, so additional checks are not necessary. If an handle of SrcModule is not redefined, the void stub is executed instead.

I also see that the methods in fwfwk.tcl use three different argument names to indicate a namespace: ns, nspace and namespace. I changed every argument name to 'ns', since it seems the most common choice.

This MR is backward compatible

Edited by Lukasz Butkowski

Merge request reports

Loading