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

Function getBaseClasses

masfactory-visualizer/src/parser/astUtils.ts:41–56  ·  view source on GitHub ↗
(classNode: TSNode)

Source from the content-addressed store, hash-verified

39 * Get base classes from a class definition node
40 */
41export function getBaseClasses(classNode: TSNode): string[] {
42 const bases: string[] = [];
43 const argList = classNode.childForFieldName('superclasses');
44 if (argList) {
45 for (const child of argList.namedChildren) {
46 if (!child) {continue;}
47 if (child.type === 'identifier') {
48 bases.push(child.text);
49 } else if (child.type === 'attribute') {
50 // Handle module.ClassName
51 bases.push(child.text);
52 }
53 }
54 }
55 return bases;
56}
57
58/**
59 * Collect local class -> base class mappings from a module.

Callers 3

parseComponentStructureFunction · 0.90
collectClassBasesFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected