diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-11-10 21:58:05 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-11-11 13:11:58 -0500 |
| commit | 5b279434986b18d07ceec217c5c402a589ccc0b4 (patch) | |
| tree | eac7bb2993f594bb5471633a92671d9b63833b27 /src/ast_render.cpp | |
| parent | de30438ed2efb909538f3177cced441b57eb1a5d (diff) | |
| download | zig-5b279434986b18d07ceec217c5c402a589ccc0b4.tar.gz zig-5b279434986b18d07ceec217c5c402a589ccc0b4.zip | |
implement anon struct literal syntax
This implements stage1 parser support for anonymous struct literal
syntax (see #685), as well as semantic analysis support for anonymous
struct literals and anonymous list literals (see #208). The semantic
analysis works when there is a type coercion in the result location;
inferring the struct type based on the values in the literal is not
implemented yet. Also remaining to do is zig fmt support for this new
syntax and documentation updates.
Diffstat (limited to 'src/ast_render.cpp')
| -rw-r--r-- | src/ast_render.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ast_render.cpp b/src/ast_render.cpp index c016f629d1..34cbed245a 100644 --- a/src/ast_render.cpp +++ b/src/ast_render.cpp @@ -821,7 +821,9 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) { break; } case NodeTypeContainerInitExpr: - render_node_ungrouped(ar, node->data.container_init_expr.type); + if (node->data.container_init_expr.type != nullptr) { + render_node_ungrouped(ar, node->data.container_init_expr.type); + } if (node->data.container_init_expr.kind == ContainerInitKindStruct) { fprintf(ar->f, "{\n"); ar->indent += ar->indent_size; |
