Lambdas now capture state

This commit is contained in:
2026-03-03 08:00:00 +11:00
parent 40e0aec0d4
commit cfca3c1d7a

View File

@@ -734,12 +734,7 @@ ResultType(GroundProgram, charptr) generateLambdaNode(SolsNode* node, SolsScope*
groundAddInstructionToProgram(&gp, signature);
// Create a scope for lambda arguments
// Lambdas do NOT have access to external state
SolsScope lambdaScope = {
.variables = NULL,
.tmpCounter = 0,
.returnType = *node->as.type.returnType
};
SolsScope lambdaScope = copySolsScope(scope);
for (size_t i = 0; i < node->as.type.children.count; i++) {
addVariableToScope(&lambdaScope, node->as.type.children.at[i].name, node->as.type.children.at[i].type);