Working on arrays
This commit is contained in:
13
ccodegen.cpp
13
ccodegen.cpp
@@ -133,7 +133,8 @@ gen_expr(Ast_Expr *ast){
|
||||
else gen(".");
|
||||
gen_expr(node->right);
|
||||
}
|
||||
else if(node->op == TK_ColonAssign){ // @todo: I think this needs to be a stmt
|
||||
else if(node->op == TK_ColonAssign){
|
||||
|
||||
Sym *sym = resolved_get(node);
|
||||
Ast_Atom *atom = (Ast_Atom *)node->left;
|
||||
assert(is_atom(atom));
|
||||
@@ -210,6 +211,8 @@ gen_expr(Ast_Expr *ast){
|
||||
gen("(");
|
||||
auto name_for_printf = (Ast_Atom *)node->name;
|
||||
For(node->exprs){
|
||||
// @special_case @todo in the future this should be replaced
|
||||
// with []Any
|
||||
if(intern_printf == name_for_printf->intern_val && &it == node->exprs.data){
|
||||
Ast_Atom *atom = (Ast_Atom *)it->item;
|
||||
assert(atom->kind == AST_VALUE);
|
||||
@@ -231,7 +234,8 @@ gen_expr(Ast_Expr *ast){
|
||||
|
||||
function void
|
||||
gen_line(Ast *node){
|
||||
genln("#line %d", node->pos->line+1);
|
||||
if(emit_line_directives)
|
||||
genln("#line %d", node->pos->line+1);
|
||||
}
|
||||
|
||||
function void
|
||||
@@ -254,7 +258,8 @@ gen_ast(Ast *ast){
|
||||
switch(ast->kind){
|
||||
|
||||
CASE(PACKAGE, Package){
|
||||
genln("#line 0 \"%s\"", node->name.str);
|
||||
if(emit_line_directives)
|
||||
genln("#line 0 \"%s\"", node->name.str);
|
||||
For(node->ordered) {
|
||||
gen_line(it);
|
||||
genln("");
|
||||
@@ -290,6 +295,8 @@ gen_ast(Ast *ast){
|
||||
gen_simple_decl(sym->type, {});
|
||||
gen("){}");
|
||||
gen("}");
|
||||
} else { // Default zero
|
||||
gen(" = {}");
|
||||
}
|
||||
gen(";");
|
||||
BREAK();
|
||||
|
||||
Reference in New Issue
Block a user