mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-07 19:14:19 +00:00
Change import lookup
This commit is contained in:
@@ -166,7 +166,7 @@ Allocator :: struct {
|
||||
|
||||
|
||||
Context :: struct {
|
||||
allocator: mem.Allocator,
|
||||
allocator: Allocator,
|
||||
thread_id: int,
|
||||
|
||||
user_data: any,
|
||||
@@ -494,7 +494,7 @@ __dynamic_array_reserve :: proc(array_: rawptr, elem_size, elem_align: int, cap:
|
||||
new_size := cap * elem_size;
|
||||
allocator := array.allocator;
|
||||
|
||||
new_data := allocator.procedure(allocator.data, mem.Allocator_Mode.Resize, new_size, elem_align, array.data, old_size, 0, loc);
|
||||
new_data := allocator.procedure(allocator.data, Allocator_Mode.Resize, new_size, elem_align, array.data, old_size, 0, loc);
|
||||
if new_data == nil do return false;
|
||||
|
||||
array.data = new_data;
|
||||
|
||||
@@ -14,6 +14,7 @@ import "core:strings"
|
||||
import "core:types"
|
||||
import "core:unicode/utf16"
|
||||
import "core:unicode/utf8"
|
||||
import "core:c"
|
||||
|
||||
import "core:atomics"
|
||||
import "core:thread"
|
||||
|
||||
@@ -2583,7 +2583,7 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
|
||||
String entity_name = selector->Ident.token.string;
|
||||
|
||||
check_op_expr = false;
|
||||
entity = scope_lookup_entity(import_scope, entity_name);
|
||||
entity = current_scope_lookup_entity(import_scope, entity_name);
|
||||
bool is_declared = entity != nullptr;
|
||||
if (is_declared) {
|
||||
if (entity->kind == Entity_Builtin) {
|
||||
|
||||
@@ -4366,6 +4366,11 @@ struct ParserThreadWork {
|
||||
isize import_index;
|
||||
};
|
||||
|
||||
void add_shared_package(Parser *p, String name, TokenPos pos, PackageKind kind) {
|
||||
String s = get_fullpath_core(heap_allocator(), name);
|
||||
try_add_import_path(p, s, s, pos, kind);
|
||||
}
|
||||
|
||||
ParseFileError parse_packages(Parser *p, String init_filename) {
|
||||
GB_ASSERT(init_filename.text[init_filename.len] == 0);
|
||||
|
||||
@@ -4384,9 +4389,7 @@ ParseFileError parse_packages(Parser *p, String init_filename) {
|
||||
|
||||
isize shared_package_count = 0;
|
||||
if (!build_context.generate_docs) {
|
||||
String s = get_fullpath_core(heap_allocator(), str_lit("runtime"));
|
||||
try_add_import_path(p, s, s, init_pos, Package_Runtime);
|
||||
shared_package_count++;
|
||||
add_shared_package(p, str_lit("runtime"), init_pos, Package_Runtime); shared_package_count++;
|
||||
}
|
||||
|
||||
array_add(&p->imports, init_imported_package);
|
||||
|
||||
Reference in New Issue
Block a user