Removing polymorph from test

This commit is contained in:
Krzosa Karol
2023-03-31 17:52:10 +02:00
parent 0e01b785f1
commit 61f8c5c825
4 changed files with 11 additions and 4 deletions

View File

@@ -485,6 +485,7 @@ int length(List<T> *list) {
template <class T>
void free_all_nodes(List<T> *list) {
if (list->first == 0) return;
assert(!list->last->next);
assert(!list->first->prev);
list->last->next = list->first_free;

View File

@@ -43,7 +43,7 @@ void next(Ast_Iter *iter) {
For(node->decls) iter->stack.add(it);
} break;
case AST_MODULE: invalid_codepath; break;
case AST_MODULE: break; // This happens when we import stuff
case AST_FILE: invalid_codepath; break;
case AST_IDENT:
@@ -200,8 +200,7 @@ void next(Ast_Iter *iter) {
case AST_LAMBDA_EXPR: {
Ast_Lambda *node = (Ast_Lambda *)ast;
iter->stack.add(node);
iter->stack.add(node->scope);
assert(node->scope);
if (node->scope) iter->stack.add(node->scope);
For(node->ret) iter->stack.add(it);
For(node->args) iter->stack.add(it);
} break;

View File

@@ -938,6 +938,13 @@ try_resolving_lambda_scope(Operand *op, Ast_Lambda *lambda, Ast_Type *lambda_typ
}
*op = operand_lambda(lambda_type);
//
// We remove all declarations to cleanup the scope
// for iteration
//
// If I want to implement :NestedDeclarations
// then probably this will need to get reverted
free_all_nodes(&lambda->scope->decls);
}
else if (is_flag_set(lambda->flags, AST_FOREIGN)) {

View File

@@ -25,6 +25,6 @@ Array :: struct($T: Type)
cap: int
main :: (argc: int, argv: **char): int
array: Array(int)
// array: Array(int)
return 0