From af9c467d2eea9ca07e1ba66b2b02c1e6fc082ffb Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sun, 28 Dec 2025 22:12:24 -0800 Subject: [PATCH] make do only inline in release mode --- src/lib.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.zig b/src/lib.zig index d10f7cfde037a58544a258ba6973ef943c7f7276..28b7c483b4a58801e4f7da8a8abc2f850207ed21 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -13,10 +13,13 @@ const htmlentities = @import("htmlentities"); const root = @import("root"); const tracer = @import("tracer"); const extras = @import("extras"); +const builtin = @import("builtin"); const tokenize = @import("./tokenize.zig"); const astgen = @import("./astgen.zig"); +const callconv_inline: std.builtin.CallingConvention = if (builtin.mode == .Debug) .auto else .@"inline"; + pub fn parse(comptime input: string) astgen.Value { return astgen.Value{ .element = astgen.do(tokenize.do(input, &.{ '[', '=', ']', '(', ')', '{', '}', '#', '/', '.', '<', '>' })) }; } @@ -41,7 +44,7 @@ pub fn compileInner(alloc: std.mem.Allocator, writer: anytype, comptime value: a pub const Writer = std.ArrayList(u8).Writer; -inline fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype, comptime opts: DoOptions) anyerror!void { +fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype, comptime opts: DoOptions) callconv(callconv_inline) anyerror!void { switch (comptime value) { .element => |v| { const hastext = comptime for (v.children) |x| { -- 2.54.0