aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bytecode/bytecode.c1
-rw-r--r--src/compiler.c2
-rw-r--r--src/parser.c9
-rw-r--r--src/std/buffer.c2
4 files changed, 7 insertions, 7 deletions
diff --git a/src/bytecode/bytecode.c b/src/bytecode/bytecode.c
index 8aae03e..6ceacf0 100644
--- a/src/bytecode/bytecode.c
+++ b/src/bytecode/bytecode.c
@@ -1,5 +1,6 @@
#include "../../include/bytecode/bytecode.h"
#include "../../include/std/mem.h"
+#include "../../include/std/log.h"
#include "../../include/ssa/ssa.h"
#include "../../include/parser.h"
#include "../../include/compiler.h"
diff --git a/src/compiler.c b/src/compiler.c
index 2b59a93..9f003c8 100644
--- a/src/compiler.c
+++ b/src/compiler.c
@@ -67,7 +67,7 @@ void amal_compiler_options_init(amal_compiler_options *self) {
int amal_compiler_init(amal_compiler *self, const amal_compiler_options *options) {
int i;
- self->usable_thread_count = options->num_threads;
+ self->usable_thread_count = options ? options->num_threads : 0;
if(self->usable_thread_count == 0) {
self->usable_thread_count = amal_get_usable_thread_count();
if(self->usable_thread_count == 0) {
diff --git a/src/parser.c b/src/parser.c
index c0d2c6d..68d0648 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -296,7 +296,6 @@ static void parser_parse_function_args(Parser *self, FunctionCall *func_call) {
for(;;) {
Ast *arg_expr;
bool is_end_token;
- arg_expr = NULL;
throw_if_error(tokenizer_consume_if(&self->tokenizer, TOK_CLOSING_PAREN, &is_end_token));
if(is_end_token)
@@ -638,7 +637,11 @@ Ast* parser_parse_body(Parser *self) {
lhs_expr = parser_parse_declaration_lhs(self);
if(lhs_expr) {
+ FunctionDecl *func_decl;
+ StructDecl *struct_decl;
+ Import *import;
bool match;
+
throw_if_error(ast_create(self->allocator, lhs_expr, AST_LHS, &result));
if(lhs_expr->is_extern) {
throw_if_error(tokenizer_accept(&self->tokenizer, TOK_SEMICOLON));
@@ -651,10 +654,6 @@ Ast* parser_parse_body(Parser *self) {
throw_if_error(tokenizer_accept(&self->tokenizer, TOK_EQUALS));
- FunctionDecl *func_decl;
- StructDecl *struct_decl;
- Import *import;
-
func_decl = parser_parse_closure(self);
if(func_decl) {
throw_if_error(ast_create(self->allocator, func_decl, AST_FUNCTION_DECL, &lhs_expr->rhs_expr));
diff --git a/src/std/buffer.c b/src/std/buffer.c
index ddf7d39..3676cee 100644
--- a/src/std/buffer.c
+++ b/src/std/buffer.c
@@ -12,7 +12,7 @@ int buffer_init(Buffer *self, struct ScopedAllocator *allocator) {
if(allocator) {
return scoped_allocator_add_mem(allocator, &self->allocator_index);
} else {
- self->allocator_index = ~0ULL;
+ self->allocator_index = ~(usize)0;
return 0;
}
}