mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
parser,markused: support @[markused]
for interface declarations too (#24963)
This commit is contained in:
parent
93a1989b0b
commit
267d8262b3
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
7
vlib/v/tests/skip_unused/interface_struct_unused.vv
Normal file
7
vlib/v/tests/skip_unused/interface_struct_unused.vv
Normal file
@ -0,0 +1,7 @@
|
||||
@[markused]
|
||||
struct Foo {}
|
||||
|
||||
@[markused]
|
||||
interface Bar {
|
||||
a Foo
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user