simple unconditional defer support

See #110
This commit is contained in:
Andrew Kelley
2016-02-06 00:56:01 -07:00
parent 6a2ede5a6e
commit ec33e5a638
8 changed files with 103 additions and 75 deletions

View File

@@ -122,8 +122,8 @@ static const char *node_type_str(NodeType node_type) {
return "Directive";
case NodeTypeReturnExpr:
return "ReturnExpr";
case NodeTypeDeferExpr:
return "DeferExpr";
case NodeTypeDefer:
return "Defer";
case NodeTypeVariableDeclaration:
return "VariableDeclaration";
case NodeTypeTypeDecl:
@@ -261,12 +261,12 @@ void ast_print(FILE *f, AstNode *node, int indent) {
ast_print(f, node->data.return_expr.expr, indent + 2);
break;
}
case NodeTypeDeferExpr:
case NodeTypeDefer:
{
const char *prefix_str = return_prefix_str(node->data.defer_expr.kind);
const char *prefix_str = return_prefix_str(node->data.defer.kind);
fprintf(f, "%s%s\n", prefix_str, node_type_str(node->type));
if (node->data.defer_expr.expr)
ast_print(f, node->data.defer_expr.expr, indent + 2);
if (node->data.defer.expr)
ast_print(f, node->data.defer.expr, indent + 2);
break;
}
case NodeTypeVariableDeclaration:
@@ -630,7 +630,7 @@ static void render_node(AstRender *ar, AstNode *node) {
break;
case NodeTypeReturnExpr:
zig_panic("TODO");
case NodeTypeDeferExpr:
case NodeTypeDefer:
zig_panic("TODO");
case NodeTypeVariableDeclaration:
{