v: update resovled call expr name

pull/3944/head
Joe Conigliaro 2020-03-07 01:02:40 +11:00
parent 89cbe76193
commit db22bc579a
1 changed files with 5 additions and 3 deletions

View File

@ -166,7 +166,7 @@ fn (c mut Checker) assign_expr(assign_expr ast.AssignExpr) {
} }
} }
pub fn (c mut Checker) call_expr(call_expr ast.CallExpr) table.Type { pub fn (c mut Checker) call_expr(call_expr mut ast.CallExpr) table.Type {
fn_name := call_expr.name fn_name := call_expr.name
// TODO: impl typeof properly (probably not going to be a fn call) // TODO: impl typeof properly (probably not going to be a fn call)
if fn_name == 'typeof' { if fn_name == 'typeof' {
@ -188,7 +188,9 @@ pub fn (c mut Checker) call_expr(call_expr ast.CallExpr) table.Type {
mut found := false mut found := false
// try prefix with current module as it would have never gotten prefixed // try prefix with current module as it would have never gotten prefixed
if !fn_name.contains('.') && !(c.file.mod.name in ['builtin', 'main']) { if !fn_name.contains('.') && !(c.file.mod.name in ['builtin', 'main']) {
if f1 := c.table.find_fn('${c.file.mod.name}.$fn_name') { name_prefixed := '${c.file.mod.name}.$fn_name'
if f1 := c.table.find_fn(name_prefixed) {
call_expr.name = name_prefixed
found = true found = true
f = f1 f = f1
} }
@ -543,7 +545,7 @@ pub fn (c mut Checker) expr(node ast.Expr) table.Type {
return it.typ return it.typ
} }
ast.CallExpr { ast.CallExpr {
return c.call_expr(it) return c.call_expr(mut it)
} }
ast.CharLiteral { ast.CharLiteral {
return table.byte_type return table.byte_type