summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/typecheck.c8
-rw-r--r--src/analysis/typecheck.h6
2 files changed, 10 insertions, 4 deletions
diff --git a/src/analysis/typecheck.c b/src/analysis/typecheck.c
index e83bb4b..1faff2c 100644
--- a/src/analysis/typecheck.c
+++ b/src/analysis/typecheck.c
@@ -15,7 +15,10 @@ static void tc_error(TypeChecker *tc, Token t, const char *msg)
static void tc_enter_scope(TypeChecker *tc)
{
Scope *s = malloc(sizeof(Scope));
- if (!s) return;
+ if (!s)
+ {
+ return;
+ }
s->symbols = NULL;
s->parent = tc->current_scope;
tc->current_scope = s;
@@ -365,6 +368,9 @@ static void check_node(TypeChecker *tc, ASTNode *node)
case NODE_EXPR_CALL:
check_expr_call(tc, node);
break;
+ case NODE_EXPR_ARRAY_LITERAL:
+ check_node(tc, node->array_literal.elements);
+ break;
default:
// Generic recursion for lists and other nodes.
// Special case for Return to trigger move?
diff --git a/src/analysis/typecheck.h b/src/analysis/typecheck.h
index b690f1d..f141deb 100644
--- a/src/analysis/typecheck.h
+++ b/src/analysis/typecheck.h
@@ -9,7 +9,7 @@
// Unlike the parser, this focuses on semantic validity (types, definitions).
/**
* @brief Type Checker Context.
- *
+ *
* Holds the state during the semantic analysis pass.
* Unlike the parser, this focuses on semantic validity (types, definitions, correctness).
*/
@@ -24,9 +24,9 @@ typedef struct TypeChecker
/**
* @brief Main Type Checking Entry Point.
- *
+ *
* Performs semantic analysis on the entire AST.
- *
+ *
* @param ctx Global parser context.
* @param root Root AST node of the program.
* @return 0 on success (no errors), non-zero if errors occurred.