checker: a minor optimization in file_has_main_fn() (#10143)

pull/10161/head
yuyi 2021-05-21 11:14:57 +08:00 committed by GitHub
parent d8cf26aaba
commit 87ded1784e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -204,7 +204,7 @@ pub fn (mut c Checker) check_files(ast_files []ast.File) {
for {
for file in ast_files {
if file.generic_fns.len > 0 {
c.change_current_file(file)
c.change_current_file(&file)
c.post_process_generic_fns()
}
}
@ -253,7 +253,7 @@ pub fn (mut c Checker) check_files(ast_files []ast.File) {
// do checks specific to files in main module
// returns `true` if a main function is in the file
fn (mut c Checker) file_has_main_fn(file ast.File) bool {
fn (mut c Checker) file_has_main_fn(file &ast.File) bool {
mut has_main_fn := false
for stmt in file.stmts {
if stmt is ast.FnDecl {