unit.ha (431B)
1 // SPDX-License-Identifier: MPL-2.0 2 // (c) Hare authors <https://harelang.org> 3 4 // A sub-unit, typically representing a single source file. 5 export type subunit = struct { 6 imports: []import, 7 decls: []decl, 8 }; 9 10 // Frees resources associated with a [[subunit]]. 11 export fn subunit_finish(u: subunit) void = { 12 imports_finish(u.imports); 13 for (let i = 0z; i < len(u.decls); i += 1) { 14 decl_finish(u.decls[i]); 15 }; 16 free(u.decls); 17 };