[core] Fix for missing arguments to shared_lambda (#12115)

This commit is contained in:
Clyde Stubbs
2025-11-26 17:05:45 -06:00
committed by GitHub
parent eb970cf44e
commit caaa08d678
3 changed files with 15 additions and 9 deletions
+1 -7
View File
@@ -659,7 +659,7 @@ async def get_variable_with_full_id(id_: ID) -> tuple[ID, "MockObj"]:
async def process_lambda(
value: Lambda,
parameters: TemplateArgsType,
capture: str = "=",
capture: str = "",
return_type: SafeExpType = None,
) -> LambdaExpression | None:
"""Process the given lambda value into a LambdaExpression.
@@ -702,12 +702,6 @@ async def process_lambda(
parts[i * 3 + 1] = var
parts[i * 3 + 2] = ""
# All id() references are global variables in generated C++ code.
# Global variables should not be captured - they're accessible everywhere.
# Use empty capture instead of capture-by-value.
if capture == "=":
capture = ""
if isinstance(value, ESPHomeDataBase) and value.esp_range is not None:
location = value.esp_range.start_mark
location.line += value.content_offset