add foreach v loop for maps

This commit is contained in:
Ricardo Luís Vaz Silva 2023-10-15 13:35:06 -03:00 committed by Rachael Alexanderson
commit 5cb0e3bc5b
3 changed files with 49 additions and 13 deletions

View file

@ -3388,9 +3388,11 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast, bool substitute)
auto iter = static_cast<ZCC_ArrayIterationStmt*>(ast);
auto var = iter->ItName->Name;
FxExpression* const itArray = ConvertNode(iter->ItArray);
FxExpression* const itArray2 = ConvertNode(iter->ItArray); // the handler needs two copies of this - here's the easiest place to create them.
FxExpression* const itArray2 = ConvertNode(iter->ItArray);
FxExpression* const itArray3 = ConvertNode(iter->ItArray);
FxExpression* const itArray4 = ConvertNode(iter->ItArray); // the handler needs copies of this - here's the easiest place to create them.
FxExpression* const body = ConvertImplicitScopeNode(ast, iter->LoopStatement);
return new FxForEachLoop(iter->ItName->Name, itArray, itArray2, body, *ast);
return new FxForEachLoop(iter->ItName->Name, itArray, itArray2, itArray3, itArray4, body, *ast);
}
case AST_MapIterationStmt: