Merge pull request #449 from isc-tdyar/fix/class-lines-zero

fix(extract): Class.lines always 0 for all languages
This commit is contained in:
Martin Vogel
2026-06-25 21:17:35 +02:00
committed by GitHub
2 changed files with 15 additions and 0 deletions
+1
View File
@@ -3323,6 +3323,7 @@ static void extract_class_def(CBMExtractCtx *ctx, TSNode node, const CBMLangSpec
def.file_path = ctx->rel_path;
def.start_line = ts_node_start_point(node).row + TS_LINE_OFFSET;
def.end_line = ts_node_end_point(node).row + TS_LINE_OFFSET;
def.lines = (int)(def.end_line - def.start_line + TS_LINE_OFFSET);
def.is_exported = cbm_is_exported(name, ctx->language);
def.base_classes = extract_base_classes(a, node, ctx->source, ctx->language);
def.decorators = extract_decorators(a, node, ctx->source, ctx->language, spec);
+14
View File
@@ -964,6 +964,19 @@ TEST(tool_qg_defines_method_more_than_10) {
PASS();
}
TEST(tool_qg_class_lines_nonzero) {
double ms;
char *r =
call_tool_timed("query_graph", &ms,
"{\"project\":\"%s\","
"\"query\":\"MATCH (c:Class) WHERE c.lines > 0 RETURN count(c) AS n\"}",
g_project);
TOOL_OK(r, ms);
ASSERT(strstr(r, "\"0\"") == NULL);
free(r);
PASS();
}
TEST(tool_list_projects_has_current) {
double ms;
char *r = call_tool_timed("list_projects", &ms, "{}");
@@ -3105,6 +3118,7 @@ SUITE(incremental) {
RUN_TEST(tool_qg_handles);
RUN_TEST(tool_qg_defines_method);
RUN_TEST(tool_qg_defines_method_more_than_10);
RUN_TEST(tool_qg_class_lines_nonzero);
RUN_TEST(tool_qg_no_limit);
RUN_TEST(tool_qg_empty_result);