@@ -721,11 +721,6 @@ static bool cbm_source_nesting_exceeds(const char *source, int source_len, int c
721721 return false;
722722}
723723
724- static CBMFileResult * cbm_extract_file_impl (const char * source , int source_len ,
725- CBMLanguage language , const char * project ,
726- const char * rel_path , int64_t timeout_micros ,
727- const char * * extra_defines , const char * * include_paths );
728-
729724/* Best-effort parse-coverage collection (#963). Walks only the has_error paths
730725 * of the tree and records the 1-based line ranges of the TOP-MOST ERROR/MISSING
731726 * nodes (does not descend into an error subtree — one range per failed region).
@@ -886,17 +881,17 @@ static const char *cbm_error_ranges_str(CBMArena *a, const cbm_error_regions_t *
886881CBMFileResult * cbm_extract_file (const char * source , int source_len , CBMLanguage language ,
887882 const char * project , const char * rel_path , int64_t timeout_micros ,
888883 const char * * extra_defines , const char * * include_paths ) {
889- CBMFileResult * r = cbm_extract_file_impl ( source , source_len , language , project , rel_path ,
890- timeout_micros , extra_defines , include_paths );
891- cbm_index_mark_done ( rel_path );
884+ CBMFileResult * r =
885+ cbm_extract_file_ex ( source , source_len , language , project , rel_path , timeout_micros ,
886+ extra_defines , include_paths , NULL , NULL );
892887 return r ;
893888}
894889
895- static CBMFileResult * cbm_extract_file_impl (const char * source , int source_len ,
896- CBMLanguage language , const char * project ,
897- const char * rel_path , int64_t timeout_micros ,
898- const char * * extra_defines ,
899- const char * * include_paths ) {
890+ CBMFileResult * cbm_extract_file_ex (const char * source , int source_len , CBMLanguage language ,
891+ const char * project , const char * rel_path ,
892+ int64_t timeout_micros , const char * * extra_defines ,
893+ const char * * include_paths , const CBMMacroTable * macro_table ,
894+ const CBMReturnTypeTable * return_type_table ) {
900895 // Allocate result on heap (arena inside for all string data)
901896 enum { SINGLE = 1 };
902897 CBMFileResult * result = (CBMFileResult * )calloc (SINGLE , sizeof (CBMFileResult ));
@@ -926,6 +921,7 @@ static CBMFileResult *cbm_extract_file_impl(const char *source, int source_len,
926921 if (!spec ) {
927922 result -> has_error = true;
928923 result -> error_msg = cbm_arena_strdup (a , "unsupported language" );
924+ cbm_index_mark_done (rel_path );
929925 return result ;
930926 }
931927
@@ -934,6 +930,7 @@ static CBMFileResult *cbm_extract_file_impl(const char *source, int source_len,
934930 if (!ts_lang ) {
935931 result -> has_error = true;
936932 result -> error_msg = cbm_arena_strdup (a , "no tree-sitter grammar" );
933+ cbm_index_mark_done (rel_path );
937934 return result ;
938935 }
939936
@@ -953,6 +950,7 @@ static CBMFileResult *cbm_extract_file_impl(const char *source, int source_len,
953950 if (!parser ) {
954951 result -> has_error = true;
955952 result -> error_msg = cbm_arena_strdup (a , "parser alloc failed" );
953+ cbm_index_mark_done (rel_path );
956954 return result ;
957955 }
958956
@@ -985,6 +983,7 @@ static CBMFileResult *cbm_extract_file_impl(const char *source, int source_len,
985983 result -> has_error = true;
986984 result -> error_msg =
987985 cbm_arena_strdup (a , timeout_micros > 0 ? "parse timeout" : "parse failed" );
986+ cbm_index_mark_done (rel_path );
988987 return result ;
989988 }
990989
@@ -1009,6 +1008,8 @@ static CBMFileResult *cbm_extract_file_impl(const char *source, int source_len,
10091008 .rel_path = rel_path ,
10101009 .module_qn = result -> module_qn ,
10111010 .root = root ,
1011+ .macro_table = macro_table ,
1012+ .return_type_table = return_type_table ,
10121013 };
10131014
10141015 // Run extractors: defs + imports use separate walks (unique recursion patterns),
@@ -1318,6 +1319,7 @@ static CBMFileResult *cbm_extract_file_impl(const char *source, int source_len,
13181319 // Retain tree for cross-file LSP reuse (caller frees via cbm_free_tree)
13191320 result -> cached_tree = tree ;
13201321 result -> cached_lang = language ;
1322+ cbm_index_mark_done (rel_path );
13211323 return result ;
13221324}
13231325
0 commit comments