Allow modules in a dialect to export definitions

Using a dialect in a module was causing the module to not export any
definitions. Now the scoping of the dialect takes into account the
presence of a module and places it above the module scope.