* @desc To throw the AST error, with its location. * @param {string} error - the error message output * @param {Object} ast - the AST object where the error is
(error, ast)
| 961 | * @param {Object} ast - the AST object where the error is |
| 962 | */ |
| 963 | astErrorOutput(error, ast) { |
| 964 | if (typeof this.source !== 'string') { |
| 965 | return new Error(error); |
| 966 | } |
| 967 | |
| 968 | const debugString = utils.getAstString(this.source, ast); |
| 969 | const leadingSource = this.source.substr(ast.start); |
| 970 | const splitLines = leadingSource.split(/\n/); |
| 971 | const lineBefore = splitLines.length > 0 ? splitLines[splitLines.length - 1] : 0; |
| 972 | return new Error(`${error} on line ${ splitLines.length }, position ${ lineBefore.length }:\n ${ debugString }`); |
| 973 | } |
| 974 | |
| 975 | astDebuggerStatement(arrNode, retArr) { |
| 976 | return retArr; |
no outgoing calls
no test coverage detected