ability to set global variable alignment and ...

..section in the initialization expression
This commit is contained in:
Andrew Kelley
2017-02-04 10:22:07 -05:00
parent 67b02326f8
commit 0919ea0afd
7 changed files with 38 additions and 34 deletions

View File

@@ -628,6 +628,7 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) {
if (entry->type == NodeTypeStructValueField) {
Buf *name = entry->data.struct_val_field.name;
AstNode *expr = entry->data.struct_val_field.expr;
print_indent(ar);
fprintf(ar->f, ".%s = ", buf_ptr(name));
render_node_grouped(ar, expr);
fprintf(ar->f, ",\n");
@@ -637,10 +638,11 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) {
render_node_grouped(ar, entry);
}
}
fprintf(ar->f, "}");
if (node->data.container_init_expr.kind == ContainerInitKindStruct) {
ar->indent -= ar->indent_size;
}
print_indent(ar);
fprintf(ar->f, "}");
break;
case NodeTypeArrayType:
{