authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-12-07 19:34:00+01:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-12-10 23:09:01+01:00
log47c309c34a23bcec9b3d72dade688965893614a4
treed641501e0fcdf6c83d557aeb6bbd4721b1a06d37
parent75f3e7a4a05db7ea805e581f78117a41768945ae
signaturelock-open Commit is signed but in an unrecognized format.

AstGen: increase zig fmt off/on granularity

This enables automatic formatting for a significant amount of code that currently doesn't deviate from the standard zig fmt enforced style.

1 files changed, 10 insertions(+), 6 deletions(-)

src/AstGen.zig+10-6
......@@ -6739,7 +6739,6 @@ fn builtinCall(
67396739 }
67406740 }
67416741
6742 // zig fmt: off
67436742 switch (info.tag) {
67446743 .import => {
67456744 const node_tags = tree.nodes.items(.tag);
......@@ -6768,7 +6767,7 @@ fn builtinCall(
67686767 astgen.extra.items[extra_index] = @enumToInt(param_ref);
67696768 extra_index += 1;
67706769 }
6771 const result = try gz.addExtendedMultiOpPayloadIndex(.compile_log,payload_index, params.len);
6770 const result = try gz.addExtendedMultiOpPayloadIndex(.compile_log, payload_index, params.len);
67726771 return rvalue(gz, rl, result, node);
67736772 },
67746773 .field => {
......@@ -6784,11 +6783,14 @@ fn builtinCall(
67846783 });
67856784 return rvalue(gz, rl, result, node);
67866785 },
6786
6787 // zig fmt: off
67876788 .as => return as( gz, scope, rl, node, params[0], params[1]),
67886789 .bit_cast => return bitCast( gz, scope, rl, node, params[0], params[1]),
67896790 .TypeOf => return typeOf( gz, scope, rl, node, params),
67906791 .union_init => return unionInit(gz, scope, rl, node, params),
67916792 .c_import => return cImport( gz, scope, node, params[0]),
6793 // zig fmt: on
67926794
67936795 .@"export" => {
67946796 const node_tags = tree.nodes.items(.tag);
......@@ -6858,9 +6860,7 @@ fn builtinCall(
68586860 const field_ident = dot_token + 1;
68596861 decl_name = try astgen.identAsString(field_ident);
68606862 },
6861 else => return astgen.failNode(
6862 params[0], "symbol to export must identify a declaration", .{},
6863 ),
6863 else => return astgen.failNode(params[0], "symbol to export must identify a declaration", .{}),
68646864 }
68656865 const options = try comptimeExpr(gz, scope, .{ .ty = .export_options_type }, params[1]);
68666866 _ = try gz.addPlNode(.@"export", node, Zir.Inst.Export{
......@@ -6888,6 +6888,7 @@ fn builtinCall(
68886888
68896889 .breakpoint => return simpleNoOpVoid(gz, rl, node, .breakpoint),
68906890
6891 // zig fmt: off
68916892 .This => return rvalue(gz, rl, try gz.addNodeExtended(.this, node), node),
68926893 .return_address => return rvalue(gz, rl, try gz.addNodeExtended(.ret_addr, node), node),
68936894 .src => return rvalue(gz, rl, try gz.addNodeExtended(.builtin_src, node), node),
......@@ -6942,6 +6943,8 @@ fn builtinCall(
69426943 .err_set_cast => return typeCast(gz, scope, rl, node, params[0], params[1], .err_set_cast),
69436944 .ptr_cast => return typeCast(gz, scope, rl, node, params[0], params[1], .ptr_cast),
69446945 .truncate => return typeCast(gz, scope, rl, node, params[0], params[1], .truncate),
6946 // zig fmt: on
6947
69456948 .align_cast => {
69466949 const dest_align = try comptimeExpr(gz, scope, align_rl, params[0]);
69476950 const rhs = try expr(gz, scope, .none, params[1]);
......@@ -6952,6 +6955,7 @@ fn builtinCall(
69526955 return rvalue(gz, rl, result, node);
69536956 },
69546957
6958 // zig fmt: off
69556959 .has_decl => return hasDeclOrField(gz, scope, rl, node, params[0], params[1], .has_decl),
69566960 .has_field => return hasDeclOrField(gz, scope, rl, node, params[0], params[1], .has_field),
69576961
......@@ -6978,6 +6982,7 @@ fn builtinCall(
69786982
69796983 .cmpxchg_strong => return cmpxchg(gz, scope, rl, node, params, .cmpxchg_strong),
69806984 .cmpxchg_weak => return cmpxchg(gz, scope, rl, node, params, .cmpxchg_weak),
6985 // zig fmt: on
69816986
69826987 .wasm_memory_size => {
69836988 const operand = try expr(gz, scope, .{ .ty = .u32_type }, params[0]);
......@@ -7222,7 +7227,6 @@ fn builtinCall(
72227227 return rvalue(gz, rl, result, node);
72237228 },
72247229 }
7225 // zig fmt: on
72267230}
72277231
72287232fn simpleNoOpVoid(