Traverse into functions without using cross-module-incompatible instanceof