commit 2d510dc987174f1e7ffaa2590e1b4d1f2485e367
parent f800d506743ae4faa3a17e9f40c02f66cb1a4855
Author: Sebastian <sebastian@sebsite.pw>
Date: Sat, 9 Dec 2023 21:13:20 -0500
hare::parse: disallow mixing @init, @fini, and @test
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/hare/parse/decl.ha b/hare/parse/decl.ha
@@ -137,6 +137,8 @@ fn decl_func(lexer: *lex::lexer) (ast::decl_func | error) = {
case void =>
break;
case let t: lex::token =>
+ synassert(t.2, t.0 == ltok::ATTR_SYMBOL || attr == 0,
+ "Only one of @init, @fini, or @test may be provided")?;
switch (t.0) {
case ltok::ATTR_FINI =>
attr = ast::fndecl_attr::FINI;