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

Function typeOfMember

src/resolution/pascal-scope.ts:2631–2643  ·  view source on GitHub ↗

The class a member's value has: a field's or variable's declared type, a property's, a function's result.

(member: Node, context: ResolutionContext)

Source from the content-addressed store, hash-verified

2629
2630/** The class a member's value has: a field's or variable's declared type, a property's, a function's result. */
2631function typeOfMember(member: Node, context: ResolutionContext): Node | null {
2632 const memo = memos(context).memberTypes;
2633 if (memo.has(member.id)) return memo.get(member.id)!;
2634 let typeName: string | undefined;
2635 if (member.kind === 'method' || member.kind === 'function') {
2636 typeName = member.returnType ?? /:\s*([A-Za-z_][\w.]*)\s*;?\s*$/.exec(member.signature ?? '')?.[1];
2637 } else {
2638 typeName = /^([A-Za-z_][\w.]*)/.exec(declaredTypeText(member, context))?.[1];
2639 }
2640 const type = typeName ? classNamed(typeName, member.filePath, context) : null;
2641 memo.set(member.id, type);
2642 return type;
2643}
2644
2645/**
2646 * The text of the type a field, variable, constant or property declares,

Callers 2

memberAtPathFunction · 0.85
headOfFunction · 0.85

Calls 7

memosFunction · 0.85
declaredTypeTextFunction · 0.85
hasMethod · 0.80
classNamedFunction · 0.70
getMethod · 0.65
execMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected