MCPcopy Index your code
hub / github.com/nodejs/node / getErrorSpanForArrowFunction

Function getErrorSpanForArrowFunction

test/fixtures/snapshot/typescript.js:15350–15362  ·  view source on GitHub ↗
(sourceFile, node)

Source from the content-addressed store, hash-verified

15348 }
15349 ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
15350 function getErrorSpanForArrowFunction(sourceFile, node) {
15351 var pos = ts.skipTrivia(sourceFile.text, node.pos);
15352 if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) {
15353 var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
15354 var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
15355 if (startLine < endLine) {
15356 // The arrow function spans multiple lines,
15357 // make the error span be the first line, inclusive.
15358 return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1);
15359 }
15360 }
15361 return ts.createTextSpanFromBounds(pos, node.end);
15362 }
15363 function getErrorSpanForNode(sourceFile, node) {
15364 var errorNode = node;
15365 switch (node.kind) {

Callers 1

getErrorSpanForNodeFunction · 0.85

Calls 1

getEndLinePositionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…