Refactor semanticTiargs() and fix Issue 9178 - UDA: getAttributes does not play well with tupleof

http://d.puremagic.com/issues/show_bug.cgi?id=9178

In `TemplateInstance::semanticTiargs`, all template arguments should be processed by a consistent way. But its implementation is a little dirty.
9178 is a bug which was leaked from the fix for [9100](http://d.puremagic.com/issues/show_bug.cgi?id=9100) (== #1340), which implicitly had caused by it.
This refactoring cleans the code, and get a bug fix as a side-effect.