diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-01-28 16:09:06 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-01-28 16:09:06 -0700 |
| commit | 13220ccb51b7d2cf7b8d72a662eece95784116c3 (patch) | |
| tree | 70ee2f007841b3b720d25e64ba9ecb4311080779 /src/ast_render.cpp | |
| parent | ed3117a77fffa424e7f902059a7bf3a52f758bfc (diff) | |
| download | zig-13220ccb51b7d2cf7b8d72a662eece95784116c3.tar.gz zig-13220ccb51b7d2cf7b8d72a662eece95784116c3.zip | |
parsh understands constant sized arrays
Diffstat (limited to 'src/ast_render.cpp')
| -rw-r--r-- | src/ast_render.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/ast_render.cpp b/src/ast_render.cpp index 8ddfe03e34..6c8844aef7 100644 --- a/src/ast_render.cpp +++ b/src/ast_render.cpp @@ -587,7 +587,15 @@ static void render_node(AstRender *ar, AstNode *node) { case NodeTypeUnwrapErrorExpr: zig_panic("TODO"); case NodeTypeNumberLiteral: - zig_panic("TODO"); + switch (node->data.number_literal.kind) { + case NumLitUInt: + fprintf(ar->f, "%" PRIu64, node->data.number_literal.data.x_uint); + break; + case NumLitFloat: + fprintf(ar->f, "%f", node->data.number_literal.data.x_float); + break; + } + break; case NodeTypeStringLiteral: zig_panic("TODO"); case NodeTypeCharLiteral: @@ -682,7 +690,18 @@ static void render_node(AstRender *ar, AstNode *node) { case NodeTypeStructValueField: zig_panic("TODO"); case NodeTypeArrayType: - zig_panic("TODO"); + { + fprintf(ar->f, "["); + if (node->data.array_type.size) { + render_node(ar, node->data.array_type.size); + } + fprintf(ar->f, "]"); + if (node->data.array_type.is_const) { + fprintf(ar->f, "const "); + } + render_node(ar, node->data.array_type.child_type); + break; + } case NodeTypeErrorType: zig_panic("TODO"); } |
