mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
This commit is contained in:
parent
5061aeee64
commit
a1aca4c578
@ -318,6 +318,9 @@ fn (mut c Checker) struct_init(mut node ast.StructInit, is_field_zero_struct_ini
|
||||
}
|
||||
}
|
||||
struct_sym := c.table.sym(node.typ)
|
||||
mut old_inside_generic_struct_init := false
|
||||
mut old_cur_struct_generic_types := []ast.Type{}
|
||||
mut old_cur_struct_concrete_types := []ast.Type{}
|
||||
if struct_sym.info is ast.Struct {
|
||||
// check if the generic param types have been defined
|
||||
for ct in struct_sym.info.concrete_types {
|
||||
@ -357,13 +360,16 @@ fn (mut c Checker) struct_init(mut node ast.StructInit, is_field_zero_struct_ini
|
||||
}
|
||||
if struct_sym.info.generic_types.len > 0
|
||||
&& struct_sym.info.generic_types.len == struct_sym.info.concrete_types.len {
|
||||
old_inside_generic_struct_init = c.inside_generic_struct_init
|
||||
old_cur_struct_generic_types = c.cur_struct_generic_types.clone()
|
||||
old_cur_struct_concrete_types = c.cur_struct_concrete_types.clone()
|
||||
c.inside_generic_struct_init = true
|
||||
c.cur_struct_generic_types = struct_sym.info.generic_types.clone()
|
||||
c.cur_struct_concrete_types = struct_sym.info.concrete_types.clone()
|
||||
defer {
|
||||
c.inside_generic_struct_init = false
|
||||
c.cur_struct_generic_types = []
|
||||
c.cur_struct_concrete_types = []
|
||||
c.inside_generic_struct_init = old_inside_generic_struct_init
|
||||
c.cur_struct_generic_types = old_cur_struct_generic_types
|
||||
c.cur_struct_concrete_types = old_cur_struct_concrete_types
|
||||
}
|
||||
}
|
||||
} else if struct_sym.info is ast.Alias {
|
||||
|
@ -7,7 +7,6 @@ struct BloomFilter1[T] {
|
||||
|
||||
[heap]
|
||||
struct BloomFilter2[T] {
|
||||
// TODO V bug
|
||||
hash_func fn (T) u32 = default_cb[T] // hash function, input [T] , output u32
|
||||
table_size int // every entry is one-bit, packed into `table`
|
||||
num_functions int // 1~16
|
||||
|
Loading…
Reference in New Issue
Block a user