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

Function typeOfMember

src/resolution/pascal-scope.ts:1095–1107  ·  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

1093
1094/** The class a member's value has: a field's or variable's declared type, a property's, a function's result. */
1095function typeOfMember(member: Node, context: ResolutionContext): Node | null {
1096 const memo = memos(context).memberTypes;
1097 if (memo.has(member.id)) return memo.get(member.id)!;
1098 let typeName: string | undefined;
1099 if (member.kind === 'method' || member.kind === 'function') {
1100 typeName = member.returnType ?? /:\s*([A-Za-z_][\w.]*)\s*;?\s*$/.exec(member.signature ?? '')?.[1];
1101 } else {
1102 typeName = /^([A-Za-z_][\w.]*)/.exec(declaredTypeText(member, context))?.[1];
1103 }
1104 const type = typeName ? classNamed(typeName, member.filePath, context) : null;
1105 memo.set(member.id, type);
1106 return type;
1107}
1108
1109/**
1110 * 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