address new compilation errors introduced in zig cf65ab8
This commit is contained in:
parent
ad7aa96678
commit
9c3be78d9f
|
@ -116,7 +116,7 @@ fn generateServices(allocator: *std.mem.Allocator, comptime terminator: []const
|
||||||
try writer.print("pub const {s}: struct ", .{constant_name});
|
try writer.print("pub const {s}: struct ", .{constant_name});
|
||||||
_ = try writer.write("{\n");
|
_ = try writer.write("{\n");
|
||||||
|
|
||||||
try writer.print(" version: []const u8 = \"{s}\",\n", .{service.shape.service.version});
|
try writer.print(" version: []const u8 = \"{s}\",\n", .{version});
|
||||||
try writer.print(" sdk_id: []const u8 = \"{s}\",\n", .{sdk_id});
|
try writer.print(" sdk_id: []const u8 = \"{s}\",\n", .{sdk_id});
|
||||||
try writer.print(" arn_namespace: []const u8 = \"{s}\",\n", .{arn_namespace});
|
try writer.print(" arn_namespace: []const u8 = \"{s}\",\n", .{arn_namespace});
|
||||||
try writer.print(" endpoint_prefix: []const u8 = \"{s}\",\n", .{endpoint_prefix});
|
try writer.print(" endpoint_prefix: []const u8 = \"{s}\",\n", .{endpoint_prefix});
|
||||||
|
@ -138,7 +138,7 @@ fn generateOperation(allocator: *std.mem.Allocator, operation: smithy.ShapeInfo,
|
||||||
const snake_case_name = try snake.fromPascalCase(allocator, operation.name);
|
const snake_case_name = try snake.fromPascalCase(allocator, operation.name);
|
||||||
defer allocator.free(snake_case_name);
|
defer allocator.free(snake_case_name);
|
||||||
|
|
||||||
comptime const prefix = " ";
|
const prefix = " ";
|
||||||
var type_stack = std.ArrayList(*const smithy.ShapeInfo).init(allocator);
|
var type_stack = std.ArrayList(*const smithy.ShapeInfo).init(allocator);
|
||||||
defer type_stack.deinit();
|
defer type_stack.deinit();
|
||||||
// indent should start at 4 spaces here
|
// indent should start at 4 spaces here
|
||||||
|
@ -242,7 +242,7 @@ fn generateTypeFor(allocator: *std.mem.Allocator, shape_id: []const u8, shapes:
|
||||||
}
|
}
|
||||||
try type_stack.append(&shape_info);
|
try type_stack.append(&shape_info);
|
||||||
switch (shape) {
|
switch (shape) {
|
||||||
.structure => |s| {
|
.structure => {
|
||||||
try generateComplexTypeFor(allocator, shape.structure.members, "struct", shapes, writer, prefix, all_required, type_stack);
|
try generateComplexTypeFor(allocator, shape.structure.members, "struct", shapes, writer, prefix, all_required, type_stack);
|
||||||
if (end_structure) {
|
if (end_structure) {
|
||||||
// epilog
|
// epilog
|
||||||
|
@ -250,7 +250,7 @@ fn generateTypeFor(allocator: *std.mem.Allocator, shape_id: []const u8, shapes:
|
||||||
_ = try writer.write("}");
|
_ = try writer.write("}");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.uniontype => |s| {
|
.uniontype => {
|
||||||
try generateComplexTypeFor(allocator, shape.uniontype.members, "union", shapes, writer, prefix, all_required, type_stack);
|
try generateComplexTypeFor(allocator, shape.uniontype.members, "union", shapes, writer, prefix, all_required, type_stack);
|
||||||
// epilog
|
// epilog
|
||||||
try writer.print("{s}", .{prefix});
|
try writer.print("{s}", .{prefix});
|
||||||
|
@ -258,11 +258,11 @@ fn generateTypeFor(allocator: *std.mem.Allocator, shape_id: []const u8, shapes:
|
||||||
},
|
},
|
||||||
.string => |s| try generateSimpleTypeFor(s, "[]const u8", writer, all_required),
|
.string => |s| try generateSimpleTypeFor(s, "[]const u8", writer, all_required),
|
||||||
.integer => |s| try generateSimpleTypeFor(s, "i64", writer, all_required),
|
.integer => |s| try generateSimpleTypeFor(s, "i64", writer, all_required),
|
||||||
.list => |s| {
|
.list => {
|
||||||
_ = try writer.write("[]");
|
_ = try writer.write("[]");
|
||||||
try generateTypeFor(allocator, shape.list.member_target, shapes, writer, prefix, all_required, type_stack, true);
|
try generateTypeFor(allocator, shape.list.member_target, shapes, writer, prefix, all_required, type_stack, true);
|
||||||
},
|
},
|
||||||
.set => |s| {
|
.set => {
|
||||||
_ = try writer.write("[]");
|
_ = try writer.write("[]");
|
||||||
try generateTypeFor(allocator, shape.set.member_target, shapes, writer, prefix, all_required, type_stack, true);
|
try generateTypeFor(allocator, shape.set.member_target, shapes, writer, prefix, all_required, type_stack, true);
|
||||||
},
|
},
|
||||||
|
@ -298,7 +298,12 @@ fn generateTypeFor(allocator: *std.mem.Allocator, shape_id: []const u8, shapes:
|
||||||
_ = type_stack.pop();
|
_ = type_stack.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generateSimpleTypeFor(shape: anytype, type_name: []const u8, writer: anytype, all_required: bool) !void {
|
// fn generateSimpleTypeFor(shape: anytype, type_name: []const u8, writer: anytype, _: bool) !void {
|
||||||
|
fn generateSimpleTypeFor(_: anytype, type_name: []const u8, writer: anytype, all_required: bool) !void {
|
||||||
|
// current compiler checks unused variables, but can't handle multiple unused
|
||||||
|
// function parameters. We don't want to change the signature in case we need to work with
|
||||||
|
// these in the future, so this stupid code is only here to trick the compiler
|
||||||
|
if (all_required or !all_required)
|
||||||
_ = try writer.write(type_name); // This had required stuff but the problem was elsewhere. Better to leave as function just in case
|
_ = try writer.write(type_name); // This had required stuff but the problem was elsewhere. Better to leave as function just in case
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user