Skip to content

Commit

Permalink
zig fmt: translate ??x to x.?
Browse files Browse the repository at this point in the history
See #1023
  • Loading branch information
andrewrk committed Jun 10, 2018
1 parent 7a96355 commit 657e33d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion std/zig/render.zig
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,23 @@ fn renderExpression(
ast.Node.PrefixOp.Op.BoolNot,
ast.Node.PrefixOp.Op.Negation,
ast.Node.PrefixOp.Op.NegationWrap,
ast.Node.PrefixOp.Op.UnwrapMaybe,
ast.Node.PrefixOp.Op.MaybeType,
ast.Node.PrefixOp.Op.AddressOf,
=> {
try renderToken(tree, stream, prefix_op_node.op_token, indent, start_col, Space.None);
},

ast.Node.PrefixOp.Op.UnwrapMaybe => {
try renderExpression(allocator, stream, tree, indent, start_col, prefix_op_node.rhs, Space.None);
try stream.write(".?");
switch (space) {
Space.Space => try stream.writeByte(' '),
Space.Comma => try stream.write(",\n"),
else => {},
}
return;
},

ast.Node.PrefixOp.Op.Try,
ast.Node.PrefixOp.Op.Await,
ast.Node.PrefixOp.Op.Cancel,
Expand Down

0 comments on commit 657e33d

Please sign in to comment.