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

Method pascalTypeName

src/extraction/tree-sitter.ts:9558–9565  ·  view source on GitHub ↗

The class or record name a declared type (`type`/`typeref`) stands for: `TFoo`, `Sys.TFoo` → `TFoo`, `TList ` → `TList`.

(type: SyntaxNode | null | undefined)

Source from the content-addressed store, hash-verified

9556
9557 /** The class or record name a declared type (`type`/`typeref`) stands for: `TFoo`, `Sys.TFoo` → `TFoo`, `TList<T>` → `TList`. */
9558 private pascalTypeName(type: SyntaxNode | null | undefined): string | null {
9559 let ref = type?.type === 'type' ? type.namedChild(0) : type;
9560 if (ref?.type !== 'typeref') return null;
9561 ref = ref.namedChild(0);
9562 if (ref?.type === 'typerefDot') ref = ref.namedChild(ref.namedChildCount - 1);
9563 else if (ref?.type === 'typerefTpl') ref = ref.namedChild(0);
9564 return ref?.type === 'identifier' ? getNodeText(ref, this.source) : null;
9565 }
9566
9567 /**
9568 * Extract function calls from a Pascal expression. A `receiverLink` call is

Callers 3

pascalRoutineLocalsMethod · 0.95
pascalLocalTypeNameMethod · 0.95
declarePascalInlineMethod · 0.95

Calls 1

getNodeTextFunction · 0.90

Tested by

no test coverage detected