block statement lists never get fake expressions

instead blocks have a field that encodes whether the last statement ended with
a semicolon.
This commit is contained in:
Josh Wolfe
2017-04-12 22:18:56 -07:00
parent 919910312d
commit 356424916c
4 changed files with 64 additions and 81 deletions

View File

@@ -464,8 +464,10 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) {
}
print_indent(ar);
render_node_grouped(ar, statement);
if (i != node->data.block.statements.length - 1)
if (!(i == node->data.block.statements.length - 1 &&
node->data.block.last_statement_is_result_expression)) {
fprintf(ar->f, ";");
}
fprintf(ar->f, "\n");
}
ar->indent -= ar->indent_size;