[api] Fall back to RAW_ENCODE_MAP when SMALL_MAP has no entry

This commit is contained in:
J. Nick Koston
2026-04-03 12:31:44 -10:00
parent f3238a857e
commit fa80caf0ff
+5 -6
View File
@@ -259,12 +259,11 @@ class TypeInfo(ABC):
if tag >= 128:
return None
max_val = self.max_value
encode_map = (
self.RAW_ENCODE_SMALL_MAP
if max_val is not None and max_val < 128
else self.RAW_ENCODE_MAP
)
raw_expr = encode_map.get(self.encode_func)
raw_expr = None
if max_val is not None and max_val < 128:
raw_expr = self.RAW_ENCODE_SMALL_MAP.get(self.encode_func)
if raw_expr is None:
raw_expr = self.RAW_ENCODE_MAP.get(self.encode_func)
if raw_expr is None:
return None
return f"buffer.write_raw_byte({tag});\n{raw_expr.format(value=value_expr)}"