MCPcopy Create free account
hub / github.com/nodejs/node / findRightmostChildNodeWithTokens

Function findRightmostChildNodeWithTokens

test/fixtures/snapshot/typescript.js:127626–127638  ·  view source on GitHub ↗

* Finds the rightmost child to the left of `children[exclusiveStartPosition]` which is a non-all-whitespace token or has constituent tokens.

(children, exclusiveStartPosition, sourceFile, parentKind)

Source from the content-addressed store, hash-verified

127624 * Finds the rightmost child to the left of `children[exclusiveStartPosition]` which is a non-all-whitespace token or has constituent tokens.
127625 */
127626 function findRightmostChildNodeWithTokens(children, exclusiveStartPosition, sourceFile, parentKind) {
127627 for (var i = exclusiveStartPosition - 1; i >= 0; i--) {
127628 var child = children[i];
127629 if (isWhiteSpaceOnlyJsxText(child)) {
127630 if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 279 /* SyntaxKind.JsxSelfClosingElement */)) {
127631 ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`");
127632 }
127633 }
127634 else if (nodeHasTokens(children[i], sourceFile)) {
127635 return children[i];
127636 }
127637 }
127638 }
127639 function isInString(sourceFile, position, previousToken) {
127640 if (previousToken === void 0) { previousToken = findPrecedingToken(position, sourceFile); }
127641 if (previousToken && ts.isStringTextContainingNode(previousToken)) {

Callers 2

findFunction · 0.85
findRightmostTokenFunction · 0.85

Calls 3

isWhiteSpaceOnlyJsxTextFunction · 0.85
nodeHasTokensFunction · 0.85
failMethod · 0.45

Tested by

no test coverage detected