all: rename generic_struct_inst to generic_inst (#11044)
parent
c13ba6d4b6
commit
815c4b7420
vlib/v
|
@ -16,7 +16,7 @@ import v.pref
|
|||
|
||||
pub type Type = int
|
||||
|
||||
pub type TypeInfo = Aggregate | Alias | Array | ArrayFixed | Chan | Enum | FnType | GenericStructInst |
|
||||
pub type TypeInfo = Aggregate | Alias | Array | ArrayFixed | Chan | Enum | FnType | GenericInst |
|
||||
Interface | Map | MultiReturn | Struct | SumType | Thread
|
||||
|
||||
pub enum Language {
|
||||
|
@ -517,7 +517,7 @@ pub enum Kind {
|
|||
chan
|
||||
any
|
||||
struct_
|
||||
generic_struct_inst
|
||||
generic_inst
|
||||
multi_return
|
||||
sum_type
|
||||
alias
|
||||
|
@ -750,7 +750,7 @@ pub fn (k Kind) str() string {
|
|||
.any { 'any' }
|
||||
.function { 'function' }
|
||||
.interface_ { 'interface' }
|
||||
.generic_struct_inst { 'generic_struct_inst' }
|
||||
.generic_inst { 'generic_inst' }
|
||||
.rune { 'rune' }
|
||||
.aggregate { 'aggregate' }
|
||||
.thread { 'thread' }
|
||||
|
@ -785,7 +785,7 @@ pub mut:
|
|||
}
|
||||
|
||||
// instantiation of a generic struct
|
||||
pub struct GenericStructInst {
|
||||
pub struct GenericInst {
|
||||
pub mut:
|
||||
parent_idx int // idx of the base generic struct
|
||||
concrete_types []Type // concrete types, e.g. <int, string>
|
||||
|
@ -1030,8 +1030,8 @@ pub fn (t &Table) type_to_str_using_aliases(typ Type, import_aliases map[string]
|
|||
res = t.shorten_user_defined_typenames(res, import_aliases)
|
||||
}
|
||||
}
|
||||
.generic_struct_inst {
|
||||
info := sym.info as GenericStructInst
|
||||
.generic_inst {
|
||||
info := sym.info as GenericInst
|
||||
res = sym.name.all_before('<')
|
||||
res += '<'
|
||||
for i, ctyp in info.concrete_types {
|
||||
|
|
|
@ -793,8 +793,8 @@ fn (mut c Checker) unwrap_generic_type(typ ast.Type, generic_names []string, con
|
|||
// generic struct instantiations to concrete types
|
||||
pub fn (mut c Checker) generic_insts_to_concrete() {
|
||||
for mut typ in c.table.type_symbols {
|
||||
if typ.kind == .generic_struct_inst {
|
||||
info := typ.info as ast.GenericStructInst
|
||||
if typ.kind == .generic_inst {
|
||||
info := typ.info as ast.GenericInst
|
||||
parent := c.table.type_symbols[info.parent_idx]
|
||||
if parent.kind == .placeholder {
|
||||
typ.kind = .placeholder
|
||||
|
|
|
@ -171,7 +171,7 @@ pub fn (mut g JsGen) typ(t ast.Type) string {
|
|||
.struct_ {
|
||||
styp = g.struct_typ(sym.name)
|
||||
}
|
||||
.generic_struct_inst {}
|
||||
.generic_inst {}
|
||||
// 'multi_return_int_int' => '[number, number]'
|
||||
.multi_return {
|
||||
info := sym.info as ast.MultiReturn
|
||||
|
|
|
@ -912,8 +912,9 @@ fn (mut p Parser) fn_args() ([]ast.Param, bool, bool) {
|
|||
|
||||
fn (mut p Parser) check_fn_mutable_arguments(typ ast.Type, pos token.Position) {
|
||||
sym := p.table.get_type_symbol(typ)
|
||||
if sym.kind in [.array, .array_fixed, .interface_, .map, .placeholder, .struct_,
|
||||
.generic_struct_inst, .sum_type] {
|
||||
if sym.kind in [.array, .array_fixed, .interface_, .map, .placeholder, .struct_, .generic_inst,
|
||||
.sum_type,
|
||||
] {
|
||||
return
|
||||
}
|
||||
if typ.is_ptr() || typ.is_pointer() {
|
||||
|
|
|
@ -562,11 +562,11 @@ pub fn (mut p Parser) parse_generic_struct_inst_type(name string) ast.Type {
|
|||
parent_idx = p.table.add_placeholder_type(name, .v)
|
||||
}
|
||||
idx := p.table.register_type_symbol(ast.TypeSymbol{
|
||||
kind: .generic_struct_inst
|
||||
kind: .generic_inst
|
||||
name: bs_name
|
||||
cname: util.no_dots(bs_cname)
|
||||
mod: p.mod
|
||||
info: ast.GenericStructInst{
|
||||
info: ast.GenericInst{
|
||||
parent_idx: parent_idx
|
||||
concrete_types: concrete_types
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue