From e49ed1b7adeffc55ab541f0d6d9748c1ffa612d7 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Sat, 5 Aug 2023 13:00:55 -0700 Subject: [PATCH] found fix for comptime decl stuff, avoid more codegen changes --- src/aws.zig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/aws.zig b/src/aws.zig index 118c8a1..da03d1d 100644 --- a/src/aws.zig +++ b/src/aws.zig @@ -983,13 +983,13 @@ fn buildQuery(allocator: std.mem.Allocator, request: anytype) ![]const u8 { const writer = buffer.writer(); defer buffer.deinit(); var prefix = "?"; - // TODO: This was a pain before, and it's a pain now. Clearly our codegen - // needs to emit a declaration 100% of the time - const query_arguments = @TypeOf(request).http_query; - inline for (@typeInfo(@TypeOf(query_arguments)).Struct.fields) |arg| { - const val = @field(request, arg.name); - if (try addQueryArg(arg.type, prefix, @field(query_arguments, arg.name), val, writer)) - prefix = "&"; + if (@hasDecl(@TypeOf(request), "http_query")) { + const query_arguments = @field(@TypeOf(request), "http_query"); + inline for (@typeInfo(@TypeOf(query_arguments)).Struct.fields) |arg| { + const val = @field(request, arg.name); + if (try addQueryArg(arg.type, prefix, @field(query_arguments, arg.name), val, writer)) + prefix = "&"; + } } return buffer.toOwnedSlice(); }