authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-12-28 22:12:24 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-12-28 22:12:24 -08:00
logaf9c467d2eea9ca07e1ba66b2b02c1e6fc082ffb
tree12e86dad61fb8ff5aea6ae954df92716aa750156
parent706924ca682479a77cc64b1a1fa0f666365721ec

make do only inline in release mode


1 files changed, 4 insertions(+), 1 deletions(-)

src/lib.zig+4-1
...@@ -13,10 +13,13 @@ const htmlentities = @import("htmlentities");...@@ -13,10 +13,13 @@ const htmlentities = @import("htmlentities");
13const root = @import("root");13const root = @import("root");
14const tracer = @import("tracer");14const tracer = @import("tracer");
15const extras = @import("extras");15const extras = @import("extras");
16const builtin = @import("builtin");
1617
17const tokenize = @import("./tokenize.zig");18const tokenize = @import("./tokenize.zig");
18const astgen = @import("./astgen.zig");19const astgen = @import("./astgen.zig");
1920
21const callconv_inline: std.builtin.CallingConvention = if (builtin.mode == .Debug) .auto else .@"inline";
22
20pub fn parse(comptime input: string) astgen.Value {23pub fn parse(comptime input: string) astgen.Value {
21 return astgen.Value{ .element = astgen.do(tokenize.do(input, &.{ '[', '=', ']', '(', ')', '{', '}', '#', '/', '.', '<', '>' })) };24 return astgen.Value{ .element = astgen.do(tokenize.do(input, &.{ '[', '=', ']', '(', ')', '{', '}', '#', '/', '.', '<', '>' })) };
22}25}
...@@ -41,7 +44,7 @@ pub fn compileInner(alloc: std.mem.Allocator, writer: anytype, comptime value: a...@@ -41,7 +44,7 @@ pub fn compileInner(alloc: std.mem.Allocator, writer: anytype, comptime value: a
4144
42pub const Writer = std.ArrayList(u8).Writer;45pub const Writer = std.ArrayList(u8).Writer;
4346
44inline fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype, comptime opts: DoOptions) anyerror!void {47fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype, comptime opts: DoOptions) callconv(callconv_inline) anyerror!void {
45 switch (comptime value) {48 switch (comptime value) {
46 .element => |v| {49 .element => |v| {
47 const hastext = comptime for (v.children) |x| {50 const hastext = comptime for (v.children) |x| {