| ... | ... | @@ -989,16 +989,18 @@ fn renderVarDecl(gpa: *Allocator, ais: *Ais, tree: ast.Tree, var_decl: ast.full. |
| 989 | 989 | } |
| 990 | 990 | } |
| 991 | 991 | |
| 992 | | assert(var_decl.ast.init_node != 0); |
| 993 | | const eq_token = tree.firstToken(var_decl.ast.init_node) - 1; |
| 994 | | const eq_space: Space = if (tree.tokensOnSameLine(eq_token, eq_token + 1)) .space else .newline; |
| 995 | | { |
| 996 | | ais.pushIndent(); |
| 997 | | try renderToken(ais, tree, eq_token, eq_space); // = |
| 998 | | ais.popIndent(); |
| 992 | if (var_decl.ast.init_node != 0) { |
| 993 | const eq_token = tree.firstToken(var_decl.ast.init_node) - 1; |
| 994 | const eq_space: Space = if (tree.tokensOnSameLine(eq_token, eq_token + 1)) .space else .newline; |
| 995 | { |
| 996 | ais.pushIndent(); |
| 997 | try renderToken(ais, tree, eq_token, eq_space); // = |
| 998 | ais.popIndent(); |
| 999 | } |
| 1000 | ais.pushIndentOneShot(); |
| 1001 | return renderExpression(gpa, ais, tree, var_decl.ast.init_node, .semicolon); // ; |
| 999 | 1002 | } |
| 1000 | | ais.pushIndentOneShot(); |
| 1001 | | try renderExpression(gpa, ais, tree, var_decl.ast.init_node, .semicolon); |
| 1003 | return renderToken(ais, tree, var_decl.ast.mut_token + 2, .newline); // ; |
| 1002 | 1004 | } |
| 1003 | 1005 | |
| 1004 | 1006 | fn renderIf(gpa: *Allocator, ais: *Ais, tree: ast.Tree, if_node: ast.full.If, space: Space) Error!void { |