Printf is working !!
This commit is contained in:
10
ccodegen.cpp
10
ccodegen.cpp
@@ -180,8 +180,12 @@ gen_expr(Ast_Expr *ast){
|
||||
else{
|
||||
gen_expr(node->name);
|
||||
gen("(");
|
||||
auto name_for_printf = (Ast_Atom *)node->name;
|
||||
For(node->exprs){
|
||||
gen_expr(it->item);
|
||||
if(intern_printf == name_for_printf->intern_val && &it == node->exprs.data){
|
||||
gen("\"%s\"", name_for_printf->intern_val.str);
|
||||
}
|
||||
else gen_expr(it->item);
|
||||
if(!node->exprs.is_last(&it)) gen(", ");
|
||||
}
|
||||
gen(")");
|
||||
@@ -310,6 +314,9 @@ gen_ast(Ast *ast){
|
||||
|
||||
case TYPE_LAMBDA:{
|
||||
if(node->value->kind == AST_LAMBDA){
|
||||
if(is_flag_set(node->flags, AST_FOREIGN)){
|
||||
return;
|
||||
}
|
||||
Ast_Lambda *lambda = (Ast_Lambda *)node->value;
|
||||
Ast_Resolved_Type *ret = resolved_type_get(lambda->ret);
|
||||
gen_simple_decl(ret, node->name);
|
||||
@@ -419,6 +426,7 @@ compile_string(String filecontent, String filename = "default_name"_s){
|
||||
|
||||
gen(R"==(
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
typedef int8_t S8;
|
||||
typedef int16_t S16;
|
||||
typedef int32_t S32;
|
||||
|
||||
Reference in New Issue
Block a user