(classNode: TSNode)
| 39 | * Get base classes from a class definition node |
| 40 | */ |
| 41 | export 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. |
no test coverage detected