mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: rename table.register_fn_generic_types
to table.register_fn_concrete_types
(#9914)
This commit is contained in:
parent
6945f987cf
commit
25d9272c84
@ -909,7 +909,7 @@ pub fn (t &Table) mktyp(typ Type) Type {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn (mut t Table) register_fn_generic_types(fn_name string, types []Type) {
|
||||
pub fn (mut t Table) register_fn_concrete_types(fn_name string, types []Type) {
|
||||
mut a := t.fn_generic_types[fn_name]
|
||||
if types in a {
|
||||
return
|
||||
|
@ -571,5 +571,5 @@ pub fn (mut c Checker) infer_fn_generic_types(f ast.Fn, mut call_expr ast.CallEx
|
||||
inferred_types << typ
|
||||
call_expr.concrete_types << typ
|
||||
}
|
||||
c.table.register_fn_generic_types(f.name, inferred_types)
|
||||
c.table.register_fn_concrete_types(f.name, inferred_types)
|
||||
}
|
||||
|
@ -1527,7 +1527,7 @@ pub fn (mut c Checker) method_call(mut call_expr ast.CallExpr) ast.Type {
|
||||
}
|
||||
}
|
||||
if has_generic {
|
||||
c.table.register_fn_generic_types(call_expr.name, concrete_types)
|
||||
c.table.register_fn_concrete_types(call_expr.name, concrete_types)
|
||||
}
|
||||
// TODO: remove this for actual methods, use only for compiler magic
|
||||
// FIXME: Argument count != 1 will break these
|
||||
@ -1992,9 +1992,9 @@ pub fn (mut c Checker) fn_call(mut call_expr ast.CallExpr) ast.Type {
|
||||
if has_generic {
|
||||
if c.mod != '' && !fn_name.starts_with('${c.mod}.') {
|
||||
// Need to prepend the module when adding a generic type to a function
|
||||
c.table.register_fn_generic_types(c.mod + '.' + fn_name, concrete_types)
|
||||
c.table.register_fn_concrete_types(c.mod + '.' + fn_name, concrete_types)
|
||||
} else {
|
||||
c.table.register_fn_generic_types(fn_name, concrete_types)
|
||||
c.table.register_fn_concrete_types(fn_name, concrete_types)
|
||||
}
|
||||
}
|
||||
if fn_name == 'json.encode' {
|
||||
|
@ -43,10 +43,10 @@ pub fn (mut p Parser) call_expr(language ast.Language, mod string) ast.CallExpr
|
||||
// In case of `foo<T>()`
|
||||
// T is unwrapped and registered in the checker.
|
||||
full_generic_fn_name := if fn_name.contains('.') { fn_name } else { p.prepend_mod(fn_name) }
|
||||
has_generic_generic := concrete_types.filter(it.has_flag(.generic)).len > 0
|
||||
if !has_generic_generic {
|
||||
has_generic := concrete_types.filter(it.has_flag(.generic)).len > 0
|
||||
if !has_generic {
|
||||
// will be added in checker
|
||||
p.table.register_fn_generic_types(full_generic_fn_name, concrete_types)
|
||||
p.table.register_fn_concrete_types(full_generic_fn_name, concrete_types)
|
||||
}
|
||||
}
|
||||
p.check(.lpar)
|
||||
|
@ -2237,10 +2237,10 @@ fn (mut p Parser) dot_expr(left ast.Expr) ast.Expr {
|
||||
concrete_list_pos = concrete_list_pos.extend(p.prev_tok.position())
|
||||
// In case of `foo<T>()`
|
||||
// T is unwrapped and registered in the checker.
|
||||
has_generic_generic := concrete_types.filter(it.has_flag(.generic)).len > 0
|
||||
if !has_generic_generic {
|
||||
has_generic := concrete_types.filter(it.has_flag(.generic)).len > 0
|
||||
if !has_generic {
|
||||
// will be added in checker
|
||||
p.table.register_fn_generic_types(field_name, concrete_types)
|
||||
p.table.register_fn_concrete_types(field_name, concrete_types)
|
||||
}
|
||||
}
|
||||
if p.tok.kind == .lpar {
|
||||
|
Loading…
Reference in New Issue
Block a user