Skip to content

Commit 9eab64c

Browse files
committed
assert that MetaModel.Property.optional is null
1 parent 92ec5be commit 9eab64c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/codegen/codegen.zig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ const Renderer = struct {
572572
}
573573

574574
fn renderProperty(r: *Renderer, property: MetaModel.Property) error{WriteFailed}!void {
575+
std.debug.assert(property.optional == null);
575576
if (property.documentation) |docs| try r.w.print("{f}", .{fmtDocs(docs, .doc)});
576577

577578
try r.w.print("{f}", .{std.zig.fmtIdPU(property.name)});
@@ -603,6 +604,7 @@ const Renderer = struct {
603604
var has_properties = false;
604605

605606
skip: for (properties) |property| {
607+
std.debug.assert(property.optional == null);
606608
if (maybe_extender) |ext| {
607609
for (ext.properties) |ext_property| {
608610
if (std.mem.eql(u8, property.name, ext_property.name)) {
@@ -807,6 +809,7 @@ fn constructSymbolTree(
807809
const expect_optional = std.mem.endsWith(u8, property_name, ".?");
808810
const trimmed_property_name = property_name[0 .. property_name.len - @as(usize, if (expect_optional) 2 else 0)];
809811
const property = lookupProperty(trimmed_property_name, meta_model);
812+
std.debug.assert(property.optional == null);
810813

811814
if (expect_optional) property.type = unwrapOptional(property.type).?;
812815

0 commit comments

Comments
 (0)