aboutsummaryrefslogtreecommitdiff
path: root/src/ast_render.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-02-15 23:30:05 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-02-16 16:41:56 -0700
commit77ffb5075bd550893b9f6ac99f151b1d55a8040e (patch)
treed7cde8b3527f2458f216562f42b5957fefc477e9 /src/ast_render.cpp
parent91101f08c24a931e8e0ecbe46d80df759135332c (diff)
downloadzig-77ffb5075bd550893b9f6ac99f151b1d55a8040e.tar.gz
zig-77ffb5075bd550893b9f6ac99f151b1d55a8040e.zip
update bootstrap to work for macos too
* Directives can have arbitrary expressions as parameters * Fix switch statement not generating code sometimes * Rename "main" fn in bootstrap.zig to "zig_user_main" to avoid name collisions * codegen: fix badref when unreachable is last thing in an expression * support #condition directive on exported functions
Diffstat (limited to 'src/ast_render.cpp')
-rw-r--r--src/ast_render.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ast_render.cpp b/src/ast_render.cpp
index a302652eb1..118eee8f2c 100644
--- a/src/ast_render.cpp
+++ b/src/ast_render.cpp
@@ -339,6 +339,7 @@ void ast_print(FILE *f, AstNode *node, int indent) {
break;
case NodeTypeDirective:
fprintf(f, "%s\n", node_type_str(node->type));
+ ast_print(f, node->data.directive.expr, indent + 2);
break;
case NodeTypePrefixOpExpr:
fprintf(f, "%s %s\n", node_type_str(node->type),
@@ -631,8 +632,9 @@ static void render_node(AstRender *ar, AstNode *node) {
fprintf(ar->f, "}");
break;
case NodeTypeDirective:
- fprintf(ar->f, "#%s(\"%s\")\n", buf_ptr(&node->data.directive.name),
- buf_ptr(&node->data.directive.param));
+ fprintf(ar->f, "#%s(", buf_ptr(&node->data.directive.name));
+ render_node(ar, node->data.directive.expr);
+ fprintf(ar->f, ")\n");
break;
case NodeTypeReturnExpr:
zig_panic("TODO");