mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Fix variable dependency ordering issues caused by procedure literals
This commit is contained in:
+15
-8
@@ -1190,17 +1190,24 @@ void check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *decl, Type *ty
|
|||||||
|
|
||||||
check_scope_usage(ctx->checker, ctx->scope);
|
check_scope_usage(ctx->checker, ctx->scope);
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (decl->parent != nullptr) {
|
if (decl->parent != nullptr) {
|
||||||
// NOTE(bill): Add the dependencies from the procedure literal (lambda)
|
Scope *ps = decl->parent->scope;
|
||||||
for_array(i, decl->deps.entries) {
|
if (ps->flags & (ScopeFlag_File & ScopeFlag_Pkg & ScopeFlag_Global)) {
|
||||||
Entity *e = decl->deps.entries[i].ptr;
|
return;
|
||||||
ptr_set_add(&decl->parent->deps, e);
|
} else {
|
||||||
}
|
// NOTE(bill): Add the dependencies from the procedure literal (lambda)
|
||||||
for_array(i, decl->type_info_deps.entries) {
|
for_array(i, decl->deps.entries) {
|
||||||
Type *t = decl->type_info_deps.entries[i].ptr;
|
Entity *e = decl->deps.entries[i].ptr;
|
||||||
ptr_set_add(&decl->parent->type_info_deps, t);
|
ptr_set_add(&decl->parent->deps, e);
|
||||||
|
}
|
||||||
|
for_array(i, decl->type_info_deps.entries) {
|
||||||
|
Type *t = decl->type_info_deps.entries[i].ptr;
|
||||||
|
ptr_set_add(&decl->parent->type_info_deps, t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -4864,7 +4864,7 @@ isize add_dependencies_from_unpacking(CheckerContext *c, Entity **lhs, isize lhs
|
|||||||
c->decl = decl; // will be reset by the 'defer' any way
|
c->decl = decl; // will be reset by the 'defer' any way
|
||||||
for_array(k, decl->deps.entries) {
|
for_array(k, decl->deps.entries) {
|
||||||
Entity *dep = decl->deps.entries[k].ptr;
|
Entity *dep = decl->deps.entries[k].ptr;
|
||||||
add_declaration_dependency(c, dep); // TODO(bill): Should this be here?
|
add_declaration_dependency(c, dep); // TODO(bill): Should this be here?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6519,6 +6519,7 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
|
|||||||
decl = make_decl_info(ctx.allocator, ctx.scope, ctx.decl);
|
decl = make_decl_info(ctx.allocator, ctx.scope, ctx.decl);
|
||||||
decl->proc_lit = node;
|
decl->proc_lit = node;
|
||||||
ctx.decl = decl;
|
ctx.decl = decl;
|
||||||
|
defer (ctx.decl = ctx.decl->parent);
|
||||||
|
|
||||||
if (pl->tags != 0) {
|
if (pl->tags != 0) {
|
||||||
error(node, "A procedure literal cannot have tags");
|
error(node, "A procedure literal cannot have tags");
|
||||||
|
|||||||
@@ -1445,6 +1445,14 @@ void add_min_dep_type_info(Checker *c, Type *t) {
|
|||||||
add_min_dep_type_info(c, t_type_info_float);
|
add_min_dep_type_info(c, t_type_info_float);
|
||||||
add_min_dep_type_info(c, t_f64);
|
add_min_dep_type_info(c, t_f64);
|
||||||
break;
|
break;
|
||||||
|
case Basic_quaternion128:
|
||||||
|
add_min_dep_type_info(c, t_type_info_float);
|
||||||
|
add_min_dep_type_info(c, t_f32);
|
||||||
|
break;
|
||||||
|
case Basic_quaternion256:
|
||||||
|
add_min_dep_type_info(c, t_type_info_float);
|
||||||
|
add_min_dep_type_info(c, t_f64);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1779,6 +1787,7 @@ Array<EntityGraphNode *> generate_entity_dependency_graph(CheckerInfo *info) {
|
|||||||
EntityGraphNode *n = G[i];
|
EntityGraphNode *n = G[i];
|
||||||
n->index = i;
|
n->index = i;
|
||||||
n->dep_count = n->succ.entries.count;
|
n->dep_count = n->succ.entries.count;
|
||||||
|
|
||||||
GB_ASSERT(n->dep_count >= 0);
|
GB_ASSERT(n->dep_count >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user