mirror of
https://github.com/esphome/esphome.git
synced 2026-07-11 01:15:33 +00:00
Merge remote-tracking branch 'origin/devirtualize-proto-encode' into integration
This commit is contained in:
@@ -468,7 +468,8 @@ class ProtoMessage {
|
||||
virtual const char *message_name() const { return "unknown"; }
|
||||
#endif
|
||||
|
||||
// Non-virtual: messages are never deleted polymorphically.
|
||||
protected:
|
||||
// Non-virtual destructor is protected to prevent polymorphic deletion.
|
||||
~ProtoMessage() = default;
|
||||
};
|
||||
|
||||
|
||||
@@ -280,6 +280,9 @@ class TypeInfo(ABC):
|
||||
"""
|
||||
field_id_size = self.calculate_field_id_size()
|
||||
method = f"calc_{base_method}_force" if force else f"calc_{base_method}"
|
||||
# calc_bool_force only takes field_id_size (no value needed - bool is always 1 byte)
|
||||
if base_method == "bool" and force:
|
||||
return f"size += ProtoSize::{method}({field_id_size});"
|
||||
value = value_expr or name
|
||||
return f"size += ProtoSize::{method}({field_id_size}, {value});"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user