Fixing bugs with strings

This commit is contained in:
Krzosa Karol
2022-09-27 10:12:36 +02:00
parent 5c61e159c7
commit 4f51749787
5 changed files with 136 additions and 78 deletions

View File

@@ -302,9 +302,8 @@ gen_expr(Ast_Expr *ast, Ast_Type *type_of_var){
CASE(INDEX, Index){
gen("(");
gen_expr(node->expr);
if(is_string(node->resolved_type)){
if(!(type_of_var && type_of_var == type_pointer_to_char))
gen(".str");
if(node->index_original_type == type_string){
gen(".str");
}
else if(is_slice(node->index_original_type)){
gen(".data");