mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
PR-URL: https://github.com/nodejs/node/pull/39094 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
21 lines
543 B
JavaScript
21 lines
543 B
JavaScript
const convertTokens = require("./convertTokens.cjs");
|
|
|
|
const convertComments = require("./convertComments.cjs");
|
|
|
|
const convertAST = require("./convertAST.cjs");
|
|
|
|
exports.ast = function convert(ast, code, tokLabels, visitorKeys) {
|
|
ast.tokens = convertTokens(ast.tokens, code, tokLabels);
|
|
convertComments(ast.comments);
|
|
convertAST(ast, visitorKeys);
|
|
return ast;
|
|
};
|
|
|
|
exports.error = function convertError(err) {
|
|
if (err instanceof SyntaxError) {
|
|
err.lineNumber = err.loc.line;
|
|
err.column = err.loc.column;
|
|
}
|
|
|
|
return err;
|
|
}; |