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

Function fallbackReceiveName

src/extraction/languages/solidity.ts:44–55  ·  view source on GitHub ↗
(node: SyntaxNode)

Source from the content-addressed store, hash-verified

42}
43
44function fallbackReceiveName(node: SyntaxNode): string {
45 // tree-sitter-solidity reuses one node type for both `fallback() ...` and
46 // `receive() ...` — the keyword is an unnamed/anonymous child. Walk all
47 // children (named + unnamed) and pick the first whose text is one of these.
48 for (let i = 0; i < node.childCount; i++) {
49 const child = node.child(i);
50 if (!child) continue;
51 const t = child.text;
52 if (t === 'fallback' || t === 'receive') return t;
53 }
54 return 'fallback';
55}
56
57export const solidityExtractor: LanguageExtractor = {
58 // Free functions (file-level) AND methods inside contracts use the same

Callers 1

solidity.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected