mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
Disable all cyclic importations
This commit is contained in:
@@ -138,8 +138,6 @@ arena_allocator :: proc(arena: ^Arena) -> Allocator {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
import "core:fmt.odin";
|
|
||||||
|
|
||||||
arena_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
|
arena_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
|
||||||
size, alignment: int,
|
size, alignment: int,
|
||||||
old_memory: rawptr, old_size: int, flags: u64, location := #caller_location) -> rawptr {
|
old_memory: rawptr, old_size: int, flags: u64, location := #caller_location) -> rawptr {
|
||||||
|
|||||||
+8
-5
@@ -388,7 +388,7 @@ int import_graph_node_cmp(ImportGraphNode **data, isize i, isize j) {
|
|||||||
bool xg = x->scope->is_global;
|
bool xg = x->scope->is_global;
|
||||||
bool yg = y->scope->is_global;
|
bool yg = y->scope->is_global;
|
||||||
if (xg != yg) return xg ? -1 : +1;
|
if (xg != yg) return xg ? -1 : +1;
|
||||||
if (xg && yg) return x->file_id < y->file_id ? -1 : +1;
|
if (xg && yg) return x->file_id < y->file_id ? +1 : -1;
|
||||||
if (x->dep_count < y->dep_count) return -1;
|
if (x->dep_count < y->dep_count) return -1;
|
||||||
if (x->dep_count > y->dep_count) return +1;
|
if (x->dep_count > y->dep_count) return +1;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2634,6 +2634,7 @@ void add_import_dependency_node(Checker *c, AstNode *decl, Map<ImportGraphNode *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Array<ImportGraphNode *> generate_import_dependency_graph(Checker *c) {
|
Array<ImportGraphNode *> generate_import_dependency_graph(Checker *c) {
|
||||||
gbAllocator a = heap_allocator();
|
gbAllocator a = heap_allocator();
|
||||||
|
|
||||||
@@ -2700,7 +2701,10 @@ Array<ImportPathItem> find_import_path(Checker *c, Scope *start, Scope *end, Ptr
|
|||||||
AstNode *decl = f->imports_and_exports[i];
|
AstNode *decl = f->imports_and_exports[i];
|
||||||
if (decl->kind == AstNode_ExportDecl) {
|
if (decl->kind == AstNode_ExportDecl) {
|
||||||
s = decl->ExportDecl.file->scope;
|
s = decl->ExportDecl.file->scope;
|
||||||
} else if (decl->kind == AstNode_ImportDecl && decl->ImportDecl.is_using) {
|
} else if (decl->kind == AstNode_ImportDecl) {
|
||||||
|
if (!decl->ImportDecl.is_using) {
|
||||||
|
// continue;
|
||||||
|
}
|
||||||
s = decl->ImportDecl.file->scope;
|
s = decl->ImportDecl.file->scope;
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
@@ -3136,13 +3140,12 @@ void check_import_entities(Checker *c) {
|
|||||||
}
|
}
|
||||||
error(item.decl, "'%.*s'", LIT(filename));
|
error(item.decl, "'%.*s'", LIT(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for_array(i, n->pred.entries) {
|
for_array(i, n->pred.entries) {
|
||||||
ImportGraphNode *p = n->pred.entries[i].ptr;
|
ImportGraphNode *p = n->pred.entries[i].ptr;
|
||||||
// p->dep_count = gb_max(p->dep_count-1, 0);
|
p->dep_count = gb_max(p->dep_count-1, 0);
|
||||||
p->dep_count -= 1;
|
// p->dep_count -= 1;
|
||||||
priority_queue_fix(&pq, p->index);
|
priority_queue_fix(&pq, p->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user