summaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/parser.c b/src/parser.c
index 593f75a..b956c4e 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
+#include "ast.h"
#include "lexer.h"
#include "parser.h"
@@ -92,9 +93,7 @@ parser_parse_return_stmt(parser_t *parser)
char number_as_str[number_token.value.size];
string_view_to_str(&number_token.value, number_as_str);
- return (ast_return_stmt_t) {
- .number = atoi(number_as_str)
- };
+ return ast_return_stmt_create(atoi(number_as_str));
}
ast_function_t
@@ -106,9 +105,9 @@ parser_parse_function(parser_t *parser)
expected_token(parser, TOKEN_COLON);
type_t return_type = parser_parse_type(parser);
- return (ast_function_t) {
- .name = func_name_token.value,
- .return_type = return_type,
- .body = parser_parse_return_stmt(parser)
- };
+ return ast_function_create(
+ func_name_token.value,
+ return_type,
+ parser_parse_return_stmt(parser)
+ );
}