@@ -2550,7 +2550,7 @@ static const char **extract_base_classes(CBMArena *a, TSNode node, const char *s
25502550 }
25512551 // Languages whose heritage is not exposed via a tree-sitter field need
25522552 // dedicated walkers; the generic field/keyword path mis-captures them.
2553- if (lang == CBM_LANG_TYPESCRIPT || lang == CBM_LANG_TSX ) {
2553+ if (lang == CBM_LANG_TYPESCRIPT || lang == CBM_LANG_TSX || lang == CBM_LANG_ARKTS ) {
25542554 const char * * ts_result = extract_ts_bases (a , node , source );
25552555 if (ts_result ) {
25562556 return ts_result ;
@@ -3097,7 +3097,7 @@ static char *resolve_param_type_text(CBMArena *a, TSNode param, const char *sour
30973097 return ts_node_is_null (typename ) ? NULL : cbm_node_text (a , typename , source );
30983098 }
30993099
3100- if (lang == CBM_LANG_TYPESCRIPT || lang == CBM_LANG_TSX ) {
3100+ if (lang == CBM_LANG_TYPESCRIPT || lang == CBM_LANG_TSX || lang == CBM_LANG_ARKTS ) {
31013101 if (strcmp (pk , "required_parameter" ) == 0 || strcmp (pk , "optional_parameter" ) == 0 ) {
31023102 return extract_ts_param_type (a , param , source );
31033103 }
@@ -3230,7 +3230,7 @@ static bool is_signature_implicit_receiver(CBMArena *a, TSNode param, const char
32303230 return true;
32313231 }
32323232
3233- if (lang == CBM_LANG_TYPESCRIPT || lang == CBM_LANG_TSX ) {
3233+ if (lang == CBM_LANG_TYPESCRIPT || lang == CBM_LANG_TSX || lang == CBM_LANG_ARKTS ) {
32343234 char * name = signature_receiver_name (a , param , source , false);
32353235 return name && strcmp (name , "this" ) == 0 ;
32363236 }
@@ -3658,7 +3658,7 @@ static void extract_func_def(CBMExtractCtx *ctx, TSNode node, const CBMLangSpec
36583658 if (ctx -> enclosing_class_qn &&
36593659 (ctx -> language == CBM_LANG_CPP || ctx -> language == CBM_LANG_CUDA ||
36603660 ctx -> language == CBM_LANG_TYPESCRIPT || ctx -> language == CBM_LANG_TSX ||
3661- ctx -> language == CBM_LANG_NIX )) {
3661+ ctx -> language == CBM_LANG_ARKTS || ctx -> language == CBM_LANG_NIX )) {
36623662 def .qualified_name = cbm_arena_sprintf (a , "%s.%s" , ctx -> enclosing_class_qn , qn_name );
36633663 }
36643664 def .label = "Function" ;
@@ -3792,7 +3792,7 @@ static void extract_func_def(CBMExtractCtx *ctx, TSNode node, const CBMLangSpec
37923792
37933793 // JS/TS export detection
37943794 if (ctx -> language == CBM_LANG_JAVASCRIPT || ctx -> language == CBM_LANG_TYPESCRIPT ||
3795- ctx -> language == CBM_LANG_TSX ) {
3795+ ctx -> language == CBM_LANG_TSX || ctx -> language == CBM_LANG_ARKTS ) {
37963796 if (is_js_exported (node )) {
37973797 def .is_entry_point = true;
37983798 }
@@ -4395,16 +4395,17 @@ static void extract_class_def(CBMExtractCtx *ctx, TSNode node, const CBMLangSpec
43954395 label = "Interface" ;
43964396 }
43974397 }
4398- // Rust/Swift/D: a struct is a distinct kind from a class — emit the precise
4399- // "Struct" label rather than collapsing it to "Class". Scoped to these three
4400- // grammar/LSP languages. Rust's struct node is `struct_item`; D's is
4401- // `struct_declaration`. C/C++/Obj-C keep `struct_specifier` → "Class"
4402- // (a C++ struct is class-like). "Struct" is a type-like container: every
4403- // type-resolution / registry / IMPLEMENTS / LSP-registrar consumer routes
4404- // through cbm_label_is_type_like(), so a struct still resolves as a type for
4405- // its methods, fields, inheritance and impls.
4398+ // Rust/Swift/D/ArkTS: a struct is a distinct kind from a class — emit the
4399+ // precise "Struct" label rather than collapsing it to "Class". Scoped to
4400+ // these grammar/LSP languages. Rust's struct node is `struct_item`; D's and
4401+ // ArkTS's is `struct_declaration` (an ArkUI @Component custom component).
4402+ // C/C++/Obj-C keep `struct_specifier` → "Class" (a C++ struct is
4403+ // class-like). "Struct" is a type-like container: every type-resolution /
4404+ // registry / IMPLEMENTS / LSP-registrar consumer routes through
4405+ // cbm_label_is_type_like(), so a struct still resolves as a type for its
4406+ // methods, fields, inheritance and impls.
44064407 if (ctx -> language == CBM_LANG_RUST || ctx -> language == CBM_LANG_SWIFT ||
4407- ctx -> language == CBM_LANG_DLANG ) {
4408+ ctx -> language == CBM_LANG_DLANG || ctx -> language == CBM_LANG_ARKTS ) {
44084409 if (strcmp (kind , "struct_item" ) == 0 || strcmp (kind , "struct_declaration" ) == 0 ) {
44094410 label = "Struct" ;
44104411 }
@@ -5492,6 +5493,7 @@ static void extract_vars_mainstream(CBMExtractCtx *ctx, TSNode node, CBMArena *a
54925493 case CBM_LANG_JAVASCRIPT :
54935494 case CBM_LANG_TYPESCRIPT :
54945495 case CBM_LANG_TSX :
5496+ case CBM_LANG_ARKTS :
54955497 extract_js_vars (ctx , node , a );
54965498 break ;
54975499 case CBM_LANG_JAVA : {
@@ -5988,6 +5990,7 @@ static void extract_var_names(CBMExtractCtx *ctx, TSNode node, const CBMLangSpec
59885990 case CBM_LANG_JAVASCRIPT :
59895991 case CBM_LANG_TYPESCRIPT :
59905992 case CBM_LANG_TSX :
5993+ case CBM_LANG_ARKTS :
59915994 case CBM_LANG_JAVA :
59925995 case CBM_LANG_CSHARP :
59935996 case CBM_LANG_CPP :
@@ -6683,6 +6686,10 @@ static void extract_class_fields(CBMExtractCtx *ctx, TSNode class_node, const ch
66836686 def .start_line = ts_node_start_point (child ).row + TS_LINE_OFFSET ;
66846687 def .end_line = ts_node_end_point (child ).row + TS_LINE_OFFSET ;
66856688 def .is_exported = cbm_is_exported (name , ctx -> language );
6689+ /* Field decorators/annotations (ArkTS @State/@Prop/@Link state members,
6690+ * TS @Input()-style fields, JVM field annotations via the modifiers
6691+ * child) — same extraction the class and method paths already run. */
6692+ def .decorators = extract_decorators (a , child , ctx -> source , ctx -> language , spec );
66866693
66876694 cbm_defs_push (& ctx -> result -> defs , a , def );
66886695 }
@@ -7481,7 +7488,8 @@ static void walk_defs(CBMExtractCtx *ctx, TSNode root, const CBMLangSpec *spec,
74817488 bool descend_into_func =
74827489 (ctx -> language == CBM_LANG_WOLFRAM || ctx -> language == CBM_LANG_TYPESCRIPT ||
74837490 ctx -> language == CBM_LANG_JAVASCRIPT || ctx -> language == CBM_LANG_TSX ||
7484- ctx -> language == CBM_LANG_ADA || ctx -> language == CBM_LANG_NIX );
7491+ ctx -> language == CBM_LANG_ARKTS || ctx -> language == CBM_LANG_ADA ||
7492+ ctx -> language == CBM_LANG_NIX );
74857493 if (!descend_into_func ) {
74867494 continue ;
74877495 }
@@ -7501,7 +7509,8 @@ static void walk_defs(CBMExtractCtx *ctx, TSNode root, const CBMLangSpec *spec,
75017509 * the class/func paths on the namespace node itself. */
75027510 if (is_namespace_scope_kind (ctx -> language , kind , node )) {
75037511 const char * new_enclosing = compute_class_qn (ctx , node , frame .enclosing_class_qn );
7504- if (ctx -> language == CBM_LANG_TYPESCRIPT || ctx -> language == CBM_LANG_TSX ) {
7512+ if (ctx -> language == CBM_LANG_TYPESCRIPT || ctx -> language == CBM_LANG_TSX ||
7513+ ctx -> language == CBM_LANG_ARKTS ) {
75057514 extract_typescript_namespace_def (ctx , node , frame .enclosing_class_qn );
75067515 }
75077516 wd_push_children_reverse (& s , node , new_enclosing );
0 commit comments