Skip to content

Commit

Permalink
change in reflection.v
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 committed Oct 9, 2024
1 parent 7760769 commit 9fad24d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion vlib/v/gen/c/reflection.v
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fn (mut g Gen) gen_reflection_fn(node ast.Fn) string {
// gen_reflection_sym generates C code for TypeSymbol struct
@[inline]
fn (mut g Gen) gen_reflection_sym(tsym ast.TypeSymbol) string {
kind_name := if tsym.kind in [.none_, .struct, .enum_, .interface_] {
kind_name := if tsym.kind in [.none_, .enum_, .interface_] {
tsym.kind.str() + '_'
} else {
tsym.kind.str()
Expand Down
4 changes: 2 additions & 2 deletions vlib/v/reflection/reflection.v
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub enum VKind {
map
chan
any
struct_
struct
generic_inst
multi_return
sum_type
Expand Down Expand Up @@ -258,7 +258,7 @@ pub fn get_funcs() []Function {
}

pub fn get_structs() []Type {
struct_idxs := g_reflection.type_symbols.filter(it.kind == .struct_).map(it.idx)
struct_idxs := g_reflection.type_symbols.filter(it.kind == .struct).map(it.idx)
return g_reflection.types.filter(it.idx in struct_idxs)
}

Expand Down
2 changes: 1 addition & 1 deletion vlib/v/tests/reflection_sym_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn test_enum_sym() {

fn test_struct_sym() {
var := reflection.type_of(Test{})
assert var.sym.kind == .struct_
assert var.sym.kind == .struct
assert (var.sym.info as reflection.Struct).attrs.len == 1
assert (var.sym.info as reflection.Struct).attrs == ['test_struct']

Expand Down

0 comments on commit 9fad24d

Please sign in to comment.