Fix merge issues: write_short_string to static ProtoEncode, add debug arg

- Convert ProtoEncode::write_short_string to static method with pos param
- Fix codegen to emit ProtoEncode::write_short_string(pos, ...)
- Add PROTO_ENCODE_DEBUG_INIT to encode_fn call in encode_to_buffer

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
J. Nick Koston
2026-04-06 08:33:13 -10:00
co-authored by Claude Opus 4.6
parent 7122fb6f88
commit 33285dfe27
4 changed files with 56 additions and 56 deletions
+1 -1
View File
@@ -1091,7 +1091,7 @@ class PointerToStringBufferType(PointerToBufferTypeBase):
if max_len is not None and max_len < 128 and self.force:
tag = self.calculate_tag()
if tag < 128:
return f"buffer.write_short_string({tag}, this->{self.field_name});"
return f"ProtoEncode::write_short_string(pos PROTO_ENCODE_DEBUG_ARG, {tag}, this->{self.field_name});"
if result := self._encode_bytes_with_precomputed_tag(
f"this->{self.field_name}.c_str()",
f"this->{self.field_name}.size()",