Move this magic into lookup_id, to catch all uses, not just identifiers in expressions.