Minor refactoring of the compiler code that handles scope directives