Compile def with local and module variables