Fix wrong type on Type type, heh

This commit is contained in:
Krzosa Karol
2022-09-28 09:58:21 +02:00
parent 313e14b300
commit 1fa5e1a26b
2 changed files with 6 additions and 13 deletions

View File

@@ -49,15 +49,6 @@ unique_name(Allocator *allocator, Ast *ast){
return result;
}
// @todo: Gen complicated decl
//array 10 ( pointer (pointer array 5 int a))
// int (*(*(a[5])))[10]
//
// 1 Get to the bottom
// 2 Add variable name
// 3 Going backwards add arrays and pointers in parens
// 4 Add type name on the left side
function String
string_simple_decl_prefix(Allocator *a, Ast_Type *ast){
switch(ast->kind){
@@ -200,7 +191,9 @@ gen_value(Token *pos, Value a){
case TYPE_STRING:
gen("(String){(U8 *)\"%Q\", %d}", a.intern_val, a.intern_val.len);
break;
CASE_BOOL: a.bool_val ? gen("true"):gen("false"); break;
CASE_BOOL: {
a.bool_val ? gen("true"):gen("false");
}break;
CASE_FLOAT: {
String postfix = get_type_postfix(type);
gen("%f%Q", a.f64_val, postfix);

View File

@@ -138,7 +138,7 @@ const SizeU pointer_align = __alignof(SizeU);
global Ast_Type type__void = {TYPE_VOID};
global Ast_Type type__string = {TYPE_STRING, sizeof(String), __alignof(String)};
global Ast_Type type__bool = {TYPE_BOOL, sizeof(bool), __alignof(bool)};
global Ast_Type type__type = {TYPE_TYPE, sizeof(U32), __alignof(U32)};
global Ast_Type type__type = {TYPE_TYPE, sizeof(S64), __alignof(S64)};
global Ast_Type type__f32 = {TYPE_F32, sizeof(F32), __alignof(F32)};
global Ast_Type type__f64 = {TYPE_F64, sizeof(F64), __alignof(F64)};