MCPcopy Create free account
hub / github.com/Effect-TS/effect / parseClass

Function parseClass

packages/tools/docgen/src/Parser.ts:593–624  ·  view source on GitHub ↗
(c: ast.ClassDeclaration)

Source from the content-addressed store, hash-verified

591}
592
593const parseClass = (c: ast.ClassDeclaration) =>
594 Effect.gen(function*() {
595 const doc = parseDoc(getJSDocText(c.getJsDocs()))
596 if (shouldIgnore(doc)) {
597 return []
598 }
599 const name = c.getName() ?? ""
600 const signature = yield* getClassDeclarationSignature(c)
601 const methods = yield* pipe(
602 c.getInstanceMethods(),
603 Effect.forEach(parseMethod),
604 Effect.map(Array.getSomes)
605 )
606 const staticMethods = yield* pipe(
607 c.getStaticMethods(),
608 Effect.forEach(parseMethod),
609 Effect.map(Array.getSomes)
610 )
611 const properties = yield* parseProperties(c)
612 const position = yield* parsePosition(c)
613 return [
614 new Domain.Class(
615 name,
616 doc,
617 signature,
618 position,
619 methods,
620 staticMethods,
621 properties
622 )
623 ]
624 })
625
626/**
627 * Parses exported classes and their documented members from the current source file.

Callers

nothing calls this directly

Calls 8

parseDocFunction · 0.85
shouldIgnoreFunction · 0.85
parsePropertiesFunction · 0.85
parsePositionFunction · 0.85
forEachMethod · 0.65
pipeFunction · 0.50
mapMethod · 0.45

Tested by

no test coverage detected