Any semantics, lvalue allocates on stack
This commit is contained in:
@@ -271,13 +271,19 @@ enum {
|
||||
};
|
||||
|
||||
function void
|
||||
gen_pointer_to_lvalue(Ast_Expr *expr){
|
||||
gen("&(");
|
||||
gen_simple_decl(expr->resolved_type);
|
||||
gen(")");
|
||||
gen("{");
|
||||
gen_expr(expr);
|
||||
gen("}");
|
||||
gen_pointer(Ast_Expr *expr){
|
||||
gen("&");
|
||||
if(is_flag_set(expr->flags, AST_IS_LVALUE)){
|
||||
gen_expr(expr);
|
||||
}
|
||||
else{
|
||||
gen("(");
|
||||
gen_simple_decl(expr->resolved_type);
|
||||
gen(")");
|
||||
gen("{");
|
||||
gen_expr(expr);
|
||||
gen("}");
|
||||
}
|
||||
}
|
||||
|
||||
function void
|
||||
@@ -287,7 +293,7 @@ gen_try_any_or_slice(Ast_Expr *expr, Ast_Type *decl_type){
|
||||
// but other then that we shouldn't box other Any values
|
||||
if(expr->kind != AST_COMPOUND && is_any(decl_type) && !is_any(expr->resolved_type)){
|
||||
gen("(Any){");
|
||||
gen_pointer_to_lvalue(expr);
|
||||
gen_pointer(expr);
|
||||
gen(", %d}", expr->resolved_type->type_id);
|
||||
}
|
||||
else if(expr->kind == AST_IDENT && is_slice(decl_type)){
|
||||
|
||||
Reference in New Issue
Block a user