From 402fc6b7c756febf873173646ecf708b88f0c8a1 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Fri, 27 Feb 2026 11:07:16 +0000 Subject: [PATCH] docs: add documentation comments for error handling functions in PR #56834 --- src/main.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.zig b/src/main.zig index cd0c056..332d4ad 100644 --- a/src/main.zig +++ b/src/main.zig @@ -6,12 +6,19 @@ const Driver = aro.Driver; const Toolchain = aro.Toolchain; const assembly_backend = @import("assembly_backend"); +/// Handles out-of-memory error by printing a message and optionally exiting. +/// @param fast_exit - If true, exits the process immediately with code 1. +/// @returns 1 to indicate error condition. fn handleOutOfMemory(fast_exit: bool) u8 { std.debug.print("out of memory\n", .{}); if (fast_exit) process.exit(1); return 1; } +/// Dispatches error handling based on error type. +/// @param fast_exit - If true, exits the process immediately on fatal errors. +/// @param er - The error to handle. +/// @returns 1 if error was handled, otherwise 0. fn handleError(fast_exit: bool, er: anyerror) u8 { return switch (er) { error.OutOfMemory => handleOutOfMemory(fast_exit), -- Gitee