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

Function findImmediatelyPrecedingTokenOfKind

test/fixtures/snapshot/typescript.js:147057–147062  ·  view source on GitHub ↗

* Validating `expectedTokenKind` ensures the token was typed in the context we expect (eg: not a comment). * @param expectedTokenKind The kind of the last token constituting the desired parent node.

(end, expectedTokenKind, sourceFile)

Source from the content-addressed store, hash-verified

147055 * @param expectedTokenKind The kind of the last token constituting the desired parent node.
147056 */
147057 function findImmediatelyPrecedingTokenOfKind(end, expectedTokenKind, sourceFile) {
147058 var precedingToken = ts.findPrecedingToken(end, sourceFile);
147059 return precedingToken && precedingToken.kind === expectedTokenKind && end === precedingToken.getEnd() ?
147060 precedingToken :
147061 undefined;
147062 }
147063 /**
147064 * Finds the highest node enclosing `node` at the same list level as `node`
147065 * and whose end does not exceed `node.end`.

Callers 3

formatOnSemicolonFunction · 0.85
formatOnOpeningCurlyFunction · 0.85
formatOnClosingCurlyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected