remove unused formatJSON method, more reliable parse errors
This commit is contained in:
parent
c3541a65cc
commit
86903f1087
@ -24,10 +24,6 @@ exports.isPattern = function (node) {
|
||||
return node.type === "ArrayPattern" || node.type === "ObjectPattern";
|
||||
};
|
||||
|
||||
exports.formatJSON = function (obj) {
|
||||
return JSON.stringify(obj, null, " ");
|
||||
};
|
||||
|
||||
exports.isAbsolute = function (loc) {
|
||||
if (!loc) return false;
|
||||
if (loc[0] === "/") return true; // unix
|
||||
@ -203,12 +199,15 @@ exports.parse = function (opts, code, callback) {
|
||||
if (!err._6to5) {
|
||||
err._6to5 = true;
|
||||
err.message = opts.filename + ": " + err.message;
|
||||
Error.captureStackTrace(err);
|
||||
|
||||
if (err.lineNumber) {
|
||||
var frame = exports.codeFrame(code, err.lineNumber, err.column);
|
||||
err.message = err.message + frame;
|
||||
var err2 = new SyntaxError(err.message + frame);
|
||||
err2._6to5 = true;
|
||||
throw err2;
|
||||
}
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user