Fix Issue 10492 - Illegal Instruction for mixin template with scope declarations

Decompose the declarations in the mixin (after running semantic) so scopeCode etc gets correctly run on variables.