Wrap switching scopes in the macros PUSH_SCOPE() and POP_SCOPE().