Early return from CoffeeScript.compile when header not enabled

This commit is contained in:
Trevor Burnham
2012-01-10 14:00:29 -05:00
parent 11342ef97b
commit 86e4d79ffb
2 changed files with 6 additions and 6 deletions

View File

@@ -34,12 +34,13 @@ exports.helpers = require './helpers'
exports.compile = compile = (code, options = {}) ->
{merge} = exports.helpers
try
header = "// Generated by CoffeeScript #{@VERSION}\n" if options.header
js = (parser.parse lexer.tokenize code).compile options
"#{[header]}#{js}"
return js unless options.header
catch err
err.message = "In #{options.filename}, #{err.message}" if options.filename
throw err
header = "Generated by CoffeeScript #{@VERSION}"
"// #{header}\n#{js}"
# Tokenize a string of CoffeeScript code, and return the array of tokens.
exports.tokens = (code, options) ->