Skip to content

Commit

Permalink
Fix incorrect check for naked functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Oct 14, 2023
1 parent 89d4c2c commit 80a9842
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/compiler/sema_stmts.c
Original file line number Diff line number Diff line change
Expand Up @@ -3108,7 +3108,7 @@ bool sema_analyse_function_body(SemaContext *context, Decl *func)
while (current)
{
Ast *stmt = ast_next(&current);
if (stmt->ast_kind != AST_ASM_STMT)
if (stmt->ast_kind != AST_ASM_BLOCK_STMT)
{
SEMA_ERROR(stmt, "Only asm statements are allowed inside of a naked function.");
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define COMPILER_VERSION "0.4.680"
#define COMPILER_VERSION "0.4.681"
11 changes: 11 additions & 0 deletions test/test_suite/asm/naked.c3t
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// #target: macos-x64
module testing;
import std::io;

fn void test() @naked @export("hello")
{
asm("nop");
}
fn void main()
{
}

0 comments on commit 80a9842

Please sign in to comment.