Fix Issue 7077 - mixin statements can invade the enclosing scope

The if body should always be inside its own scope
Merge pull request #2402 from yebblies/issue7077

Fix Issue 7077 - mixin statements can invade the enclosing scope