AST_INT, AST_STR to AST_VALUE
This commit is contained in:
12
ccodegen.cpp
12
ccodegen.cpp
@@ -82,13 +82,11 @@ gen_expr(Ast_Expr *ast){
|
||||
BREAK();
|
||||
}
|
||||
|
||||
CASE(INT, Atom){
|
||||
gen("%lld", node->int_val);
|
||||
BREAK();
|
||||
}
|
||||
|
||||
CASE(STR, Atom){
|
||||
gen("LIT(\"%s\")", node->intern_val.str);
|
||||
CASE(VALUE, Atom){
|
||||
if(is_int(node->type)) gen("%lld", node->int_val);
|
||||
else if(is_string(node->type)) gen("LIT(\"%s\")", node->intern_val.str);
|
||||
else if(is_bool(node->type)) node->bool_val ? gen("true"):gen("false");
|
||||
else invalid_codepath;
|
||||
BREAK();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user