Replace redundant staticness test with $static_or_dynamic check.