Load cannot be namespaced anymore due to weird namespace behaviour that this creates.
I need to add a way to import but force evaluation of everything in the future to make that up.
This commit is contained in:
@@ -233,6 +233,7 @@ resolve_everything_in_module(Ast_Module *module){
|
|||||||
Iter_Named(&module->all_loaded_files, file){
|
Iter_Named(&module->all_loaded_files, file){
|
||||||
For(file.item[0]->decls){
|
For(file.item[0]->decls){
|
||||||
resolve_name(file.item[0], it->pos, it->name);
|
resolve_name(file.item[0], it->pos, it->name);
|
||||||
|
|
||||||
if(it->kind == AST_STRUCT){
|
if(it->kind == AST_STRUCT){
|
||||||
type_complete(it->type_val);
|
type_complete(it->type_val);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -821,11 +821,6 @@ parse_decl(B32 is_global){
|
|||||||
result = parse_enum(tname);
|
result = parse_enum(tname);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(token_match_pound(pctx->intern("load"_s))){
|
|
||||||
Ast_File *file = parse_load(false);
|
|
||||||
result = ast_file_namespace(tname, file, tname->intern_val);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(token_match_pound(pctx->intern("import"_s))){
|
else if(token_match_pound(pctx->intern("import"_s))){
|
||||||
Ast_Module *module = parse_import(false);
|
Ast_Module *module = parse_import(false);
|
||||||
result = ast_module_namespace(tname, module, tname->intern_val);
|
result = ast_module_namespace(tname, module, tname->intern_val);
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ make_scope_search(Arena *arena, Ast_Scope *scope, Intern_String name){
|
|||||||
result.scope_visit_id = ++pctx->scope_visit_id;
|
result.scope_visit_id = ++pctx->scope_visit_id;
|
||||||
result.scopes = {arena};
|
result.scopes = {arena};
|
||||||
result.scopes.add(scope);
|
result.scopes.add(scope);
|
||||||
result.exit_on_find = true;
|
result.exit_on_find = false;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,6 +523,15 @@ resolve_name(Ast_Scope *scope, Token *pos, Intern_String name, Search_Flag searc
|
|||||||
compiler_error(pos, "Unidentified name [%s]", name.str);
|
compiler_error(pos, "Unidentified name [%s]", name.str);
|
||||||
}
|
}
|
||||||
if(search.results.len > 1){
|
if(search.results.len > 1){
|
||||||
|
if(is_flag_set(search.results[0]->flags, AST_OPERATOR_OVERLOAD)){
|
||||||
|
if(is_flag_set(search_flags, RESOLVE_NAME_MAKE_SURE_OPERATOR_OVERLOAD_IS_NOT_EVER_CALLED)){
|
||||||
|
compiler_error(pos, "Internal compiler error: somehow we found %Q which is an operator to be also an identifier and we started resolving it using resolve_name", name);
|
||||||
|
}
|
||||||
|
For(search.results){
|
||||||
|
resolve_decl(it);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
compiler_error(pos, "Found multiple definitions of name [%s]", name.str);
|
compiler_error(pos, "Found multiple definitions of name [%s]", name.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1108,7 +1117,7 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str
|
|||||||
Ast_Scope *scope = field_access_scope ? field_access_scope : node->parent_scope;
|
Ast_Scope *scope = field_access_scope ? field_access_scope : node->parent_scope;
|
||||||
Search_Flag flag = field_access_scope ? SEARCH_ONLY_CURRENT_SCOPE : 0;
|
Search_Flag flag = field_access_scope ? SEARCH_ONLY_CURRENT_SCOPE : 0;
|
||||||
|
|
||||||
Ast_Decl *decl = resolve_name(scope, node->pos, node->intern_val, flag);
|
Ast_Decl *decl = resolve_name(scope, node->pos, node->intern_val, flag | RESOLVE_NAME_MAKE_SURE_OPERATOR_OVERLOAD_IS_NOT_EVER_CALLED);
|
||||||
|
|
||||||
// Substitute lambda alias
|
// Substitute lambda alias
|
||||||
if(decl->kind == AST_CONST && decl->resolved_decl && decl->resolved_decl->kind == AST_LAMBDA){
|
if(decl->kind == AST_CONST && decl->resolved_decl && decl->resolved_decl->kind == AST_LAMBDA){
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ enum{
|
|||||||
typedef U32 Search_Flag;
|
typedef U32 Search_Flag;
|
||||||
enum{
|
enum{
|
||||||
SEARCH_ONLY_CURRENT_SCOPE = bit_flag(1),
|
SEARCH_ONLY_CURRENT_SCOPE = bit_flag(1),
|
||||||
|
RESOLVE_NAME_MAKE_SURE_OPERATOR_OVERLOAD_IS_NOT_EVER_CALLED = bit_flag(2),
|
||||||
};
|
};
|
||||||
|
|
||||||
function Operand resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_context, Ast_Scope *field_access_scope);
|
function Operand resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_context, Ast_Scope *field_access_scope);
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ StringToDouble :: (s: String): F64
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
FormatString :: (buffer: *U8, buffer_len: U64, string: String, args: ..)
|
FormatString :: (buffer: *U8, buffer_len: U64, string: String, args: ..)
|
||||||
|
|
||||||
// @todo(krzosa): Add consideration of buffer SIZE! Add some function to handle this OutStr or something
|
// @todo(krzosa): Add consideration of buffer SIZE! Add some function to handle this OutStr or something
|
||||||
arg_counter := 0
|
arg_counter := 0
|
||||||
out_buffer_len := 0
|
out_buffer_len := 0
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
OS :: #import "Windows.core"
|
|
||||||
#import "Arena.core"
|
#import "Arena.core"
|
||||||
|
OS :: #import "Windows.core"
|
||||||
SizeU :: U64
|
SizeU :: U64
|
||||||
|
|
||||||
ClampTopSizeU :: (val: SizeU, max: SizeU): SizeU
|
ClampTopSizeU :: (val: SizeU, max: SizeU): SizeU
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ https://www.youtube.com/watch?v=NG_mUhc8LRw&list=PLU94OURih-CjrtFuazwZ5GYzTrupOM
|
|||||||
All of his channel is recommended watch for programmers.
|
All of his channel is recommended watch for programmers.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
StartMultimedia :: W32.StartMultimedia
|
|
||||||
UpdateMultimedia :: W32.UpdateMultimedia
|
|
||||||
Mu: MU
|
Mu: MU
|
||||||
|
|
||||||
MU :: struct
|
MU :: struct
|
||||||
@@ -25,7 +23,7 @@ MU :: struct
|
|||||||
quit: Bool
|
quit: Bool
|
||||||
|
|
||||||
frame_arena: Arena
|
frame_arena: Arena
|
||||||
os: W32.OS
|
os: Platform
|
||||||
|
|
||||||
MUWindow :: struct
|
MUWindow :: struct
|
||||||
x: S64
|
x: S64
|
||||||
@@ -61,4 +59,4 @@ Mouse :: struct
|
|||||||
#import "Base.core"
|
#import "Base.core"
|
||||||
#import "Math.core"
|
#import "Math.core"
|
||||||
#import "Arena.core"
|
#import "Arena.core"
|
||||||
W32 :: #load "win32_multimedia.core"
|
#load "win32_multimedia.core"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#import "WINMM.core"
|
#import "WINMM.core"
|
||||||
#import "Windows.core"
|
#import "Windows.core"
|
||||||
|
|
||||||
OS :: struct
|
Platform :: struct
|
||||||
bitmap: Bitmap
|
bitmap: Bitmap
|
||||||
window_dc: HDC
|
window_dc: HDC
|
||||||
window: HWND
|
window: HWND
|
||||||
@@ -130,7 +130,7 @@ StartMultimedia :: (x: S64 = 1280, y: S64 = 720, title: String = "Hello people!"
|
|||||||
Assert(size.x == x && size.y == y)
|
Assert(size.x == x && size.y == y)
|
||||||
|
|
||||||
Mu.os.window_dc = GetDC(Mu.os.window)
|
Mu.os.window_dc = GetDC(Mu.os.window)
|
||||||
Mu.os.bitmap = W32.CreateBitmap(Mu.os.window_dc, size)
|
Mu.os.bitmap = CreateBitmap(Mu.os.window_dc, size)
|
||||||
|
|
||||||
Mu.screen = Mu.os.bitmap.data
|
Mu.screen = Mu.os.bitmap.data
|
||||||
Mu.window.x = size.x
|
Mu.window.x = size.x
|
||||||
|
|||||||
Reference in New Issue
Block a user