Remove unneed linking in update_loop_data (#85)

Commit a5862a0 made the linking step in update_loop_data unecessary
because the loop's copy of the data was made to come from the parent
loop's data rather than the original client's data.

While at it, also add one more nested loop test case.
This commit is contained in:
Mark Hollomon authored and pantor committed 2019-01-27 19:35:27 +01:00
1 parent a5862a04dc
commit da5bbb1482
3 files changed
+32 -28

No files matched your search

+2 -14
View File
@@ -106,21 +106,9 @@ class Renderer {
}
}
void update_loop_data(bool link = true) {
void update_loop_data() {
LoopLevel& level = m_loop_stack.back();
if (link && (m_loop_stack.size() > 1)) {
for (int i = m_loop_stack.size() - 2; i >= 0; i--) {
auto& level_it = m_loop_stack.at(i);
if (level_it.loop_type == LoopLevel::Type::Array) {
level.data[static_cast<std::string>(level_it.value_name)] = level_it.values.at(level_it.index);
} else {
level.data[static_cast<std::string>(level_it.value_name)] = *level_it.map_it->second;
}
}
}
if (level.loop_type == LoopLevel::Type::Array) {
level.data[static_cast<std::string>(level.value_name)] = level.values.at(level.index); // *level.it;
auto& loopData = level.data["loop"];
@@ -551,7 +539,7 @@ class Renderer {
break;
}
update_loop_data(false);
update_loop_data();
// jump back to start of loop
i = bc.args - 1; // -1 due to ++i in loop