mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-13 06:41:26 -07:00
Fix Scoping of proc type decls
This commit is contained in:
@@ -101,7 +101,6 @@ struct Scope {
|
||||
Scope *prev, *next;
|
||||
Scope *first_child, *last_child;
|
||||
Map<Entity *> elements; // Key: String
|
||||
gbArray(AstNode *) deferred_stmts;
|
||||
};
|
||||
|
||||
enum ExpressionKind {
|
||||
@@ -196,7 +195,6 @@ Scope *make_scope(Scope *parent, gbAllocator allocator) {
|
||||
Scope *s = gb_alloc_item(allocator, Scope);
|
||||
s->parent = parent;
|
||||
map_init(&s->elements, gb_heap_allocator());
|
||||
gb_array_init(s->deferred_stmts, gb_heap_allocator());
|
||||
if (parent != NULL && parent != universal_scope) {
|
||||
DLIST_APPEND(parent->first_child, parent->last_child, s);
|
||||
}
|
||||
@@ -513,12 +511,6 @@ void check_procedure_later(Checker *c, AstFile *file, Token token, DeclInfo *dec
|
||||
gb_array_append(c->procs, info);
|
||||
}
|
||||
|
||||
void check_add_deferred_stmt(Checker *c, AstNode *stmt) {
|
||||
GB_ASSERT(stmt != NULL);
|
||||
GB_ASSERT(is_ast_node_stmt(stmt));
|
||||
gb_array_append(c->context.scope->deferred_stmts, stmt);
|
||||
}
|
||||
|
||||
void push_procedure(Checker *c, Type *type) {
|
||||
gb_array_append(c->proc_stack, type);
|
||||
}
|
||||
|
||||
@@ -409,7 +409,10 @@ Type *check_type(Checker *c, AstNode *e, Type *named_type) {
|
||||
case_ast_node(pt, ProcType, e);
|
||||
type = alloc_type(c->allocator, Type_Proc);
|
||||
set_base_type(named_type, type);
|
||||
CheckerContext context = c->context;
|
||||
c->context.scope = make_scope(c->context.scope, c->allocator);
|
||||
check_procedure_type(c, type, e);
|
||||
c->context = context;
|
||||
goto end;
|
||||
case_end;
|
||||
|
||||
|
||||
@@ -737,7 +737,6 @@ void check_stmt(Checker *c, AstNode *node, u32 flags) {
|
||||
c->in_defer = true;
|
||||
check_stmt(c, ds->stmt, 0);
|
||||
c->in_defer = out_in_defer;
|
||||
check_add_deferred_stmt(c, ds->stmt);
|
||||
}
|
||||
case_end;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user