unit.ha (697B)
1 // SPDX-License-Identifier: MPL-2.0 2 // (c) Hare authors <https://harelang.org> 3 4 use hare::ast; 5 use hare::lex; 6 use hare::types; 7 8 9 // A function declaration. 10 export type decl_func = struct { 11 symbol: str, 12 ident: ast::ident, 13 prototype: const *types::_type, 14 body: nullable *expr, 15 attrs: ast::fndecl_attr, 16 }; 17 18 // A declaration within a unit. 19 export type decl = struct { 20 exported: bool, 21 start: lex::location, 22 end: lex::location, 23 decl: (decl_func | void), // TODO: Other decl types 24 }; 25 26 // A single compilation unit, representing all of the members of a namespace. 27 export type unit = struct { 28 ident: ast::ident, 29 decls: []decl, 30 }; 31 32 export fn unit_finish(unit: unit) void = { 33 // TODO 34 return; 35 };