chore: add comment to explain fix
This commit is contained in:
parent
045150964b
commit
9d1d8f26c9
1 changed files with 3 additions and 0 deletions
|
@ -1010,6 +1010,9 @@ fn writeStructureJson(params: WriteMemberJsonParams, writer: std.io.AnyWriter) !
|
||||||
try writer.writeAll("try jw.beginObject();\n");
|
try writer.writeAll("try jw.beginObject();\n");
|
||||||
try writer.writeAll("{\n");
|
try writer.writeAll("{\n");
|
||||||
|
|
||||||
|
// this is a workaround in case a child structure doesn't have any fields
|
||||||
|
// and therefore doesn't use the structure variable so we capture it here.
|
||||||
|
// the compiler should optimize this away
|
||||||
try writer.print("const unused_capture_{s} = {s};\n", .{ structure_name, object_value });
|
try writer.print("const unused_capture_{s} = {s};\n", .{ structure_name, object_value });
|
||||||
try writer.print("_ = unused_capture_{s};\n", .{structure_name});
|
try writer.print("_ = unused_capture_{s};\n", .{structure_name});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue