From 5f9f1b9a630a58d37a8c66bc2a2fa39aa6a25985 Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Tue, 14 Jun 2022 21:45:07 +0200 Subject: [PATCH] Adding more resolved info to more calls --- typechecking.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/typechecking.cpp b/typechecking.cpp index b1ad869..8f84d7c 100644 --- a/typechecking.cpp +++ b/typechecking.cpp @@ -582,15 +582,17 @@ resolve_compound_array(Ast_Call *node, Ast_Type *type){ if(i >= size) compiler_error(it->pos, "Index %lld is out of range of array of size %lld", i, size); - + it->resolved_index = i; } else{ if(default_counter == -1) compiler_error(it->pos, "Mixing expicit indexes and default is illegal"); + it->resolved_index = default_counter; } Operand item = resolve_expr(it->item, AST_CANT_BE_NULL); make_sure_value_is_compatible_with_type(it->pos, &item, item_type, TYPE_AND_EXPR_REQUIRED); + it->resolved_type = item_type; } } @@ -963,12 +965,16 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_context){ set_flag(item->flags, AST_ITEM_INCLUDED); Operand expr = resolve_expr(item->item, AST_CANT_BE_NULL, lambda_arg->type); make_sure_value_is_compatible_with_type(item->pos, &expr, lambda_arg->type, TYPE_AND_EXPR_REQUIRED); + item->resolved_type = lambda_arg->type; + item->resolved_index = lambda->args.get_index(&lambda_arg); items.add(item); } else{ // @note: default values are typechecked when they get resolved if(lambda_arg->expr){ Ast_Call_Item *call_item = ast_call_item(lambda_arg->expr->pos, 0, 0, lambda_arg->expr); + call_item->resolved_type = lambda_arg->expr->resolved_type; + call_item->resolved_index = lambda->args.get_index(&lambda_arg); set_flag(call_item->flags, AST_ITEM_INCLUDED); items.add(call_item); }