Fix spilling imports
This commit is contained in:
1
base.kl
1
base.kl
@@ -1,4 +1,5 @@
|
||||
Windows :: #import "Windows.kl"
|
||||
#import "Windows.kl"
|
||||
|
||||
SizeU :: #strict U64
|
||||
OS_PAGE_SIZE :: 4096
|
||||
|
||||
9
main.kl
9
main.kl
@@ -1,9 +1,8 @@
|
||||
Base :: #load "base.kl"
|
||||
Win :: #load "Windows.kl"
|
||||
#import "base.kl"
|
||||
|
||||
main :: (argc: int, argv: **char): int
|
||||
memory := Base.reserve(size = 10000)
|
||||
handle := Win.GetStdHandle(Win.STD_OUTPUT_HANDLE)
|
||||
memory := reserve(size = 10000)
|
||||
handle := Windows.GetStdHandle(Windows.STD_OUTPUT_HANDLE)
|
||||
|
||||
string: *char = "hello world"
|
||||
Win.WriteConsoleA(handle, string->*void, 11, 0, 0)
|
||||
Windows.WriteConsoleA(handle, string->*void, 11, 0, 0)
|
||||
|
||||
@@ -313,7 +313,7 @@ _rewrite_into_const(Ast *node, U64 ast_size, Value value){
|
||||
}
|
||||
|
||||
function Ast_Decl *
|
||||
_search_for_decl(Ast_Scope *scope, Intern_String name){
|
||||
_search_for_decl(Ast_Scope *scope, Intern_String name, S32 level){
|
||||
For(scope->decls){
|
||||
if(it->name == name){
|
||||
return it;
|
||||
@@ -321,7 +321,9 @@ _search_for_decl(Ast_Scope *scope, Intern_String name){
|
||||
}
|
||||
|
||||
For(scope->implicit_imports){
|
||||
Ast_Decl *result = _search_for_decl(it, name);
|
||||
Ast_Decl *result = 0;
|
||||
if(scope->kind == AST_MODULE && level > 1);
|
||||
else result = _search_for_decl(it, name, level+1);
|
||||
if(result) return result;
|
||||
}
|
||||
|
||||
@@ -332,13 +334,13 @@ function Ast_Decl *
|
||||
search_for_decl(Ast_Scope *scope, Intern_String name, Search_Flag flags = 0){
|
||||
Ast_Decl *result = 0;
|
||||
for(Ast_Scope *it = scope; it; it=it->parent_scope){
|
||||
result = _search_for_decl(it, name);
|
||||
result = _search_for_decl(it, name, 0);
|
||||
if(result) break;
|
||||
if(is_flag_set(flags, SEARCH_ONLY_CURRENT_SCOPE)) break;
|
||||
}
|
||||
|
||||
if(!result && !is_flag_set(flags, SEARCH_ONLY_CURRENT_SCOPE)){
|
||||
result = _search_for_decl(scope->module, name);
|
||||
result = _search_for_decl(scope->module, name, 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user