parser,markused: support @[markused] for interface declarations too (#24963)

This commit is contained in:
Felipe Pena 2025-07-24 02:14:30 -03:00 committed by GitHub
parent 93a1989b0b
commit 267d8262b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 0 deletions

View File

@ -208,6 +208,7 @@ pub mut:
conversions shared map[int][]Type
// generic interface support
is_generic bool
is_markused bool
generic_types []Type
concrete_types []Type
parent_type Type

View File

@ -169,6 +169,8 @@ pub fn (mut w Walker) mark_markused_syms() {
for sym in w.table.type_symbols {
if sym.info is ast.Struct && sym.info.is_markused {
w.mark_by_sym(sym)
} else if sym.info is ast.Interface && sym.info.is_markused {
w.mark_by_sym(sym)
}
}
}

View File

@ -640,6 +640,7 @@ fn (mut p Parser) interface_decl() ast.InterfaceDecl {
info: ast.Interface{
types: []
is_generic: generic_types.len > 0
is_markused: attrs.contains('markused')
generic_types: generic_types
}
language: language

View File

@ -0,0 +1,7 @@
@[markused]
struct Foo {}
@[markused]
interface Bar {
a Foo
}