MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / doclink_file_pass

Function doclink_file_pass

internal/cbm/doclink.c:489–522  ·  view source on GitHub ↗

The file's own doc, then the language's loose docs. The parser gets a * definition-shaped stand-in for the file; what it pushes with the stand-in * is marked, and the resolving half takes the File node as the source (a * loose-doc hook may push with a definition of the file instead). No qualified * name for that node is computed on this side. */

Source from the content-addressed store, hash-verified

487 * loose-doc hook may push with a definition of the file instead). No qualified
488 * name for that node is computed on this side. */
489static void doclink_file_pass(CBMExtractCtx *ctx, const doclink_lang_t *L) {
490 const char *file_doc = ctx->result->module_doc;
491 bool has_doc = file_doc && file_doc[0];
492 if (!has_doc && !L->loose_docs) {
493 return;
494 }
495 CBMDocLinkArray *arr = &ctx->result->doc_links;
496 int first = arr->count;
497 CBMDefinition file_def = {
498 .name = ctx->rel_path,
499 .qualified_name = ctx->module_qn ? ctx->module_qn : "",
500 .label = "File",
501 .file_path = ctx->rel_path,
502 .start_line = SKIP_ONE,
503 .end_line = SKIP_ONE,
504 .docstring = file_doc,
505 };
506 if (has_doc) {
507 doc_line_ent_t *info = doc_info_of(ctx, file_doc);
508 uint32_t doc_line = info ? info->line : 0;
509 L->parse_doc(ctx, &file_def, file_doc, doc_line ? doc_line : file_def.start_line);
510 if (info) {
511 info->parsed = true;
512 }
513 }
514 if (L->loose_docs) {
515 L->loose_docs(ctx, &file_def, doclink_taken);
516 }
517 for (int i = first; i < arr->count; i++) {
518 if (arr->items[i].source_qn == file_def.qualified_name) {
519 arr->items[i].flags |= CBM_DOCLINK_FLAG_FILE; /* not a definition's */
520 }
521 }
522}
523
524void cbm_doclinks_extract(CBMExtractCtx *ctx) {
525 if (!ctx || !ctx->result) {

Callers 1

cbm_doclinks_extractFunction · 0.85

Calls 1

doc_info_ofFunction · 0.85

Tested by

no test coverage detected