MCPcopy
hub / github.com/gpujs/gpu.js / astErrorOutput

Method astErrorOutput

src/backend/function-node.js:963–973  ·  view source on GitHub ↗

* @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)

Source from the content-addressed store, hash-verified

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;

Callers 15

getTypeMethod · 0.95
getCheckVariableTypeMethod · 0.95
getDependenciesMethod · 0.95
astGenericMethod · 0.95
astFunctionMethod · 0.80
astReturnStatementMethod · 0.80
astLiteralMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected