Uses of classes in closures were not captured previously, this diff adds that. This diff needs some changes after:
- D6675: to make sure return types of closures are also added to the uses
- D6670: default values will not be static scalars anymore, so the visitor call changes (and the default value use capturing can be more easily tested)
So comments welcome, but I'd prefer first landing D6675 and D6670 and making the changes here.