From 77ffb5075bd550893b9f6ac99f151b1d55a8040e Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 15 Feb 2016 23:30:05 -0700 Subject: 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 --- src/ast_render.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ast_render.cpp') 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"); -- cgit v1.2.3