mirror of
https://github.com/vlang/v.git
synced 2025-08-04 02:07:28 -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
|
conversions shared map[int][]Type
|
||||||
// generic interface support
|
// generic interface support
|
||||||
is_generic bool
|
is_generic bool
|
||||||
|
is_markused bool
|
||||||
generic_types []Type
|
generic_types []Type
|
||||||
concrete_types []Type
|
concrete_types []Type
|
||||||
parent_type Type
|
parent_type Type
|
||||||
|
@ -169,6 +169,8 @@ pub fn (mut w Walker) mark_markused_syms() {
|
|||||||
for sym in w.table.type_symbols {
|
for sym in w.table.type_symbols {
|
||||||
if sym.info is ast.Struct && sym.info.is_markused {
|
if sym.info is ast.Struct && sym.info.is_markused {
|
||||||
w.mark_by_sym(sym)
|
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{
|
info: ast.Interface{
|
||||||
types: []
|
types: []
|
||||||
is_generic: generic_types.len > 0
|
is_generic: generic_types.len > 0
|
||||||
|
is_markused: attrs.contains('markused')
|
||||||
generic_types: generic_types
|
generic_types: generic_types
|
||||||
}
|
}
|
||||||
language: language
|
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