| ... | ... | @@ -295,7 +295,8 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val |
| 295 | 295 | } |
| 296 | 296 | }, |
| 297 | 297 | .function => |v| { |
| 298 | | if (!v.raw and @hasDecl(opts.Ctx, "pek_" ++ v.name)) { |
| 298 | if (!v.raw) { |
| 299 | if (@hasDecl(opts.Ctx, "pek__" ++ v.name)) @compileError("pek: attempted to call raw custom function: '_" ++ v.name ++ "' but did not use '{#" ++ v.name ++ "}'"); |
| 299 | 300 | const func = @field(opts.Ctx, "pek_" ++ v.name); |
| 300 | 301 | var list = std.Io.Writer.Allocating.init(alloc); |
| 301 | 302 | defer list.deinit(); |
| ... | ... | @@ -307,7 +308,8 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val |
| 307 | 308 | try writeReplacementString(writer, v.raw, opts.escaped, try list.toOwnedSlice()); |
| 308 | 309 | return; |
| 309 | 310 | } |
| 310 | | if (v.raw and @hasDecl(opts.Ctx, "pek__" ++ v.name)) { |
| 311 | if (v.raw) { |
| 312 | if (@hasDecl(opts.Ctx, "pek_" ++ v.name)) @compileError("pek: attempted to call safe custom function: '" ++ v.name ++ "' but did not use '{" ++ v.name ++ "}'"); |
| 311 | 313 | const func = @field(opts.Ctx, "pek__" ++ v.name); |
| 312 | 314 | var list = std.Io.Writer.Allocating.init(alloc); |
| 313 | 315 | defer list.deinit(); |
| ... | ... | @@ -326,13 +328,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val |
| 326 | 328 | try writeReplacementString(writer, v.raw, opts.escaped, list.written()); |
| 327 | 329 | return; |
| 328 | 330 | } |
| 329 | | if (v.raw and @hasDecl(opts.Ctx, "pek_" ++ v.name)) { |
| 330 | | @compileError("pek: attempted to call safe custom function: '" ++ v.name ++ "' but did not use '{" ++ v.name ++ "}'"); |
| 331 | | } |
| 332 | | if (!v.raw and @hasDecl(opts.Ctx, "pek__" ++ v.name)) { |
| 333 | | @compileError("pek: attempted to call raw custom function: '_" ++ v.name ++ "' but did not use '{#" ++ v.name ++ "}'"); |
| 334 | | } |
| 335 | | @compileError("pek: unknown custom function: " ++ v.name); |
| 331 | comptime unreachable; |
| 336 | 332 | }, |
| 337 | 333 | else => unreachable, |
| 338 | 334 | } |