From 8d56cd69d565ad32467281dd36fd33ec48f32f61 Mon Sep 17 00:00:00 2001 From: A404M Date: Sat, 22 Mar 2025 21:08:34 +0330 Subject: some reordering --- src/compiler/ast-tree.c | 10 +++++----- src/compiler/parser.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/compiler/ast-tree.c b/src/compiler/ast-tree.c index 890d159..111265f 100644 --- a/src/compiler/ast-tree.c +++ b/src/compiler/ast-tree.c @@ -1176,11 +1176,6 @@ AstTree *astTreeParseFunction(ParserNode *parserNode, AstTreeHelper *p_helper) { .globalDeps = p_helper->globalDeps, }; - if ((function->returnType = - astTreeParse(node_metadata->returnType, &helper)) == NULL) { - goto RETURN_ERROR; - } - for (size_t i = 0; i < node_arguments->size; ++i) { ParserNode *arg = node_arguments->data[i]; if (arg->token == PARSER_TOKEN_SYMBOL_COMMA) { @@ -1212,6 +1207,11 @@ AstTree *astTreeParseFunction(ParserNode *parserNode, AstTreeHelper *p_helper) { } } + if ((function->returnType = + astTreeParse(node_metadata->returnType, &helper)) == NULL) { + goto RETURN_ERROR; + } + for (size_t i = 0; i < body->size; ++i) { ParserNode *node = body->data[i]; switch (node->token) { diff --git a/src/compiler/parser.c b/src/compiler/parser.c index 08f262c..9d77462 100644 --- a/src/compiler/parser.c +++ b/src/compiler/parser.c @@ -146,7 +146,7 @@ static constexpr ParserOrder PARSER_ORDER[] = { }, { .ltr = false, - ORDER_ARRAY(LEXER_TOKEN_KEYWORD_IF,LEXER_TOKEN_KEYWORD_WHILE, ), + ORDER_ARRAY(LEXER_TOKEN_KEYWORD_IF, LEXER_TOKEN_KEYWORD_WHILE, ), }, }; -- cgit v1.2.3