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

Function forEachNameInAccessChainWalkingLeft

test/fixtures/snapshot/typescript.js:19813–19846  ·  view source on GitHub ↗
(name, action)

Source from the content-addressed store, hash-verified

19811 }
19812 ts.getLeftmostAccessExpression = getLeftmostAccessExpression;
19813 function forEachNameInAccessChainWalkingLeft(name, action) {
19814 if (isAccessExpression(name.parent) && isRightSideOfAccessExpression(name)) {
19815 return walkAccessExpression(name.parent);
19816 }
19817 function walkAccessExpression(access) {
19818 if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) {
19819 var res = action(access.name);
19820 if (res !== undefined) {
19821 return res;
19822 }
19823 }
19824 else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) {
19825 if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) {
19826 var res = action(access.argumentExpression);
19827 if (res !== undefined) {
19828 return res;
19829 }
19830 }
19831 else {
19832 // Chain interrupted by non-static-name access 'x[expr()].y.z'
19833 return undefined;
19834 }
19835 }
19836 if (isAccessExpression(access.expression)) {
19837 return walkAccessExpression(access.expression);
19838 }
19839 if (ts.isIdentifier(access.expression)) {
19840 // End of chain at Identifier 'x.y.z'
19841 return action(access.expression);
19842 }
19843 // End of chain at non-Identifier 'x().y.z'
19844 return undefined;
19845 }
19846 }
19847 ts.forEachNameInAccessChainWalkingLeft = forEachNameInAccessChainWalkingLeft;
19848 function getLeftmostExpression(node, stopAtCallExpressions) {
19849 while (true) {

Callers

nothing calls this directly

Calls 3

isAccessExpressionFunction · 0.85
walkAccessExpressionFunction · 0.85

Tested by

no test coverage detected