 getCachedJavaScript = (cachePath) ->
   if fs.isFileSync(cachePath)
     try
-      fs.readFileSync(cachePath, 'utf8')
+      cachedJavaScript = fs.readFileSync(cachePath, 'utf8')
+      stats.misses++
+      return cachedJavaScript
+  return
 
 convertFilePath = (filePath) ->
   if process.platform is 'win32'

fs = require 'fs-plus'

cacheDir = path.join(fs.absolute('~/.atom'), 'compile-cache')

# Use separate compile cache when sudo'ing as root to avoid permission issues
if process.env.USER is 'root' and process.env.SUDO_USER and process.env.SUDO_USER isnt process.env.USER


compileCoffeeScript = (coffee, filePath, cachePath) ->
  {js, v3SourceMap} = CoffeeScript.compile(coffee, filename: filePath, sourceMap: true)
  stats.misses++
  # Include source map in the web page environment.
  if btoa? and JSON? and unescape? and encodeURIComponent?
    js = "#{js}\n//# sourceMappingURL=data:application/json;base64,#{btoa unescape encodeURIComponent v3SourceMap}\n//# sourceURL=#{convertFilePath(filePath)}"
