Rename AST structures to Tree and relocate freeing logic

This commit is contained in:
2026-04-30 21:46:15 +02:00
parent ea55dedd07
commit 177fb971e4
17 changed files with 162 additions and 153 deletions
+11 -11
View File
@@ -14,7 +14,7 @@ static void test_parser_bad_import_name(void) {
}
static void test_parser_imports(void) {
Module* m = test_get_ast();
ModuleTree* m = test_get_ast();
assert_not_null(m, "expected module to be parsed");
assert_str("my_module", m->name, "expected name 'my_module'");
@@ -26,7 +26,7 @@ static void test_parser_imports(void) {
}
static void test_parser_public_imports(void) {
Module* m = test_get_ast();
ModuleTree* m = test_get_ast();
assert_not_null(m, "expected module to be parsed");
assert_str("my_module", m->name, "expected name 'my_module'");
@@ -38,49 +38,49 @@ static void test_parser_public_imports(void) {
}
static void test_parser_alias_simple(void) {
Module* m = test_get_ast();
ModuleTree* m = test_get_ast();
assert_not_null(m, "expected module to be parsed");
assert_int(1, (int)m->alias_count, "expected correct number of aliases");
AliasDeclaration alias = m->aliases[0];
AliasTree alias = m->aliases[0];
assert_str("myalias", alias.name, "expected correct alias name");
}
static void test_parser_variable_simple(void) {
Module* m = test_get_ast();
ModuleTree* m = test_get_ast();
assert_not_null(m, "expected module to be parsed");
assert_int(1, (int)m->variable_count, "expected correct number of variables");
VariableDeclaration var = m->variables[0];
VariableTree var = m->variables[0];
assert_str("my_var", var.name, "expected correct variable name");
assert_false(var.is_const, "expected not const");
assert_false(var.is_static, "expected not static");
}
static void test_parser_variable_const(void) {
Module* m = test_get_ast();
ModuleTree* m = test_get_ast();
assert_not_null(m, "expected module to be parsed");
assert_int(1, (int)m->variable_count, "expected correct number of variables");
VariableDeclaration var = m->variables[0];
VariableTree var = m->variables[0];
assert_str("my_const", var.name, "expected correct variable name");
assert_true(var.is_const, "expected const");
assert_false(var.is_static, "expected not static");
}
static void test_parser_variable_static(void) {
Module* m = test_get_ast();
ModuleTree* m = test_get_ast();
assert_not_null(m, "expected module to be parsed");
assert_int(1, (int)m->variable_count, "expected correct number of variables");
VariableDeclaration var = m->variables[0];
VariableTree var = m->variables[0];
assert_str("my_static", var.name, "expected correct variable name");
assert_false(var.is_const, "expected not const");
assert_true(var.is_static, "expected static");
}
static void test_parser_multiple_vars(void) {
Module* m = test_get_ast();
ModuleTree* m = test_get_ast();
assert_not_null(m, "expected module to be parsed");
assert_int(2, (int)m->variable_count, "expected correct number of variables");