mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
fix typo & free memory when skipping empty files
This commit is contained in:
@@ -41,6 +41,7 @@ collect_package :: proc(path: string) -> (pkg: ^ast.Package, success: bool) {
|
|||||||
}
|
}
|
||||||
if strings.trim_space(string(src)) == "" {
|
if strings.trim_space(string(src)) == "" {
|
||||||
delete(fullpath)
|
delete(fullpath)
|
||||||
|
delete(src)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +78,7 @@ parse_package :: proc(pkg: ^ast.Package, p: ^Parser = nil) -> bool {
|
|||||||
ok = false
|
ok = false
|
||||||
}
|
}
|
||||||
if file.pkg_decl == nil {
|
if file.pkg_decl == nil {
|
||||||
error(p, p.curr_tok.pos, "Expected pacakge declaration at the start of the file")
|
error(p, p.curr_tok.pos, "Expected a package declaration at the start of the file")
|
||||||
} else if pkg.name == "" {
|
} else if pkg.name == "" {
|
||||||
pkg.name = file.pkg_decl.name
|
pkg.name = file.pkg_decl.name
|
||||||
} else if pkg.name != file.pkg_decl.name {
|
} else if pkg.name != file.pkg_decl.name {
|
||||||
|
|||||||
Reference in New Issue
Block a user