Fix invalid pointer in struct type, more work on calls

This commit is contained in:
Krzosa Karol
2022-05-30 11:20:00 +02:00
parent 671853287a
commit b2d3e9d8e1
4 changed files with 17 additions and 5 deletions

View File

@@ -391,6 +391,7 @@ resolve_expr(Ast_Expr *ast, Ast_Resolved_Type *expected_type, Sym *const_sym){
Ast_Resolved_Type *resolved = type->func.args[i];
Ast_Lambda_Arg *arg = it[0];
// @note: match any in list of call items, if none matched then we have a problem
// there are three kinds of possible matches: indexed, named, default
S64 default_iter = 0;
@@ -411,10 +412,12 @@ resolve_expr(Ast_Expr *ast, Ast_Resolved_Type *expected_type, Sym *const_sym){
if(op.int_val == i) item = expr[0];
}
else if(node->exprs.get_index(expr) == default_iter){
// @todo might feel janky
default_iter++;
item = expr[0];
}
else{
parsing_error(expr[0]->pos, "Positional argument after named or indexed argument");
}
if(item) break;
}
@@ -642,7 +645,7 @@ parse_file(){
sym->kind = SYM_CONST;
Ast_Struct *s = const_try_getting_struct(decl);
if(s){
s->type = type_incomplete(decl);
s->type = type_incomplete(s);
sym->type_val = s->type;
sym->type = type_type;
sym->state = SYM_RESOLVED;