MCPcopy Create free account
hub / github.com/BUPT-GAMMA/MASFactory / collectClassBases

Function collectClassBases

masfactory-visualizer/src/parser/astUtils.ts:61–70  ·  view source on GitHub ↗
(rootNode: TSNode, code: string)

Source from the content-addressed store, hash-verified

59 * Collect local class -> base class mappings from a module.
60 */
61export function collectClassBases(rootNode: TSNode, code: string): { [name: string]: string[] } {
62 const out: { [name: string]: string[] } = {};
63 for (const classNode of queryNodes(rootNode, 'class_definition')) {
64 const nameNode = classNode.childForFieldName('name');
65 const className = getNodeText(nameNode, code).trim();
66 if (!className) {continue;}
67 out[className] = getBaseClasses(classNode);
68 }
69 return out;
70}
71
72/**
73 * Parse dictionary argument (for keys, pull_keys, push_keys)

Callers 2

parseMethod · 0.90

Calls 3

queryNodesFunction · 0.85
getNodeTextFunction · 0.85
getBaseClassesFunction · 0.85

Tested by

no test coverage detected