Restructuring

This commit is contained in:
Krzosa Karol
2022-09-29 13:21:04 +02:00
parent 7cc01be358
commit a447d66015
2 changed files with 17 additions and 18 deletions

View File

@@ -275,7 +275,6 @@ type_lambda(Ast *ast, Array<Ast_Type *> return_vals, Array<Ast_Type *> args){
return result;
}
function Ast_Type *
type_enum(Ast_Decl *ast, Ast_Type *type){
if(!type){
@@ -691,13 +690,6 @@ try_converting_untyped_to_default_type(Operand *op){
try_converting_untyped_to_default_type(&op->value);
}
typedef U32 Typecheck_Flag;
enum {
TYPE_AND_EXPR_REQUIRED = 0,
TYPE_CAN_BE_NULL = 1,
EXPR_CAN_BE_NULL = 2
};
function void
make_sure_value_is_compatible_with_type(Token *pos, Operand *expr, Ast_Type *type, Typecheck_Flag debug_flag){
if(type == expr->type){
@@ -755,16 +747,6 @@ _rewrite_into_const(Ast *node, U64 ast_size, Value value){
ast->resolved_type = value.type;
}
struct Scope_Search {
Array<Ast_Decl *> results;
Intern_String name;
Ast_Scope *scope;
bool exit_on_find;
bool search_only_current_scope;
U32 scope_visit_id;
};
function void
inside_scope_search(Scope_Search *search, Ast_Scope *scope, int level){
if(scope->visit_id == search->scope_visit_id) return;

View File

@@ -7,6 +7,23 @@ struct Operand{
U8 pound_strict: 1;
};
struct Scope_Search {
Array<Ast_Decl *> results;
Intern_String name;
Ast_Scope *scope;
bool exit_on_find;
bool search_only_current_scope;
U32 scope_visit_id;
};
typedef U32 Typecheck_Flag;
enum {
TYPE_AND_EXPR_REQUIRED = 0,
TYPE_CAN_BE_NULL = 1,
EXPR_CAN_BE_NULL = 2
};
typedef U32 Resolve_Flag;
enum{
AST_CANT_BE_NULL = bit_flag(0),