File: unit.ha

package info (click to toggle)
hare-update 0.26.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,044 kB
  • sloc: makefile: 37; sh: 14
file content (17 lines) | stat: -rw-r--r-- 431 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// SPDX-License-Identifier: MPL-2.0
// (c) Hare authors <https://harelang.org>

// A sub-unit, typically representing a single source file.
export type subunit = struct {
	imports: []import,
	decls: []decl,
};

// Frees resources associated with a [[subunit]].
export fn subunit_finish(u: subunit) void = {
	imports_finish(u.imports);
	for (let i = 0z; i < len(u.decls); i += 1) {
		decl_finish(u.decls[i]);
	};
	free(u.decls);
};