1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-06 05:12:21 +01:00
This commit is contained in:
J. Nick Koston
2025-07-21 20:02:22 -10:00
parent ede8e542bc
commit 44d7147ea4
2 changed files with 14 additions and 50 deletions

View File

@@ -569,6 +569,10 @@ class StringType(TypeInfo):
return f"buffer.encode_string({self.number}, this->{self.field_name}_ref_);"
def dump(self, name):
# If name is 'it', this is a repeated field element - always use string
if name == "it":
return "append_quoted_string(out, StringRef(it));"
# For SOURCE_CLIENT only, always use std::string
if not self._needs_encode:
return f'out.append("\'").append(this->{self.field_name}).append("\'");'