Generating proper slice name when rewriting tree
This commit is contained in:
16
ccodegen.cpp
16
ccodegen.cpp
@@ -131,6 +131,14 @@ gen_simple_decl(Ast_Type *ast, Intern_String name = {}, Ast_Scope *scope = 0, bo
|
||||
gen("%.*s", (int)string.len, string.str);
|
||||
}
|
||||
|
||||
function String
|
||||
gen_string_simple_decl(Allocator *a, Ast_Type *ast, String name, Ast_Scope *scope, bool scope_names){
|
||||
Scratch scratch;
|
||||
String string = string_simple_decl(scratch, ast, pctx->intern(name), scope, scope_names);
|
||||
String result = string_copy(a, string);
|
||||
return result;
|
||||
}
|
||||
|
||||
function B32
|
||||
gen_value(Value a){
|
||||
B32 result = true;
|
||||
@@ -672,13 +680,7 @@ typedef struct String{
|
||||
#endif
|
||||
For(pctx->ordered_decls){
|
||||
if(it->kind == AST_STRUCT){
|
||||
if(it->type && it->type->kind == TYPE_TYPE && is_slice(it->type_val)){
|
||||
genln("typedef struct struct ");
|
||||
gen_simple_decl(it->type_val);
|
||||
gen(";");
|
||||
} else{
|
||||
genln("typedef struct struct %s;", it->name.str);
|
||||
}
|
||||
genln("typedef struct struct %s;", it->name.str);
|
||||
} else if(it->kind == AST_LAMBDA){
|
||||
genln("");
|
||||
gen_lambda(it->name, it->lambda, false);
|
||||
|
||||
Reference in New Issue
Block a user