1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

ast, parser: cleanup of generic structs (#9839)

This commit is contained in:
yuyi
2021-04-22 23:21:01 +08:00
committed by GitHub
parent ba512a6a8e
commit 431d806dcf
8 changed files with 22 additions and 22 deletions

View File

@@ -481,7 +481,7 @@ pub fn (mut p Parser) parse_generic_struct_inst_type(name string) ast.Type {
p.in_generic_params = true
bs_name += '<'
bs_cname += '_T_'
mut generic_types := []ast.Type{}
mut concrete_types := []ast.Type{}
mut is_instance := false
for p.tok.kind != .eof {
gt := p.parse_type()
@@ -491,7 +491,7 @@ pub fn (mut p Parser) parse_generic_struct_inst_type(name string) ast.Type {
gts := p.table.get_type_symbol(gt)
bs_name += gts.name
bs_cname += gts.cname
generic_types << gt
concrete_types << gt
if p.tok.kind != .comma {
break
}
@@ -502,7 +502,7 @@ pub fn (mut p Parser) parse_generic_struct_inst_type(name string) ast.Type {
p.check(.gt)
p.in_generic_params = false
bs_name += '>'
if is_instance && generic_types.len > 0 {
if is_instance && concrete_types.len > 0 {
mut gt_idx := p.table.find_type_idx(bs_name)
if gt_idx > 0 {
return ast.new_type(gt_idx)
@@ -519,7 +519,7 @@ pub fn (mut p Parser) parse_generic_struct_inst_type(name string) ast.Type {
mod: p.mod
info: ast.GenericStructInst{
parent_idx: parent_idx
generic_types: generic_types
concrete_types: concrete_types
}
})
return ast.new_type(idx)

View File

@@ -332,7 +332,7 @@ fn (mut p Parser) struct_decl() ast.StructDecl {
is_union: is_union
attrs: attrs
end_comments: end_comments
gen_types: generic_types
generic_types: generic_types
embeds: embeds
}
}