forked from solstice/solstice
Lambdas now capture state
This commit is contained in:
@@ -734,12 +734,7 @@ ResultType(GroundProgram, charptr) generateLambdaNode(SolsNode* node, SolsScope*
|
|||||||
groundAddInstructionToProgram(&gp, signature);
|
groundAddInstructionToProgram(&gp, signature);
|
||||||
|
|
||||||
// Create a scope for lambda arguments
|
// Create a scope for lambda arguments
|
||||||
// Lambdas do NOT have access to external state
|
SolsScope lambdaScope = copySolsScope(scope);
|
||||||
SolsScope lambdaScope = {
|
|
||||||
.variables = NULL,
|
|
||||||
.tmpCounter = 0,
|
|
||||||
.returnType = *node->as.type.returnType
|
|
||||||
};
|
|
||||||
|
|
||||||
for (size_t i = 0; i < node->as.type.children.count; i++) {
|
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);
|
addVariableToScope(&lambdaScope, node->as.type.children.at[i].name, node->as.type.children.at[i].type);
|
||||||
|
|||||||
Reference in New Issue
Block a user