optimize filterNestedSymbolUses function