When you introduce a new concept like this it is much better to factor it out into a separate function. Injecting lots of code like this in `semantic` is a serious anti-pattern in DMD, especially since there's no comments in here at all.