Emitting proper lines and files, coding in the language!
This commit is contained in:
15
ccodegen.cpp
15
ccodegen.cpp
@@ -13,10 +13,16 @@ gen_indent(){
|
||||
for(S32 i = 0; i < global_indent; i++) gen(" ");
|
||||
}
|
||||
|
||||
global Intern_String last_filename;
|
||||
function void
|
||||
gen_line(Ast *node){
|
||||
if(emit_line_directives)
|
||||
if(emit_line_directives){
|
||||
genln("#line %d", node->pos->line+1);
|
||||
if(node->pos->file != last_filename){
|
||||
last_filename = node->pos->file;
|
||||
gen(" \"%s\"", last_filename.str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function String
|
||||
@@ -415,6 +421,8 @@ gen_ast(Ast *ast){
|
||||
}
|
||||
|
||||
CASE(LAMBDA, Decl){
|
||||
gen_line(node);
|
||||
genln("");
|
||||
if(is_flag_set(node->expr->flags, AST_FOREIGN)){
|
||||
gen("/*foreign*/");
|
||||
}
|
||||
@@ -662,11 +670,6 @@ typedef S32 Bool;
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
typedef struct Slice{
|
||||
S64 len;
|
||||
void *data;
|
||||
}Slice;
|
||||
|
||||
typedef struct String{
|
||||
U8 *str;
|
||||
S64 len;
|
||||
|
||||
Reference in New Issue
Block a user