Fixing fallout from temporary solution to field access

This commit is contained in:
Krzosa Karol
2022-06-10 19:31:59 +02:00
parent decab135b8
commit 43fe057cf4
4 changed files with 8 additions and 8 deletions

View File

@@ -11,6 +11,7 @@ pointer_type :: *S64
// null_pointer: pointer_type = null
if_stmt :: (cond: S64): type
new_types.basic_type_assignment()
CONSTANT :: 10
thing := 10
if i := thing + cond, cond > CONSTANT

View File

@@ -207,10 +207,7 @@ int main(int argument_count, char **arguments){
printf("%s", result.str);
result = compile_file("enums.kl"_s);
printf("%s", result.str);
result = compile_file("order1.kl"_s);
printf("%s", result.str);
result = compile_file("order2.kl"_s);
printf("%s", result.str);
result = compile_file("new_types.kl"_s);
printf("%s", result.str);
@@ -222,6 +219,7 @@ int main(int argument_count, char **arguments){
files.add("lambdas.kl"_s);
files.add("order1.kl"_s);
files.add("order2.kl"_s);
files.add("new_types.kl"_s);
String result = compile_files(files);
printf("%s", result.str);
__debugbreak();

View File

@@ -60,8 +60,8 @@ binary_test :: (thing: S32 = 442)
basic_type_assignment :: ()
custom_data1 := Custom_Data(thing = 23)
custom_data2: Custom_Data
// custom_data1 := Custom_Data(thing = 23)
// custom_data2: Custom_Data
some_constant :: true
thing: Bool = some_constant
float_val :: 325.42
@@ -80,6 +80,7 @@ for_loops :: ()
for j:=0, j < 10
pass
/*
Custom_Data :: struct
thing: S32
@@ -108,5 +109,5 @@ array_test :: ()
len := get_slice_len(thing)
with_size: [2]Custom_Data
*/
// get_slice_len(with_size)

View File

@@ -662,7 +662,6 @@ resolve_field_access(Ast_Expr *node, Ast_Scope *context){
if(!new_context){
field_access_scope = context;
Operand op = resolve_expr(node, AST_CANT_BE_NULL);
field_access_scope = 0;
if(current) current->type = op.type;
if(is_pointer(op.type)) op.type = op.type->base;
@@ -698,6 +697,7 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags){
scope = field_access_scope;
}
Ast_Decl *decl = resolve_name(scope, node->pos, node->intern_val, flags);
field_access_scope = 0; // @memes
node->resolved_decl = decl;
Operand result = operand(decl);