From 35156988d3a2770808d8e4023960cf7b957470e6 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Thu, 26 Feb 2026 10:43:08 +0000 Subject: [PATCH] docs: add documentation for functions in PR #56834 --- src/main.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.zig b/src/main.zig index cd0c056..b95ee14 100644 --- a/src/main.zig +++ b/src/main.zig @@ -6,12 +6,18 @@ 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. +/// If fast_exit is true, terminates the process immediately; otherwise returns exit code 1. +/// Returns: Exit code (0 on successful handling with fast_exit=false, 1 otherwise) fn handleOutOfMemory(fast_exit: bool) u8 { std.debug.print("out of memory\n", .{}); if (fast_exit) process.exit(1); return 1; } +/// Handles generic errors by dispatching to appropriate handlers based on error type. +/// Currently handles OutOfMemory errors by calling handleOutOfMemory. +/// Returns: Exit code from the specific error handler (typically 0 on success, 1 on failure) fn handleError(fast_exit: bool, er: anyerror) u8 { return switch (er) { error.OutOfMemory => handleOutOfMemory(fast_exit), -- Gitee