@zigc/lib 0.16.0-test.1 → 0.17.0-dev.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/LICENSE +19 -0
  2. package/c/math.zig +135 -35
  3. package/c/stropts.zig +17 -0
  4. package/c.zig +1 -0
  5. package/compiler/aro/aro/Attribute/names.zig +604 -589
  6. package/compiler/aro/aro/Attribute.zig +202 -116
  7. package/compiler/aro/aro/Builtins/common.zig +874 -863
  8. package/compiler/aro/aro/Builtins/eval.zig +15 -7
  9. package/compiler/aro/aro/Builtins.zig +0 -1
  10. package/compiler/aro/aro/CodeGen.zig +3 -1
  11. package/compiler/aro/aro/Compilation.zig +120 -97
  12. package/compiler/aro/aro/Diagnostics.zig +21 -17
  13. package/compiler/aro/aro/Driver/GCCDetector.zig +635 -0
  14. package/compiler/aro/aro/Driver.zig +124 -50
  15. package/compiler/aro/aro/LangOpts.zig +12 -2
  16. package/compiler/aro/aro/Parser/Diagnostic.zig +79 -19
  17. package/compiler/aro/aro/Parser.zig +336 -142
  18. package/compiler/aro/aro/Preprocessor/Diagnostic.zig +21 -0
  19. package/compiler/aro/aro/Preprocessor.zig +127 -56
  20. package/compiler/aro/aro/Target.zig +17 -12
  21. package/compiler/aro/aro/Tokenizer.zig +31 -14
  22. package/compiler/aro/aro/Toolchain.zig +4 -7
  23. package/compiler/aro/aro/Tree.zig +178 -148
  24. package/compiler/aro/aro/TypeStore.zig +82 -24
  25. package/compiler/aro/aro/Value.zig +13 -17
  26. package/compiler/aro/aro/features.zig +1 -0
  27. package/compiler/aro/aro/pragmas/once.zig +0 -1
  28. package/compiler/aro/aro/record_layout.zig +3 -3
  29. package/compiler/aro/assembly_backend/x86_64.zig +3 -4
  30. package/compiler/aro/backend/Assembly.zig +1 -2
  31. package/compiler/aro/backend/Interner.zig +2 -2
  32. package/compiler/aro/backend/Ir.zig +100 -92
  33. package/compiler/aro/include/ptrcheck.h +49 -0
  34. package/compiler/aro/main.zig +26 -10
  35. package/compiler/build_runner.zig +1 -0
  36. package/compiler/objdump.zig +93 -0
  37. package/compiler/reduce.zig +5 -1
  38. package/compiler/resinator/compile.zig +2 -2
  39. package/compiler/resinator/main.zig +7 -1
  40. package/compiler/resinator/preprocess.zig +1 -3
  41. package/compiler/std-docs.zig +8 -1
  42. package/compiler/test_runner.zig +193 -61
  43. package/compiler/translate-c/MacroTranslator.zig +80 -11
  44. package/compiler/translate-c/PatternList.zig +1 -9
  45. package/compiler/translate-c/Scope.zig +43 -6
  46. package/compiler/translate-c/Translator.zig +364 -126
  47. package/compiler/translate-c/ast.zig +19 -11
  48. package/compiler/translate-c/main.zig +75 -16
  49. package/compiler_rt/cos.zig +141 -52
  50. package/compiler_rt/limb64.zig +266 -0
  51. package/compiler_rt/long_double.zig +37 -0
  52. package/compiler_rt/mulo.zig +6 -1
  53. package/compiler_rt/rem_pio2l.zig +173 -0
  54. package/compiler_rt/sin.zig +140 -55
  55. package/compiler_rt/sincos.zig +279 -72
  56. package/compiler_rt/tan.zig +118 -47
  57. package/compiler_rt/trig.zig +256 -6
  58. package/compiler_rt.zig +2 -0
  59. package/fuzzer.zig +855 -307
  60. package/libc/musl/src/math/pow.c +343 -0
  61. package/package.json +1 -1
  62. package/std/Build/Fuzz.zig +6 -19
  63. package/std/Build/Module.zig +1 -1
  64. package/std/Build/Step/CheckObject.zig +3 -3
  65. package/std/Build/Step/Compile.zig +18 -0
  66. package/std/Build/Step/ConfigHeader.zig +49 -33
  67. package/std/Build/Step/InstallArtifact.zig +18 -0
  68. package/std/Build/Step/Run.zig +536 -87
  69. package/std/Build/Step/TranslateC.zig +0 -6
  70. package/std/Build/Step.zig +8 -15
  71. package/std/Build/WebServer.zig +29 -17
  72. package/std/Build/abi.zig +47 -11
  73. package/std/Build.zig +17 -14
  74. package/std/Io/Dispatch.zig +2 -0
  75. package/std/Io/File/Reader.zig +3 -1
  76. package/std/Io/File.zig +1 -0
  77. package/std/Io/Kqueue.zig +2 -2
  78. package/std/Io/Threaded.zig +181 -143
  79. package/std/Io/Uring.zig +2 -1
  80. package/std/Io.zig +970 -2
  81. package/std/Target.zig +3 -2
  82. package/std/Thread.zig +8 -3
  83. package/std/array_hash_map.zig +96 -555
  84. package/std/array_list.zig +22 -31
  85. package/std/bit_set.zig +22 -6
  86. package/std/builtin/assembly.zig +68 -0
  87. package/std/c.zig +17 -17
  88. package/std/compress/flate/Compress.zig +3 -3
  89. package/std/crypto/Certificate/Bundle.zig +15 -1
  90. package/std/crypto/codecs/asn1.zig +33 -18
  91. package/std/crypto/codecs/base64_hex_ct.zig +14 -4
  92. package/std/debug/Dwarf.zig +29 -9
  93. package/std/debug/Info.zig +4 -0
  94. package/std/debug/MachOFile.zig +46 -8
  95. package/std/debug/Pdb.zig +539 -36
  96. package/std/debug/SelfInfo/Elf.zig +19 -18
  97. package/std/debug/SelfInfo/MachO.zig +18 -7
  98. package/std/debug/SelfInfo/Windows.zig +138 -36
  99. package/std/debug.zig +179 -65
  100. package/std/enums.zig +25 -19
  101. package/std/heap/ArenaAllocator.zig +145 -154
  102. package/std/heap/debug_allocator.zig +7 -7
  103. package/std/http/Client.zig +10 -6
  104. package/std/http.zig +11 -9
  105. package/std/json/Stringify.zig +3 -3
  106. package/std/json/dynamic.zig +4 -4
  107. package/std/math/big/int.zig +16 -17
  108. package/std/mem/Allocator.zig +4 -5
  109. package/std/mem.zig +48 -0
  110. package/std/os/emscripten.zig +2 -18
  111. package/std/os/linux/arc.zig +144 -0
  112. package/std/os/linux.zig +21 -4
  113. package/std/os/windows.zig +2 -2
  114. package/std/pdb.zig +143 -4
  115. package/std/posix.zig +6 -12
  116. package/std/priority_dequeue.zig +13 -12
  117. package/std/priority_queue.zig +5 -4
  118. package/std/process/Child.zig +1 -1
  119. package/std/process/Environ.zig +1 -1
  120. package/std/start.zig +17 -4
  121. package/std/std.zig +19 -6
  122. package/std/testing/FailingAllocator.zig +4 -4
  123. package/std/testing/Smith.zig +37 -2
  124. package/std/zig/Ast/Render.zig +186 -458
  125. package/std/zig/Ast.zig +0 -4
  126. package/std/zig/AstGen.zig +44 -7
  127. package/std/zig/AstSmith.zig +2602 -0
  128. package/std/zig/Client.zig +8 -3
  129. package/std/zig/Parse.zig +83 -74
  130. package/std/zig/Server.zig +26 -0
  131. package/std/zig/Zir.zig +17 -0
  132. package/std/zig/c_translation/helpers.zig +14 -9
  133. package/std/zig/llvm/Builder.zig +107 -48
  134. package/std/zig/system.zig +20 -4
  135. package/std/zig/tokenizer.zig +2 -1
  136. package/std/zig.zig +6 -0
  137. package/compiler/aro/aro/Driver/Filesystem.zig +0 -241
  138. package/libc/mingw/complex/cabs.c +0 -48
  139. package/libc/mingw/complex/cabsf.c +0 -48
  140. package/libc/mingw/complex/cacos.c +0 -50
  141. package/libc/mingw/complex/cacosf.c +0 -50
  142. package/libc/mingw/complex/carg.c +0 -48
  143. package/libc/mingw/complex/cargf.c +0 -48
  144. package/libc/mingw/complex/casin.c +0 -50
  145. package/libc/mingw/complex/casinf.c +0 -50
  146. package/libc/mingw/complex/catan.c +0 -50
  147. package/libc/mingw/complex/catanf.c +0 -50
  148. package/libc/mingw/complex/ccos.c +0 -50
  149. package/libc/mingw/complex/ccosf.c +0 -50
  150. package/libc/mingw/complex/cexp.c +0 -48
  151. package/libc/mingw/complex/cexpf.c +0 -48
  152. package/libc/mingw/complex/cimag.c +0 -48
  153. package/libc/mingw/complex/cimagf.c +0 -48
  154. package/libc/mingw/complex/clog.c +0 -48
  155. package/libc/mingw/complex/clog10.c +0 -49
  156. package/libc/mingw/complex/clog10f.c +0 -49
  157. package/libc/mingw/complex/clogf.c +0 -48
  158. package/libc/mingw/complex/conj.c +0 -48
  159. package/libc/mingw/complex/conjf.c +0 -48
  160. package/libc/mingw/complex/cpow.c +0 -48
  161. package/libc/mingw/complex/cpowf.c +0 -48
  162. package/libc/mingw/complex/cproj.c +0 -48
  163. package/libc/mingw/complex/cprojf.c +0 -48
  164. package/libc/mingw/complex/creal.c +0 -48
  165. package/libc/mingw/complex/crealf.c +0 -48
  166. package/libc/mingw/complex/csin.c +0 -50
  167. package/libc/mingw/complex/csinf.c +0 -50
  168. package/libc/mingw/complex/csqrt.c +0 -48
  169. package/libc/mingw/complex/csqrtf.c +0 -48
  170. package/libc/mingw/complex/ctan.c +0 -50
  171. package/libc/mingw/complex/ctanf.c +0 -50
  172. package/libc/mingw/math/arm/s_rint.c +0 -86
  173. package/libc/mingw/math/arm/s_rintf.c +0 -51
  174. package/libc/mingw/math/arm/sincos.S +0 -30
  175. package/libc/mingw/math/arm-common/sincosl.c +0 -13
  176. package/libc/mingw/math/arm64/rint.c +0 -12
  177. package/libc/mingw/math/arm64/rintf.c +0 -12
  178. package/libc/mingw/math/arm64/sincos.S +0 -32
  179. package/libc/mingw/math/bsd_private_base.h +0 -148
  180. package/libc/mingw/math/frexpf.c +0 -13
  181. package/libc/mingw/math/frexpl.c +0 -71
  182. package/libc/mingw/math/x86/acosf.c +0 -29
  183. package/libc/mingw/math/x86/atanf.c +0 -23
  184. package/libc/mingw/math/x86/atanl.c +0 -18
  185. package/libc/mingw/math/x86/cos.def.h +0 -65
  186. package/libc/mingw/math/x86/cosl.c +0 -46
  187. package/libc/mingw/math/x86/cosl_internal.S +0 -55
  188. package/libc/mingw/math/x86/ldexp.c +0 -23
  189. package/libc/mingw/math/x86/scalbn.S +0 -41
  190. package/libc/mingw/math/x86/scalbnf.S +0 -40
  191. package/libc/mingw/math/x86/sin.def.h +0 -65
  192. package/libc/mingw/math/x86/sinl.c +0 -46
  193. package/libc/mingw/math/x86/sinl_internal.S +0 -58
  194. package/libc/mingw/math/x86/tanl.S +0 -62
  195. package/libc/mingw/misc/btowc.c +0 -28
  196. package/libc/mingw/misc/wcstof.c +0 -66
  197. package/libc/mingw/misc/wcstoimax.c +0 -132
  198. package/libc/mingw/misc/wcstoumax.c +0 -126
  199. package/libc/mingw/misc/wctob.c +0 -29
  200. package/libc/mingw/misc/winbs_uint64.c +0 -6
  201. package/libc/mingw/misc/winbs_ulong.c +0 -6
  202. package/libc/mingw/misc/winbs_ushort.c +0 -6
  203. package/libc/mingw/stdio/_Exit.c +0 -10
  204. package/libc/mingw/stdio/_findfirst64i32.c +0 -21
  205. package/libc/mingw/stdio/_findnext64i32.c +0 -21
  206. package/libc/mingw/stdio/_fstat64i32.c +0 -37
  207. package/libc/mingw/stdio/_stat64i32.c +0 -37
  208. package/libc/mingw/stdio/_wfindfirst64i32.c +0 -21
  209. package/libc/mingw/stdio/_wfindnext64i32.c +0 -21
  210. package/libc/mingw/stdio/_wstat64i32.c +0 -37
  211. package/libc/musl/src/legacy/isastream.c +0 -7
  212. package/libc/musl/src/legacy/valloc.c +0 -8
  213. package/libc/musl/src/math/__cosl.c +0 -96
  214. package/libc/musl/src/math/__sinl.c +0 -78
  215. package/libc/musl/src/math/__tanl.c +0 -143
  216. package/libc/musl/src/math/aarch64/lrint.c +0 -10
  217. package/libc/musl/src/math/aarch64/lrintf.c +0 -10
  218. package/libc/musl/src/math/aarch64/rintf.c +0 -7
  219. package/libc/musl/src/math/cosl.c +0 -39
  220. package/libc/musl/src/math/fdim.c +0 -10
  221. package/libc/musl/src/math/finite.c +0 -7
  222. package/libc/musl/src/math/finitef.c +0 -7
  223. package/libc/musl/src/math/frexp.c +0 -23
  224. package/libc/musl/src/math/frexpf.c +0 -23
  225. package/libc/musl/src/math/frexpl.c +0 -29
  226. package/libc/musl/src/math/i386/lrint.c +0 -8
  227. package/libc/musl/src/math/i386/lrintf.c +0 -8
  228. package/libc/musl/src/math/i386/rintf.c +0 -7
  229. package/libc/musl/src/math/lrint.c +0 -72
  230. package/libc/musl/src/math/lrintf.c +0 -8
  231. package/libc/musl/src/math/powerpc64/lrint.c +0 -16
  232. package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
  233. package/libc/musl/src/math/rintf.c +0 -30
  234. package/libc/musl/src/math/s390x/rintf.c +0 -15
  235. package/libc/musl/src/math/sincosl.c +0 -60
  236. package/libc/musl/src/math/sinl.c +0 -41
  237. package/libc/musl/src/math/tanl.c +0 -29
  238. package/libc/musl/src/math/x32/lrint.s +0 -5
  239. package/libc/musl/src/math/x32/lrintf.s +0 -5
  240. package/libc/musl/src/math/x86_64/lrint.c +0 -8
  241. package/libc/musl/src/math/x86_64/lrintf.c +0 -8
  242. package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
