checker: optimize if & fix typo

pull/5733/head
joe-conigliaro 2020-07-08 01:36:48 +10:00
parent e0fcd565d5
commit 2480cce1ed
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1
2 changed files with 2 additions and 2 deletions

View File

@ -1025,7 +1025,7 @@ pub fn (mut c Checker) call_fn(mut call_expr ast.CallExpr) table.Type {
found = true
}
// try prefix with current module as it would have never gotten prefixed
if !fn_name.contains('.') && call_expr.mod !in ['builtin'] {
else if !fn_name.contains('.') && call_expr.mod !in ['builtin'] {
name_prefixed := '${call_expr.mod}.$fn_name'
if f1 := c.table.find_fn(name_prefixed) {
call_expr.name = name_prefixed

View File

@ -168,7 +168,7 @@ pub fn (mut p Parser) expr(precedence int) ast.Expr {
node = p.anon_fn()
// its a call
// NOTE: this could be moved to just before the pratt loop
// then anything can be a call, eg. `index[2]()` or `stuct.field()`
// then anything can be a call, eg. `index[2]()` or `struct.field()`
// but this would take a bit of modification
if p.tok.kind == .lpar {
p.next()