 
   # Compile.
   if not helpers.isCoffee(mainModule.filename) or require.extensions
-    mainModule._compile compile(code, options), mainModule.filename
+    answer = compile(code, options)
+    # Attach sourceMap object to mainModule._sourceMaps[options.filename] so that
+    # it is accessible by Error.prepareStackTrace.
+    do patchStackTrace
+    mainModule._sourceMaps[mainModule.filename] = answer.sourceMap
+    mainModule._compile answer.js, mainModule.filename
   else
     mainModule._compile code, mainModule.filename
 

  # data for this token. Unfortunately, Jison seems to send an outdated `loc`
  # (from the previous token), so we take the location information directly
  # from the lexer.
  helpers.throwSyntaxError message, parser.lexer.yylloc
# setting `__filename`, `__dirname`, and relative `require()`.
exports.run = (code, options = {}) ->
  mainModule = require.main
  options.sourceMap = true
  # Set the filename.
  mainModule.filename = process.argv[1] =
      if options.filename then fs.realpathSync(options.filename) else '.'
