checker: optimize if & fix typo
							parent
							
								
									e0fcd565d5
								
							
						
					
					
						commit
						2480cce1ed
					
				| 
						 | 
					@ -1025,7 +1025,7 @@ pub fn (mut c Checker) call_fn(mut call_expr ast.CallExpr) table.Type {
 | 
				
			||||||
		found = true
 | 
							found = true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// 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('.') && call_expr.mod !in ['builtin'] {
 | 
						else if !fn_name.contains('.') && call_expr.mod !in ['builtin'] {
 | 
				
			||||||
		name_prefixed := '${call_expr.mod}.$fn_name'
 | 
							name_prefixed := '${call_expr.mod}.$fn_name'
 | 
				
			||||||
		if f1 := c.table.find_fn(name_prefixed) {
 | 
							if f1 := c.table.find_fn(name_prefixed) {
 | 
				
			||||||
			call_expr.name = name_prefixed
 | 
								call_expr.name = name_prefixed
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -168,7 +168,7 @@ pub fn (mut p Parser) expr(precedence int) ast.Expr {
 | 
				
			||||||
			node = p.anon_fn()
 | 
								node = p.anon_fn()
 | 
				
			||||||
			// its a call
 | 
								// its a call
 | 
				
			||||||
			// NOTE: this could be moved to just before the pratt loop
 | 
								// 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
 | 
								// but this would take a bit of modification
 | 
				
			||||||
			if p.tok.kind == .lpar {
 | 
								if p.tok.kind == .lpar {
 | 
				
			||||||
				p.next()
 | 
									p.next()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue