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 = {};
|
options = {};
|
||||||
}
|
}
|
||||||
merge = exports.helpers.merge;
|
merge = exports.helpers.merge;
|
||||||
try {
|
js = (parser.parse(lexer.tokenize(code, options))).compile(options);
|
||||||
js = (parser.parse(lexer.tokenize(code, options))).compile(options);
|
if (options.header) {
|
||||||
if (!options.header) {
|
header = "Generated by CoffeeScript " + this.VERSION;
|
||||||
return js;
|
js = "// " + header + "\n" + js;
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
if (options.filename) {
|
|
||||||
err.message = "In " + options.filename + ", " + err.message;
|
|
||||||
}
|
|
||||||
throw err;
|
|
||||||
}
|
}
|
||||||
header = "Generated by CoffeeScript " + this.VERSION;
|
return js;
|
||||||
return "// " + header + "\n" + js;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.tokens = function(code, options) {
|
exports.tokens = function(code, options) {
|
||||||
|
|
|
@ -36,14 +36,11 @@ exports.helpers = require './helpers'
|
||||||
# compiler.
|
# compiler.
|
||||||
exports.compile = compile = (code, options = {}) ->
|
exports.compile = compile = (code, options = {}) ->
|
||||||
{merge} = exports.helpers
|
{merge} = exports.helpers
|
||||||
try
|
js = (parser.parse lexer.tokenize(code, options)).compile options
|
||||||
js = (parser.parse lexer.tokenize(code, options)).compile options
|
if options.header
|
||||||
return js unless options.header
|
header = "Generated by CoffeeScript #{@VERSION}"
|
||||||
catch err
|
js = "// #{header}\n#{js}"
|
||||||
err.message = "In #{options.filename}, #{err.message}" if options.filename
|
js
|
||||||
throw err
|
|
||||||
header = "Generated by CoffeeScript #{@VERSION}"
|
|
||||||
"// #{header}\n#{js}"
|
|
||||||
|
|
||||||
# Tokenize a string of CoffeeScript code, and return the array of tokens.
|
# Tokenize a string of CoffeeScript code, and return the array of tokens.
|
||||||
exports.tokens = (code, options) ->
|
exports.tokens = (code, options) ->
|
||||||
|
|
Loading…
Reference in a new issue