mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Remove redundant filename in error message
This commit is contained in:
parent
7e5f1b14a3
commit
5f00d6478a
2 changed files with 10 additions and 20 deletions
|
@ -44,19 +44,12 @@
|
|||
options = {};
|
||||
}
|
||||
merge = exports.helpers.merge;
|
||||
try {
|
||||
js = (parser.parse(lexer.tokenize(code, options))).compile(options);
|
||||
if (!options.header) {
|
||||
return js;
|
||||
}
|
||||
} catch (err) {
|
||||
if (options.filename) {
|
||||
err.message = "In " + options.filename + ", " + err.message;
|
||||
}
|
||||
throw err;
|
||||
js = (parser.parse(lexer.tokenize(code, options))).compile(options);
|
||||
if (options.header) {
|
||||
header = "Generated by CoffeeScript " + this.VERSION;
|
||||
js = "// " + header + "\n" + js;
|
||||
}
|
||||
header = "Generated by CoffeeScript " + this.VERSION;
|
||||
return "// " + header + "\n" + js;
|
||||
return js;
|
||||
};
|
||||
|
||||
exports.tokens = function(code, options) {
|
||||
|
|
|
@ -36,14 +36,11 @@ exports.helpers = require './helpers'
|
|||
# compiler.
|
||||
exports.compile = compile = (code, options = {}) ->
|
||||
{merge} = exports.helpers
|
||||
try
|
||||
js = (parser.parse lexer.tokenize(code, options)).compile options
|
||||
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}"
|
||||
js = (parser.parse lexer.tokenize(code, options)).compile options
|
||||
if options.header
|
||||
header = "Generated by CoffeeScript #{@VERSION}"
|
||||
js = "// #{header}\n#{js}"
|
||||
js
|
||||
|
||||
# Tokenize a string of CoffeeScript code, and return the array of tokens.
|
||||
exports.tokens = (code, options) ->
|
||||
|
|
Loading…
Reference in a new issue