mirror of
https://github.com/vlang/v.git
synced 2025-09-13 09:25:45 -04:00
cgen,markused: remove unused enum declarations too (#25033)
This commit is contained in:
parent
3b7ada1621
commit
b74e60b5a2
@ -729,6 +729,7 @@ fn (t Tree) enum_decl(node ast.EnumDecl) &Node {
|
||||
obj.add('comments', t.array_node_comment(node.comments))
|
||||
obj.add_terse('attrs', t.array_node_attr(node.attrs))
|
||||
obj.add_terse('typ', t.type_node(node.typ))
|
||||
obj.add_terse('enum_typ', t.type_node(node.enum_typ))
|
||||
return obj
|
||||
}
|
||||
|
||||
|
@ -1475,6 +1475,8 @@ pub:
|
||||
typ Type // the default is `int`; can be changed by `enum Big as u64 { a = 5 }`
|
||||
typ_pos token.Pos
|
||||
pos token.Pos
|
||||
pub mut:
|
||||
enum_typ Type
|
||||
}
|
||||
|
||||
pub struct AliasTypeDecl {
|
||||
|
@ -2161,6 +2161,7 @@ fn (mut c Checker) enum_decl(mut node ast.EnumDecl) {
|
||||
}
|
||||
}
|
||||
}
|
||||
node.enum_typ = c.table.find_type_idx(node.name)
|
||||
}
|
||||
|
||||
fn (mut c Checker) check_enum_field_integer_literal(expr ast.IntegerLiteral, is_signed bool, is_multi_allowed bool,
|
||||
|
@ -4771,7 +4771,7 @@ fn (mut g Gen) enum_decl(node ast.EnumDecl) {
|
||||
}
|
||||
return
|
||||
}
|
||||
if g.pref.skip_unused && node.typ.idx() !in g.table.used_features.used_syms {
|
||||
if g.pref.skip_unused && node.enum_typ !in g.table.used_features.used_syms {
|
||||
return
|
||||
}
|
||||
g.enum_typedefs.writeln('')
|
||||
|
@ -846,7 +846,7 @@ fn (mut w Walker) expr(node_ ast.Expr) {
|
||||
w.expr(filtered[0].expr)
|
||||
}
|
||||
}
|
||||
w.mark_by_sym_name(node.enum_name)
|
||||
w.mark_by_type(node.typ)
|
||||
}
|
||||
ast.LockExpr {
|
||||
w.uses_lock = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user