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

Function parseFunctionVariableDeclaration

packages/tools/docgen/src/Parser.ts:221–242  ·  view source on GitHub ↗
(vd: ast.VariableDeclaration)

Source from the content-addressed store, hash-verified

219 })
220
221const parseFunctionVariableDeclaration = (vd: ast.VariableDeclaration) =>
222 Effect.gen(function*() {
223 const vs: any = vd.getParent().getParent()
224 const doc = parseDoc(getJSDocText(vs.getJsDocs()))
225 if (shouldIgnore(doc)) {
226 return []
227 }
228 const name = vd.getName()
229 const type = parseType(vd)
230 const signature = `declare const ${name}: ${type}`
231 const startPos = vd.getStart()
232 const source = yield* Source
233 const position = source.sourceFile.getLineAndColumnAtPos(startPos)
234 return [
235 new Domain.Function(
236 name ?? "",
237 doc,
238 signature,
239 position
240 )
241 ]
242 })
243
244const getFunctionDeclarations = Effect.gen(function*() {
245 const source = yield* Source

Callers

nothing calls this directly

Calls 3

parseDocFunction · 0.85
shouldIgnoreFunction · 0.85
parseTypeFunction · 0.85

Tested by

no test coverage detected