MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / firstArgValue

Function firstArgValue

src/extraction/languages/r.ts:58–67  ·  view source on GitHub ↗

First positional argument's value node of a call.

(call: SyntaxNode)

Source from the content-addressed store, hash-verified

56
57/** First positional argument's value node of a call. */
58function firstArgValue(call: SyntaxNode): SyntaxNode | null {
59 const args = getChildByField(call, 'arguments');
60 if (!args) return null;
61 for (let i = 0; i < args.namedChildCount; i++) {
62 const arg = args.namedChild(i);
63 if (arg?.type !== 'argument') continue;
64 return getChildByField(arg, 'value');
65 }
66 return null;
67}
68
69/** Text of a string node's content, or an identifier's text. */
70function literalOrIdentifier(node: SyntaxNode | null, source: string): string | null {

Callers 1

r.tsFile · 0.85

Calls 1

getChildByFieldFunction · 0.90

Tested by

no test coverage detected