Adding more resolved info to more calls

This commit is contained in:
Krzosa Karol
2022-06-14 21:45:07 +02:00
parent 7f5471de08
commit 5f9f1b9a63

View File

@@ -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);
}