checker: fix global fn calls
							parent
							
								
									72c12b6735
								
							
						
					
					
						commit
						7458927593
					
				| 
						 | 
					@ -28,12 +28,14 @@ pub fn (s &Scope) free() {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
pub fn new_scope(parent &Scope, start_pos int) &Scope {
 | 
					pub fn new_scope(parent &Scope, start_pos int) &Scope {
 | 
				
			||||||
	return &Scope{
 | 
						return &Scope{
 | 
				
			||||||
		parent: parent
 | 
							parent: parent
 | 
				
			||||||
		start_pos: start_pos
 | 
							start_pos: start_pos
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn (s &Scope) dont_lookup_parent() bool {
 | 
					fn (s &Scope) dont_lookup_parent() bool {
 | 
				
			||||||
	return isnil(s.parent) || s.detached_from_parent
 | 
						return isnil(s.parent) || s.detached_from_parent
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2407,6 +2407,15 @@ pub fn (mut c Checker) fn_call(mut call_expr ast.CallExpr) ast.Type {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						// global fn?
 | 
				
			||||||
 | 
						if !found {
 | 
				
			||||||
 | 
							if obj := c.file.global_scope.find(fn_name) {
 | 
				
			||||||
 | 
								sym := c.table.get_type_symbol(obj.typ)
 | 
				
			||||||
 | 
								if sym.kind == .function {
 | 
				
			||||||
 | 
									found = true
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if !found {
 | 
						if !found {
 | 
				
			||||||
		c.error('unknown function: $fn_name', call_expr.pos)
 | 
							c.error('unknown function: $fn_name', call_expr.pos)
 | 
				
			||||||
		return ast.void_type
 | 
							return ast.void_type
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue