1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 19:32:19 +01:00

Reserve memory for component and platform vectors (#9042)

This commit is contained in:
J. Nick Koston
2025-06-11 05:05:42 -05:00
committed by GitHub
parent a488c8cd5c
commit 3411e45a0a
23 changed files with 125 additions and 10 deletions

View File

@@ -579,13 +579,13 @@ def new_Pvariable(id_: ID, *args: SafeExpType) -> Pvariable:
return Pvariable(id_, rhs)
def add(expression: Expression | Statement):
def add(expression: Expression | Statement, prepend: bool = False):
"""Add an expression to the codegen section.
After this is called, the given given expression will
show up in the setup() function after this has been called.
"""
CORE.add(expression)
CORE.add(expression, prepend)
def add_global(expression: SafeExpType | Statement, prepend: bool = False):