@@ -34,7 +34,7 @@ pub const TokenWithExpansionLocs = struct {
34
34
  expansion_locs: ?[*]Source.Location = null,
35
35
 
36
36
  pub fn expansionSlice(tok: TokenWithExpansionLocs) []const Source.Location {
37
- const locs = tok.expansion_locs orelse return &[0]Source.Location{};
37
+ const locs = tok.expansion_locs orelse return &.{};
38
38
  var i: usize = 0;
39
39
  while (locs[i].id.index != .unused) : (i += 1) {}
40
40
  return locs[0..i];
@@ -243,6 +243,8 @@ pub const Node = union(enum) {
243
243
  builtin_choose_expr: Conditional,
244
244
  builtin_convertvector: Convertvector,
245
245
  builtin_shufflevector: Shufflevector,
246
+ builtin_va_arg_pack: VaArgPack,
247
+ builtin_va_arg_pack_len: VaArgPack,
246
248
 
247
249
  /// C23 bool literal `true` / `false`
248
250
  bool_literal: Literal,
@@ -633,6 +635,10 @@ pub const Node = union(enum) {
633
635
  indexes: []const Node.Index,
634
636
  };
635
637
 
638
+ pub const VaArgPack = struct {
639
+ builtin_tok: TokenIndex,
640
+ };
641
+
636
642
  pub const Literal = struct {
637
643
  literal_tok: TokenIndex,
638
644
  qt: QualType,
@@ -1689,6 +1695,16 @@ pub const Node = union(enum) {
1689
1695
  .indexes = @ptrCast(tree.extra.items[node_data[1] + 2 ..][0..node_data[2]]),
1690
1696
  },
1691
1697
  },
1698
+ .builtin_va_arg_pack => .{
1699
+ .builtin_va_arg_pack = .{
1700
+ .builtin_tok = node_tok,
1701
+ },
1702
+ },
1703
+ .builtin_va_arg_pack_len => .{
1704
+ .builtin_va_arg_pack_len = .{
1705
+ .builtin_tok = node_tok,
1706
+ },
1707
+ },
1692
1708
  .array_init_expr_two => .{
1693
1709
  .array_init_expr = .{
1694
1710
  .l_brace_tok = node_tok,
@@ -1797,7 +1813,9 @@ pub const Node = union(enum) {
1797
1813
  .global_asm,
1798
1814
  .generic_association_expr,
1799
1815
  .generic_default_expr,
1816
+ .builtin_va_arg_pack,
1800
1817
  => null,
1818
+ .builtin_va_arg_pack_len => .int,
1801
1819
  .builtin_types_compatible_p => .int,
1802
1820
  else => {
1803
1821
  // If a node is typed the type is stored in data[0].
@@ -1963,6 +1981,8 @@ pub const Node = union(enum) {
1963
1981
  builtin_types_compatible_p,
1964
1982
  builtin_convertvector,
1965
1983
  builtin_shufflevector,
1984
+ builtin_va_arg_pack,
1985
+ builtin_va_arg_pack_len,
1966
1986
  array_init_expr,
1967
1987
  array_init_expr_two,
1968
1988
  struct_init_expr,
@@ -2789,6 +2809,14 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void {
2789
2809
  tree.extra.appendAssumeCapacity(@intFromEnum(builtin.rhs));
2790
2810
  tree.extra.appendSliceAssumeCapacity(@ptrCast(builtin.indexes));
2791
2811
  },
2812
+ .builtin_va_arg_pack => |builtin| {
2813
+ repr.tag = .builtin_va_arg_pack;
2814
+ repr.tok = builtin.builtin_tok;
2815
+ },
2816
+ .builtin_va_arg_pack_len => |builtin| {
2817
+ repr.tag = .builtin_va_arg_pack_len;
2818
+ repr.tok = builtin.builtin_tok;
2819
+ },
2792
2820
  .array_init_expr => |init| {
2793
2821
  repr.data[0] = @bitCast(init.container_qt);
2794
2822
  if (init.items.len > 2) {
@@ -3000,12 +3028,12 @@ pub fn tokSlice(tree: *const Tree, tok_i: TokenIndex) []const u8 {
3000
3028
  return tree.comp.locSlice(loc);
3001
3029
  }
3002
3030
 
3003
- pub fn dump(tree: *const Tree, config: std.Io.tty.Config, w: *std.Io.Writer) std.Io.tty.Config.SetColorError!void {
3031
+ pub fn dump(tree: *const Tree, term: std.Io.Terminal) std.Io.Terminal.SetColorError!void {
3004
3032
  for (tree.root_decls.items) |i| {
3005
- try tree.dumpNode(i, 0, config, w);
3006
- try w.writeByte('\n');
3033
+ try tree.dumpNode(i, 0, term);
3034
+ try term.writer.writeByte('\n');
3007
3035
  }
3008
- try w.flush();
3036
+ try term.writer.flush();
3009
3037
  }
3010
3038
 
3011
3039
  fn dumpFieldAttributes(tree: *const Tree, attributes: []const Attribute, level: u32, w: *std.Io.Writer) !void {
@@ -3052,25 +3080,26 @@ fn dumpNode(
3052
3080
  tree: *const Tree,
3053
3081
  node_index: Node.Index,
3054
3082
  level: u32,
3055
- config: std.Io.tty.Config,
3056
- w: *std.Io.Writer,
3083
+ term: std.Io.Terminal,
3057
3084
  ) !void {
3058
3085
  const delta = 2;
3059
3086
  const half = delta / 2;
3060
- const TYPE = std.Io.tty.Color.bright_magenta;
3061
- const TAG = std.Io.tty.Color.bright_cyan;
3062
- const IMPLICIT = std.Io.tty.Color.bright_blue;
3063
- const NAME = std.Io.tty.Color.bright_red;
3064
- const LITERAL = std.Io.tty.Color.bright_green;
3065
- const ATTRIBUTE = std.Io.tty.Color.bright_yellow;
3087
+ const TYPE = std.Io.Terminal.Color.bright_magenta;
3088
+ const TAG = std.Io.Terminal.Color.bright_cyan;
3089
+ const IMPLICIT = std.Io.Terminal.Color.bright_blue;
3090
+ const NAME = std.Io.Terminal.Color.bright_red;
3091
+ const LITERAL = std.Io.Terminal.Color.bright_green;
3092
+ const ATTRIBUTE = std.Io.Terminal.Color.bright_yellow;
3093
+
3094
+ const w = term.writer;
3066
3095
 
3067
3096
  const node = node_index.get(tree);
3068
3097
  try w.splatByteAll(' ', level);
3069
3098
 
3070
- if (config == .no_color) {
3099
+ if (term.mode == .no_color) {
3071
3100
  if (node.isImplicit()) try w.writeAll("implicit ");
3072
3101
  } else {
3073
- try config.setColor(w, if (node.isImplicit()) IMPLICIT else TAG);
3102
+ try term.setColor(if (node.isImplicit()) IMPLICIT else TAG);
3074
3103
  }
3075
3104
  try w.print("{s}", .{@tagName(node)});
3076
3105
 
@@ -3078,36 +3107,36 @@ fn dumpNode(
3078
3107
  try w.writeAll(": ");
3079
3108
  switch (node) {
3080
3109
  .cast => |cast| {
3081
- try config.setColor(w, .white);
3110
+ try term.setColor(.white);
3082
3111
  try w.print("({s}) ", .{@tagName(cast.kind)});
3083
3112
  },
3084
3113
  else => {},
3085
3114
  }
3086
3115
 
3087
- try config.setColor(w, TYPE);
3116
+ try term.setColor(TYPE);
3088
3117
  try w.writeByte('\'');
3089
3118
  try qt.dump(tree.comp, w);
3090
3119
  try w.writeByte('\'');
3091
3120
  }
3092
3121
 
3093
3122
  if (tree.isLval(node_index)) {
3094
- try config.setColor(w, ATTRIBUTE);
3123
+ try term.setColor(ATTRIBUTE);
3095
3124
  try w.writeAll(" lvalue");
3096
3125
  }
3097
3126
  if (tree.isBitfield(node_index)) {
3098
- try config.setColor(w, ATTRIBUTE);
3127
+ try term.setColor(ATTRIBUTE);
3099
3128
  try w.writeAll(" bitfield");
3100
3129
  }
3101
3130
  if (node == .asm_stmt) {
3102
3131
  const quals = node.asm_stmt.quals;
3103
- try config.setColor(w, ATTRIBUTE);
3132
+ try term.setColor(ATTRIBUTE);
3104
3133
  if (quals.@"inline") try w.writeAll(" inline");
3105
3134
  if (quals.@"volatile") try w.writeAll(" volatile");
3106
3135
  if (quals.goto) try w.writeAll(" goto");
3107
3136
  }
3108
3137
 
3109
3138
  if (tree.value_map.get(node_index)) |val| {
3110
- try config.setColor(w, LITERAL);
3139
+ try term.setColor(LITERAL);
3111
3140
  try w.writeAll(" (value: ");
3112
3141
  if (try val.print(node_index.qt(tree), tree.comp, w)) |nested| switch (nested) {
3113
3142
  .pointer => |ptr| {
@@ -3127,15 +3156,15 @@ fn dumpNode(
3127
3156
  try w.writeByte(')');
3128
3157
  }
3129
3158
  if (node == .return_stmt and node.return_stmt.operand == .implicit and node.return_stmt.operand.implicit) {
3130
- try config.setColor(w, IMPLICIT);
3159
+ try term.setColor(IMPLICIT);
3131
3160
  try w.writeAll(" (value: 0)");
3132
3161
  }
3133
3162
 
3134
3163
  try w.writeAll("\n");
3135
- try config.setColor(w, .reset);
3164
+ try term.setColor(.reset);
3136
3165
 
3137
3166
  if (node_index.qtOrNull(tree)) |qt| {
3138
- try config.setColor(w, ATTRIBUTE);
3167
+ try term.setColor(ATTRIBUTE);
3139
3168
  var it = Attribute.Iterator.initType(qt, tree.comp);
3140
3169
  while (it.next()) |item| {
3141
3170
  const attr, _ = item;
@@ -3143,56 +3172,56 @@ fn dumpNode(
3143
3172
  try w.print("attr: {s}", .{@tagName(attr.tag)});
3144
3173
  try tree.dumpAttribute(attr, w);
3145
3174
  }
3146
- try config.setColor(w, .reset);
3175
+ try term.setColor(.reset);
3147
3176
  }
3148
3177
 
3149
3178
  switch (node) {
3150
3179
  .empty_decl => {},
3151
3180
  .global_asm => |@"asm"| {
3152
- try tree.dumpNode(@"asm".asm_str, level + delta, config, w);
3181
+ try tree.dumpNode(@"asm".asm_str, level + delta, term);
3153
3182
  },
3154
3183
  .static_assert => |assert| {
3155
3184
  try w.splatByteAll(' ', level + 1);
3156
3185
  try w.writeAll("condition:\n");
3157
- try tree.dumpNode(assert.cond, level + delta, config, w);
3186
+ try tree.dumpNode(assert.cond, level + delta, term);
3158
3187
  if (assert.message) |some| {
3159
3188
  try w.splatByteAll(' ', level + 1);
3160
3189
  try w.writeAll("diagnostic:\n");
3161
- try tree.dumpNode(some, level + delta, config, w);
3190
+ try tree.dumpNode(some, level + delta, term);
3162
3191
  }
3163
3192
  },
3164
3193
  .function => |function| {
3165
3194
  try w.splatByteAll(' ', level + half);
3166
3195
 
3167
- try config.setColor(w, ATTRIBUTE);
3196
+ try term.setColor(ATTRIBUTE);
3168
3197
  if (function.static) try w.writeAll("static ");
3169
3198
  if (function.@"inline") try w.writeAll("inline ");
3170
3199
 
3171
- try config.setColor(w, .reset);
3200
+ try term.setColor(.reset);
3172
3201
  try w.writeAll("name: ");
3173
- try config.setColor(w, NAME);
3202
+ try term.setColor(NAME);
3174
3203
  try w.print("{s}\n", .{tree.tokSlice(function.name_tok)});
3175
- try config.setColor(w, .reset);
3204
+ try term.setColor(.reset);
3176
3205
 
3177
3206
  if (function.body) |body| {
3178
3207
  try w.splatByteAll(' ', level + half);
3179
3208
  try w.writeAll("body:\n");
3180
- try tree.dumpNode(body, level + delta, config, w);
3209
+ try tree.dumpNode(body, level + delta, term);
3181
3210
  }
3182
3211
  if (function.definition) |definition| {
3183
3212
  try w.splatByteAll(' ', level + half);
3184
3213
  try w.writeAll("definition: ");
3185
- try config.setColor(w, NAME);
3214
+ try term.setColor(NAME);
3186
3215
  try w.print("0x{X}\n", .{@intFromEnum(definition)});
3187
- try config.setColor(w, .reset);
3216
+ try term.setColor(.reset);
3188
3217
  }
3189
3218
  },
3190
3219
  .typedef => |typedef| {
3191
3220
  try w.splatByteAll(' ', level + half);
3192
3221
  try w.writeAll("name: ");
3193
- try config.setColor(w, NAME);
3222
+ try term.setColor(NAME);
3194
3223
  try w.print("{s}\n", .{tree.tokSlice(typedef.name_tok)});
3195
- try config.setColor(w, .reset);
3224
+ try term.setColor(.reset);
3196
3225
  },
3197
3226
  .param => |param| {
3198
3227
  try w.splatByteAll(' ', level + half);
@@ -3200,21 +3229,21 @@ fn dumpNode(
3200
3229
  switch (param.storage_class) {
3201
3230
  .auto => {},
3202
3231
  .register => {
3203
- try config.setColor(w, ATTRIBUTE);
3232
+ try term.setColor(ATTRIBUTE);
3204
3233
  try w.writeAll("register ");
3205
- try config.setColor(w, .reset);
3234
+ try term.setColor(.reset);
3206
3235
  },
3207
3236
  }
3208
3237
 
3209
3238
  try w.writeAll("name: ");
3210
- try config.setColor(w, NAME);
3239
+ try term.setColor(NAME);
3211
3240
  try w.print("{s}\n", .{tree.tokSlice(param.name_tok)});
3212
- try config.setColor(w, .reset);
3241
+ try term.setColor(.reset);
3213
3242
  },
3214
3243
  .variable => |variable| {
3215
3244
  try w.splatByteAll(' ', level + half);
3216
3245
 
3217
- try config.setColor(w, ATTRIBUTE);
3246
+ try term.setColor(ATTRIBUTE);
3218
3247
  switch (variable.storage_class) {
3219
3248
  .auto => {},
3220
3249
  .static => try w.writeAll("static "),
@@ -3222,37 +3251,37 @@ fn dumpNode(
3222
3251
  .register => try w.writeAll("register "),
3223
3252
  }
3224
3253
  if (variable.thread_local) try w.writeAll("thread_local ");
3225
- try config.setColor(w, .reset);
3254
+ try term.setColor(.reset);
3226
3255
 
3227
3256
  try w.writeAll("name: ");
3228
- try config.setColor(w, NAME);
3257
+ try term.setColor(NAME);
3229
3258
  try w.print("{s}\n", .{tree.tokSlice(variable.name_tok)});
3230
- try config.setColor(w, .reset);
3259
+ try term.setColor(.reset);
3231
3260
 
3232
3261
  if (variable.initializer) |some| {
3233
- try config.setColor(w, .reset);
3262
+ try term.setColor(.reset);
3234
3263
  try w.splatByteAll(' ', level + half);
3235
3264
  try w.writeAll("init:\n");
3236
- try tree.dumpNode(some, level + delta, config, w);
3265
+ try tree.dumpNode(some, level + delta, term);
3237
3266
  }
3238
3267
  if (variable.definition) |definition| {
3239
3268
  try w.splatByteAll(' ', level + half);
3240
3269
  try w.writeAll("definition: ");
3241
- try config.setColor(w, NAME);
3270
+ try term.setColor(NAME);
3242
3271
  try w.print("0x{X}\n", .{@intFromEnum(definition)});
3243
- try config.setColor(w, .reset);
3272
+ try term.setColor(.reset);
3244
3273
  }
3245
3274
  },
3246
3275
  .enum_field => |field| {
3247
3276
  try w.splatByteAll(' ', level + half);
3248
3277
  try w.writeAll("name: ");
3249
- try config.setColor(w, NAME);
3278
+ try term.setColor(NAME);
3250
3279
  try w.print("{s}\n", .{tree.tokSlice(field.name_tok)});
3251
- try config.setColor(w, .reset);
3280
+ try term.setColor(.reset);
3252
3281
  if (field.init) |some| {
3253
3282
  try w.splatByteAll(' ', level + half);
3254
3283
  try w.writeAll("init:\n");
3255
- try tree.dumpNode(some, level + delta, config, w);
3284
+ try tree.dumpNode(some, level + delta, term);
3256
3285
  }
3257
3286
  },
3258
3287
  .record_field => |field| {
@@ -3260,26 +3289,26 @@ fn dumpNode(
3260
3289
  if (name_tok_id == .identifier or name_tok_id == .extended_identifier) {
3261
3290
  try w.splatByteAll(' ', level + half);
3262
3291
  try w.writeAll("name: ");
3263
- try config.setColor(w, NAME);
3292
+ try term.setColor(NAME);
3264
3293
  try w.print("{s}\n", .{tree.tokSlice(field.name_or_first_tok)});
3265
- try config.setColor(w, .reset);
3294
+ try term.setColor(.reset);
3266
3295
  }
3267
3296
  if (field.bit_width) |some| {
3268
3297
  try w.splatByteAll(' ', level + half);
3269
3298
  try w.writeAll("bits:\n");
3270
- try tree.dumpNode(some, level + delta, config, w);
3299
+ try tree.dumpNode(some, level + delta, term);
3271
3300
  }
3272
3301
  },
3273
3302
  .compound_stmt => |compound| {
3274
3303
  for (compound.body, 0..) |stmt, i| {
3275
3304
  if (i != 0) try w.writeByte('\n');
3276
- try tree.dumpNode(stmt, level + delta, config, w);
3305
+ try tree.dumpNode(stmt, level + delta, term);
3277
3306
  }
3278
3307
  },
3279
3308
  .enum_decl => |decl| {
3280
3309
  for (decl.fields, 0..) |field, i| {
3281
3310
  if (i != 0) try w.writeByte('\n');
3282
- try tree.dumpNode(field, level + delta, config, w);
3311
+ try tree.dumpNode(field, level + delta, term);
3283
3312
  }
3284
3313
  },
3285
3314
  .struct_decl, .union_decl => |decl| {
@@ -3291,7 +3320,7 @@ fn dumpNode(
3291
3320
  var field_i: u32 = 0;
3292
3321
  for (decl.fields, 0..) |field_node, i| {
3293
3322
  if (i != 0) try w.writeByte('\n');
3294
- try tree.dumpNode(field_node, level + delta, config, w);
3323
+ try tree.dumpNode(field_node, level + delta, term);
3295
3324
 
3296
3325
  if (field_node.get(tree) != .record_field) continue;
3297
3326
  if (fields.len == 0) continue;
@@ -3301,32 +3330,32 @@ fn dumpNode(
3301
3330
 
3302
3331
  if (field_attributes.len == 0) continue;
3303
3332
 
3304
- try config.setColor(w, ATTRIBUTE);
3333
+ try term.setColor(ATTRIBUTE);
3305
3334
  try tree.dumpFieldAttributes(field_attributes, level + delta + half, w);
3306
- try config.setColor(w, .reset);
3335
+ try term.setColor(.reset);
3307
3336
  }
3308
3337
  },
3309
3338
  .array_init_expr, .struct_init_expr => |init| {
3310
3339
  for (init.items, 0..) |item, i| {
3311
3340
  if (i != 0) try w.writeByte('\n');
3312
- try tree.dumpNode(item, level + delta, config, w);
3341
+ try tree.dumpNode(item, level + delta, term);
3313
3342
  }
3314
3343
  },
3315
3344
  .union_init_expr => |init| {
3316
3345
  try w.splatByteAll(' ', level + half);
3317
3346
  try w.writeAll("field index: ");
3318
- try config.setColor(w, LITERAL);
3347
+ try term.setColor(LITERAL);
3319
3348
  try w.print("{d}\n", .{init.field_index});
3320
- try config.setColor(w, .reset);
3349
+ try term.setColor(.reset);
3321
3350
  if (init.initializer) |some| {
3322
- try tree.dumpNode(some, level + delta, config, w);
3351
+ try tree.dumpNode(some, level + delta, term);
3323
3352
  }
3324
3353
  },
3325
3354
  .compound_literal_expr => |literal| {
3326
3355
  if (literal.storage_class != .auto or literal.thread_local) {
3327
3356
  try w.splatByteAll(' ', level + half - 1);
3328
3357
 
3329
- try config.setColor(w, ATTRIBUTE);
3358
+ try term.setColor(ATTRIBUTE);
3330
3359
  switch (literal.storage_class) {
3331
3360
  .auto => {},
3332
3361
  .static => try w.writeAll(" static"),
@@ -3334,137 +3363,138 @@ fn dumpNode(
3334
3363
  }
3335
3364
  if (literal.thread_local) try w.writeAll(" thread_local");
3336
3365
  try w.writeByte('\n');
3337
- try config.setColor(w, .reset);
3366
+ try term.setColor(.reset);
3338
3367
  }
3339
3368
 
3340
- try tree.dumpNode(literal.initializer, level + half, config, w);
3369
+ try tree.dumpNode(literal.initializer, level + half, term);
3341
3370
  },
3342
3371
  .labeled_stmt => |labeled| {
3343
3372
  try w.splatByteAll(' ', level + half);
3344
3373
  try w.writeAll("label: ");
3345
- try config.setColor(w, LITERAL);
3374
+ try term.setColor(LITERAL);
3346
3375
  try w.print("{s}\n", .{tree.tokSlice(labeled.label_tok)});
3347
3376
 
3348
- try config.setColor(w, .reset);
3377
+ try term.setColor(.reset);
3349
3378
  try w.splatByteAll(' ', level + half);
3350
3379
  try w.writeAll("stmt:\n");
3351
- try tree.dumpNode(labeled.body, level + delta, config, w);
3380
+ try tree.dumpNode(labeled.body, level + delta, term);
3352
3381
  },
3353
3382
  .case_stmt => |case| {
3354
3383
  try w.splatByteAll(' ', level + half);
3355
3384
 
3356
3385
  if (case.end) |some| {
3357
3386
  try w.writeAll("range start:\n");
3358
- try tree.dumpNode(case.start, level + delta, config, w);
3387
+ try tree.dumpNode(case.start, level + delta, term);
3359
3388
 
3360
3389
  try w.splatByteAll(' ', level + half);
3361
3390
  try w.writeAll("range end:\n");
3362
- try tree.dumpNode(some, level + delta, config, w);
3391
+ try tree.dumpNode(some, level + delta, term);
3363
3392
  } else {
3364
3393
  try w.writeAll("value:\n");
3365
- try tree.dumpNode(case.start, level + delta, config, w);
3394
+ try tree.dumpNode(case.start, level + delta, term);
3366
3395
  }
3367
3396
 
3368
3397
  try w.splatByteAll(' ', level + half);
3369
3398
  try w.writeAll("stmt:\n");
3370
- try tree.dumpNode(case.body, level + delta, config, w);
3399
+ try tree.dumpNode(case.body, level + delta, term);
3371
3400
  },
3372
3401
  .default_stmt => |default| {
3373
3402
  try w.splatByteAll(' ', level + half);
3374
3403
  try w.writeAll("stmt:\n");
3375
- try tree.dumpNode(default.body, level + delta, config, w);
3404
+ try tree.dumpNode(default.body, level + delta, term);
3376
3405
  },
3377
3406
  .binary_cond_expr, .cond_expr, .builtin_choose_expr => |conditional| {
3378
3407
  try w.splatByteAll(' ', level + half);
3379
3408
  try w.writeAll("cond:\n");
3380
- try tree.dumpNode(conditional.cond, level + delta, config, w);
3409
+ try tree.dumpNode(conditional.cond, level + delta, term);
3381
3410
 
3382
3411
  try w.splatByteAll(' ', level + half);
3383
3412
  try w.writeAll("then:\n");
3384
- try tree.dumpNode(conditional.then_expr, level + delta, config, w);
3413
+ try tree.dumpNode(conditional.then_expr, level + delta, term);
3385
3414
 
3386
3415
  try w.splatByteAll(' ', level + half);
3387
3416
  try w.writeAll("else:\n");
3388
- try tree.dumpNode(conditional.else_expr, level + delta, config, w);
3417
+ try tree.dumpNode(conditional.else_expr, level + delta, term);
3389
3418
  },
3390
3419
  .builtin_types_compatible_p => |call| {
3391
3420
  try w.splatByteAll(' ', level + half);
3392
3421
  try w.writeAll("lhs: ");
3393
- try config.setColor(w, TYPE);
3422
+ try term.setColor(TYPE);
3394
3423
  try call.lhs.dump(tree.comp, w);
3395
3424
  try w.writeByte('\n');
3396
- try config.setColor(w, .reset);
3425
+ try term.setColor(.reset);
3397
3426
 
3398
3427
  try w.splatByteAll(' ', level + half);
3399
3428
  try w.writeAll("rhs: ");
3400
- try config.setColor(w, TYPE);
3429
+ try term.setColor(TYPE);
3401
3430
  try call.rhs.dump(tree.comp, w);
3402
3431
  try w.writeByte('\n');
3403
- try config.setColor(w, .reset);
3432
+ try term.setColor(.reset);
3404
3433
  },
3405
3434
  .builtin_convertvector => |convert| {
3406
3435
  try w.splatByteAll(' ', level + half);
3407
3436
  try w.writeAll("operand:\n");
3408
- try tree.dumpNode(convert.operand, level + delta, config, w);
3437
+ try tree.dumpNode(convert.operand, level + delta, term);
3409
3438
  },
3410
3439
  .builtin_shufflevector => |shuffle| {
3411
3440
  try w.splatByteAll(' ', level + half);
3412
3441
  try w.writeAll("lhs:\n");
3413
- try tree.dumpNode(shuffle.lhs, level + delta, config, w);
3442
+ try tree.dumpNode(shuffle.lhs, level + delta, term);
3414
3443
 
3415
3444
  try w.splatByteAll(' ', level + half);
3416
3445
  try w.writeAll("rhs:\n");
3417
- try tree.dumpNode(shuffle.rhs, level + delta, config, w);
3446
+ try tree.dumpNode(shuffle.rhs, level + delta, term);
3418
3447
 
3419
3448
  if (shuffle.indexes.len > 0) {
3420
3449
  try w.splatByteAll(' ', level + half);
3421
3450
  try w.writeAll("indexes:\n");
3422
3451
  for (shuffle.indexes) |index| {
3423
- try tree.dumpNode(index, level + delta, config, w);
3452
+ try tree.dumpNode(index, level + delta, term);
3424
3453
  }
3425
3454
  }
3426
3455
  },
3456
+ .builtin_va_arg_pack, .builtin_va_arg_pack_len => {},
3427
3457
  .if_stmt => |@"if"| {
3428
3458
  try w.splatByteAll(' ', level + half);
3429
3459
  try w.writeAll("cond:\n");
3430
- try tree.dumpNode(@"if".cond, level + delta, config, w);
3460
+ try tree.dumpNode(@"if".cond, level + delta, term);
3431
3461
 
3432
3462
  try w.splatByteAll(' ', level + half);
3433
3463
  try w.writeAll("then:\n");
3434
- try tree.dumpNode(@"if".then_body, level + delta, config, w);
3464
+ try tree.dumpNode(@"if".then_body, level + delta, term);
3435
3465
 
3436
3466
  if (@"if".else_body) |some| {
3437
3467
  try w.splatByteAll(' ', level + half);
3438
3468
  try w.writeAll("else:\n");
3439
- try tree.dumpNode(some, level + delta, config, w);
3469
+ try tree.dumpNode(some, level + delta, term);
3440
3470
  }
3441
3471
  },
3442
3472
  .switch_stmt => |@"switch"| {
3443
3473
  try w.splatByteAll(' ', level + half);
3444
3474
  try w.writeAll("cond:\n");
3445
- try tree.dumpNode(@"switch".cond, level + delta, config, w);
3475
+ try tree.dumpNode(@"switch".cond, level + delta, term);
3446
3476
 
3447
3477
  try w.splatByteAll(' ', level + half);
3448
3478
  try w.writeAll("body:\n");
3449
- try tree.dumpNode(@"switch".body, level + delta, config, w);
3479
+ try tree.dumpNode(@"switch".body, level + delta, term);
3450
3480
  },
3451
3481
  .while_stmt => |@"while"| {
3452
3482
  try w.splatByteAll(' ', level + half);
3453
3483
  try w.writeAll("cond:\n");
3454
- try tree.dumpNode(@"while".cond, level + delta, config, w);
3484
+ try tree.dumpNode(@"while".cond, level + delta, term);
3455
3485
 
3456
3486
  try w.splatByteAll(' ', level + half);
3457
3487
  try w.writeAll("body:\n");
3458
- try tree.dumpNode(@"while".body, level + delta, config, w);
3488
+ try tree.dumpNode(@"while".body, level + delta, term);
3459
3489
  },
3460
3490
  .do_while_stmt => |do| {
3461
3491
  try w.splatByteAll(' ', level + half);
3462
3492
  try w.writeAll("cond:\n");
3463
- try tree.dumpNode(do.cond, level + delta, config, w);
3493
+ try tree.dumpNode(do.cond, level + delta, term);
3464
3494
 
3465
3495
  try w.splatByteAll(' ', level + half);
3466
3496
  try w.writeAll("body:\n");
3467
- try tree.dumpNode(do.body, level + delta, config, w);
3497
+ try tree.dumpNode(do.body, level + delta, term);
3468
3498
  },
3469
3499
  .for_stmt => |@"for"| {
3470
3500
  switch (@"for".init) {
@@ -3472,48 +3502,48 @@ fn dumpNode(
3472
3502
  try w.splatByteAll(' ', level + half);
3473
3503
  try w.writeAll("decl:\n");
3474
3504
  for (decls) |decl| {
3475
- try tree.dumpNode(decl, level + delta, config, w);
3505
+ try tree.dumpNode(decl, level + delta, term);
3476
3506
  try w.writeByte('\n');
3477
3507
  }
3478
3508
  },
3479
3509
  .expr => |expr| if (expr) |some| {
3480
3510
  try w.splatByteAll(' ', level + half);
3481
3511
  try w.writeAll("init:\n");
3482
- try tree.dumpNode(some, level + delta, config, w);
3512
+ try tree.dumpNode(some, level + delta, term);
3483
3513
  },
3484
3514
  }
3485
3515
  if (@"for".cond) |some| {
3486
3516
  try w.splatByteAll(' ', level + half);
3487
3517
  try w.writeAll("cond:\n");
3488
- try tree.dumpNode(some, level + delta, config, w);
3518
+ try tree.dumpNode(some, level + delta, term);
3489
3519
  }
3490
3520
  if (@"for".incr) |some| {
3491
3521
  try w.splatByteAll(' ', level + half);
3492
3522
  try w.writeAll("incr:\n");
3493
- try tree.dumpNode(some, level + delta, config, w);
3523
+ try tree.dumpNode(some, level + delta, term);
3494
3524
  }
3495
3525
  try w.splatByteAll(' ', level + half);
3496
3526
  try w.writeAll("body:\n");
3497
- try tree.dumpNode(@"for".body, level + delta, config, w);
3527
+ try tree.dumpNode(@"for".body, level + delta, term);
3498
3528
  },
3499
3529
  .addr_of_label => |addr| {
3500
3530
  try w.splatByteAll(' ', level + half);
3501
3531
  try w.writeAll("label: ");
3502
- try config.setColor(w, LITERAL);
3532
+ try term.setColor(LITERAL);
3503
3533
  try w.print("{s}\n", .{tree.tokSlice(addr.label_tok)});
3504
- try config.setColor(w, .reset);
3534
+ try term.setColor(.reset);
3505
3535
  },
3506
3536
  .goto_stmt => |goto| {
3507
3537
  try w.splatByteAll(' ', level + half);
3508
3538
  try w.writeAll("label: ");
3509
- try config.setColor(w, LITERAL);
3539
+ try term.setColor(LITERAL);
3510
3540
  try w.print("{s}\n", .{tree.tokSlice(goto.label_tok)});
3511
- try config.setColor(w, .reset);
3541
+ try term.setColor(.reset);
3512
3542
  },
3513
3543
  .computed_goto_stmt => |goto| {
3514
3544
  try w.splatByteAll(' ', level + half);
3515
3545
  try w.writeAll("expr:\n");
3516
- try tree.dumpNode(goto.expr, level + delta, config, w);
3546
+ try tree.dumpNode(goto.expr, level + delta, term);
3517
3547
  },
3518
3548
  .continue_stmt, .break_stmt, .null_stmt => {},
3519
3549
  .return_stmt => |ret| {
@@ -3521,43 +3551,43 @@ fn dumpNode(
3521
3551
  .expr => |expr| {
3522
3552
  try w.splatByteAll(' ', level + half);
3523
3553
  try w.writeAll("expr:\n");
3524
- try tree.dumpNode(expr, level + delta, config, w);
3554
+ try tree.dumpNode(expr, level + delta, term);
3525
3555
  },
3526
3556
  .implicit => {},
3527
3557
  .none => {},
3528
3558
  }
3529
3559
  },
3530
3560
  .asm_stmt => |@"asm"| {
3531
- try tree.dumpNode(@"asm".asm_str, level + delta, config, w);
3561
+ try tree.dumpNode(@"asm".asm_str, level + delta, term);
3532
3562
 
3533
3563
  const write_operand = struct {
3534
3564
  fn write_operand(
3535
- _w: *std.Io.Writer,
3536
3565
  _level: u32,
3537
- _config: std.Io.tty.Config,
3566
+ _term: std.Io.Terminal,
3538
3567
  _tree: *const Tree,
3539
3568
  operands: []const Node.AsmStmt.Operand,
3540
- ) std.Io.tty.Config.SetColorError!void {
3569
+ ) std.Io.Terminal.SetColorError!void {
3570
+ const _w = _term.writer;
3541
3571
  for (operands) |operand| {
3542
3572
  if (operand.name != 0) {
3543
3573
  try _w.splatByteAll(' ', _level + delta);
3544
3574
  try _w.writeAll("asm name: ");
3545
- try _config.setColor(_w, NAME);
3575
+ try _term.setColor(NAME);
3546
3576
  try _w.writeAll(_tree.tokSlice(operand.name));
3547
3577
  try _w.writeByte('\n');
3548
- try _config.setColor(_w, .reset);
3578
+ try _term.setColor(.reset);
3549
3579
  }
3550
3580
 
3551
3581
  try _w.splatByteAll(' ', _level + delta);
3552
3582
  try _w.writeAll("constraint: ");
3553
3583
  const constraint_val = _tree.value_map.get(operand.constraint).?;
3554
- try _config.setColor(_w, LITERAL);
3584
+ try _term.setColor(LITERAL);
3555
3585
  _ = try constraint_val.print(operand.constraint.qt(_tree), _tree.comp, _w);
3556
3586
  try _w.writeByte('\n');
3557
3587
 
3558
- try _tree.dumpNode(operand.expr, _level + delta, _config, _w);
3588
+ try _tree.dumpNode(operand.expr, _level + delta, _term);
3559
3589
  }
3560
- try _config.setColor(_w, .reset);
3590
+ try _term.setColor(.reset);
3561
3591
  }
3562
3592
  }.write_operand;
3563
3593
 
@@ -3565,18 +3595,18 @@ fn dumpNode(
3565
3595
  try w.splatByteAll(' ', level + half);
3566
3596
  try w.writeAll("ouputs:\n");
3567
3597
 
3568
- try write_operand(w, level, config, tree, @"asm".outputs);
3598
+ try write_operand(level, term, tree, @"asm".outputs);
3569
3599
  }
3570
3600
  if (@"asm".inputs.len > 0) {
3571
3601
  try w.splatByteAll(' ', level + half);
3572
3602
  try w.writeAll("inputs:\n");
3573
3603
 
3574
- try write_operand(w, level, config, tree, @"asm".inputs);
3604
+ try write_operand(level, term, tree, @"asm".inputs);
3575
3605
  }
3576
3606
  if (@"asm".clobbers.len > 0) {
3577
3607
  try w.splatByteAll(' ', level + half);
3578
3608
  try w.writeAll("clobbers:\n");
3579
- try config.setColor(w, LITERAL);
3609
+ try term.setColor(LITERAL);
3580
3610
  for (@"asm".clobbers) |clobber| {
3581
3611
  const clobber_val = tree.value_map.get(clobber).?;
3582
3612
 
@@ -3584,41 +3614,41 @@ fn dumpNode(
3584
3614
  _ = try clobber_val.print(clobber.qt(tree), tree.comp, w);
3585
3615
  try w.writeByte('\n');
3586
3616
  }
3587
- try config.setColor(w, .reset);
3617
+ try term.setColor(.reset);
3588
3618
  }
3589
3619
  if (@"asm".labels.len > 0) {
3590
3620
  try w.splatByteAll(' ', level + half);
3591
3621
  try w.writeAll("labels:\n");
3592
3622
  for (@"asm".labels) |label| {
3593
- try tree.dumpNode(label, level + delta, config, w);
3623
+ try tree.dumpNode(label, level + delta, term);
3594
3624
  }
3595
3625
  }
3596
3626
  },
3597
3627
  .call_expr => |call| {
3598
3628
  try w.splatByteAll(' ', level + half);
3599
3629
  try w.writeAll("callee:\n");
3600
- try tree.dumpNode(call.callee, level + delta, config, w);
3630
+ try tree.dumpNode(call.callee, level + delta, term);
3601
3631
 
3602
3632
  if (call.args.len > 0) {
3603
3633
  try w.splatByteAll(' ', level + half);
3604
3634
  try w.writeAll("args:\n");
3605
3635
  for (call.args) |arg| {
3606
- try tree.dumpNode(arg, level + delta, config, w);
3636
+ try tree.dumpNode(arg, level + delta, term);
3607
3637
  }
3608
3638
  }
3609
3639
  },
3610
3640
  .builtin_call_expr => |call| {
3611
3641
  try w.splatByteAll(' ', level + half);
3612
3642
  try w.writeAll("name: ");
3613
- try config.setColor(w, NAME);
3643
+ try term.setColor(NAME);
3614
3644
  try w.print("{s}\n", .{tree.tokSlice(call.builtin_tok)});
3615
- try config.setColor(w, .reset);
3645
+ try term.setColor(.reset);
3616
3646
 
3617
3647
  if (call.args.len > 0) {
3618
3648
  try w.splatByteAll(' ', level + half);
3619
3649
  try w.writeAll("args:\n");
3620
3650
  for (call.args) |arg| {
3621
- try tree.dumpNode(arg, level + delta, config, w);
3651
+ try tree.dumpNode(arg, level + delta, term);
3622
3652
  }
3623
3653
  }
3624
3654
  },
@@ -3655,13 +3685,13 @@ fn dumpNode(
3655
3685
  => |bin| {
3656
3686
  try w.splatByteAll(' ', level + 1);
3657
3687
  try w.writeAll("lhs:\n");
3658
- try tree.dumpNode(bin.lhs, level + delta, config, w);
3688
+ try tree.dumpNode(bin.lhs, level + delta, term);
3659
3689
 
3660
3690
  try w.splatByteAll(' ', level + 1);
3661
3691
  try w.writeAll("rhs:\n");
3662
- try tree.dumpNode(bin.rhs, level + delta, config, w);
3692
+ try tree.dumpNode(bin.rhs, level + delta, term);
3663
3693
  },
3664
- .cast => |cast| try tree.dumpNode(cast.operand, level + delta, config, w),
3694
+ .cast => |cast| try tree.dumpNode(cast.operand, level + delta, term),
3665
3695
  .addr_of_expr,
3666
3696
  .deref_expr,
3667
3697
  .plus_expr,
@@ -3680,21 +3710,21 @@ fn dumpNode(
3680
3710
  => |un| {
3681
3711
  try w.splatByteAll(' ', level + 1);
3682
3712
  try w.writeAll("operand:\n");
3683
- try tree.dumpNode(un.operand, level + delta, config, w);
3713
+ try tree.dumpNode(un.operand, level + delta, term);
3684
3714
  },
3685
3715
  .decl_ref_expr, .enumeration_ref => |dr| {
3686
3716
  try w.splatByteAll(' ', level + 1);
3687
3717
  try w.writeAll("name: ");
3688
- try config.setColor(w, NAME);
3718
+ try term.setColor(NAME);
3689
3719
  try w.print("{s}\n", .{tree.tokSlice(dr.name_tok)});
3690
- try config.setColor(w, .reset);
3720
+ try term.setColor(.reset);
3691
3721
  },
3692
3722
  .builtin_ref => |dr| {
3693
3723
  try w.splatByteAll(' ', level + 1);
3694
3724
  try w.writeAll("name: ");
3695
- try config.setColor(w, NAME);
3725
+ try term.setColor(NAME);
3696
3726
  try w.print("{s}\n", .{tree.tokSlice(dr.name_tok)});
3697
- try config.setColor(w, .reset);
3727
+ try term.setColor(.reset);
3698
3728
  },
3699
3729
  .bool_literal,
3700
3730
  .nullptr_literal,
@@ -3706,7 +3736,7 @@ fn dumpNode(
3706
3736
  .member_access_expr, .member_access_ptr_expr => |access| {
3707
3737
  try w.splatByteAll(' ', level + 1);
3708
3738
  try w.writeAll("lhs:\n");
3709
- try tree.dumpNode(access.base, level + delta, config, w);
3739
+ try tree.dumpNode(access.base, level + delta, term);
3710
3740
 
3711
3741
  var base_qt = access.base.qt(tree);
3712
3742
  if (base_qt.get(tree.comp, .pointer)) |some| base_qt = some.child;
@@ -3714,61 +3744,61 @@ fn dumpNode(
3714
3744
 
3715
3745
  try w.splatByteAll(' ', level + 1);
3716
3746
  try w.writeAll("name: ");
3717
- try config.setColor(w, NAME);
3747
+ try term.setColor(NAME);
3718
3748
  try w.print("{s}\n", .{fields[access.member_index].name.lookup(tree.comp)});
3719
- try config.setColor(w, .reset);
3749
+ try term.setColor(.reset);
3720
3750
  },
3721
3751
  .array_access_expr => |access| {
3722
3752
  try w.splatByteAll(' ', level + 1);
3723
3753
  try w.writeAll("base:\n");
3724
- try tree.dumpNode(access.base, level + delta, config, w);
3754
+ try tree.dumpNode(access.base, level + delta, term);
3725
3755
 
3726
3756
  try w.splatByteAll(' ', level + 1);
3727
3757
  try w.writeAll("index:\n");
3728
- try tree.dumpNode(access.index, level + delta, config, w);
3758
+ try tree.dumpNode(access.index, level + delta, term);
3729
3759
  },
3730
3760
  .sizeof_expr, .alignof_expr => |type_info| {
3731
3761
  if (type_info.expr) |some| {
3732
3762
  try w.splatByteAll(' ', level + 1);
3733
3763
  try w.writeAll("expr:\n");
3734
- try tree.dumpNode(some, level + delta, config, w);
3764
+ try tree.dumpNode(some, level + delta, term);
3735
3765
  } else {
3736
3766
  try w.splatByteAll(' ', level + half);
3737
3767
  try w.writeAll("operand type: ");
3738
- try config.setColor(w, TYPE);
3768
+ try term.setColor(TYPE);
3739
3769
  try type_info.operand_qt.dump(tree.comp, w);
3740
3770
  try w.writeByte('\n');
3741
- try config.setColor(w, .reset);
3771
+ try term.setColor(.reset);
3742
3772
  }
3743
3773
  },
3744
3774
  .generic_expr => |generic| {
3745
3775
  try w.splatByteAll(' ', level + 1);
3746
3776
  try w.writeAll("controlling:\n");
3747
- try tree.dumpNode(generic.controlling, level + delta, config, w);
3777
+ try tree.dumpNode(generic.controlling, level + delta, term);
3748
3778
  try w.splatByteAll(' ', level + 1);
3749
3779
  try w.writeAll("chosen:\n");
3750
- try tree.dumpNode(generic.chosen, level + delta, config, w);
3780
+ try tree.dumpNode(generic.chosen, level + delta, term);
3751
3781
 
3752
3782
  if (generic.rest.len > 0) {
3753
3783
  try w.splatByteAll(' ', level + 1);
3754
3784
  try w.writeAll("rest:\n");
3755
3785
  for (generic.rest) |expr| {
3756
- try tree.dumpNode(expr, level + delta, config, w);
3786
+ try tree.dumpNode(expr, level + delta, term);
3757
3787
  }
3758
3788
  }
3759
3789
  },
3760
3790
  .generic_association_expr => |assoc| {
3761
- try tree.dumpNode(assoc.expr, level + delta, config, w);
3791
+ try tree.dumpNode(assoc.expr, level + delta, term);
3762
3792
  },
3763
3793
  .generic_default_expr => |default| {
3764
- try tree.dumpNode(default.expr, level + delta, config, w);
3794
+ try tree.dumpNode(default.expr, level + delta, term);
3765
3795
  },
3766
3796
  .array_filler_expr => |filler| {
3767
3797
  try w.splatByteAll(' ', level + 1);
3768
3798
  try w.writeAll("count: ");
3769
- try config.setColor(w, LITERAL);
3799
+ try term.setColor(LITERAL);
3770
3800
  try w.print("{d}\n", .{filler.count});
3771
- try config.setColor(w, .reset);
3801
+ try term.setColor(.reset);
3772
3802
  },
3773
3803
  .struct_forward_decl,
3774
3804
  .union_forward_decl,