Skip to content

Commit cb7cb44

Browse files
fix(extract): skip Go blank-identifier struct fields
Signed-off-by: Ilya Brykau <ilya.brykau@orca.security>
1 parent 47116b8 commit cb7cb44

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎internal/cbm/extract_defs.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6962,6 +6962,13 @@ static void extract_class_fields(CBMExtractCtx *ctx, TSNode class_node, const ch
69626962
continue;
69636963
}
69646964

6965+
/* Go: `_` is the blank identifier, used for explicit struct padding in
6966+
* generated code. It is not a referenceable field, and emitting it gives
6967+
* every `_` in the repository a same-named node to collide with. */
6968+
if (ctx->language == CBM_LANG_GO && strcmp(name, "_") == 0) {
6969+
continue;
6970+
}
6971+
69656972
const char *field_qn = cbm_arena_sprintf(a, "%s.%s", class_qn, name);
69666973

69676974
CBMDefinition def;

0 commit comments

Comments
 (0)