Use C++ iterators for Lists in many situations

This commit is contained in:
Aaron Franke 2021-07-15 23:45:57 -04:00
parent b918c4c3ce
commit 4e6efd1b07
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
218 changed files with 2755 additions and 3004 deletions

View file

@ -1459,8 +1459,8 @@ void GDScriptByteCodeGenerator::write_endfor() {
}
// Patch break statements.
for (const List<int>::Element *E = current_breaks_to_patch.back()->get().front(); E; E = E->next()) {
patch_jump(E->get());
for (const int &E : current_breaks_to_patch.back()->get()) {
patch_jump(E);
}
current_breaks_to_patch.pop_back();
@ -1494,8 +1494,8 @@ void GDScriptByteCodeGenerator::write_endwhile() {
while_jmp_addrs.pop_back();
// Patch break statements.
for (const List<int>::Element *E = current_breaks_to_patch.back()->get().front(); E; E = E->next()) {
patch_jump(E->get());
for (const int &E : current_breaks_to_patch.back()->get()) {
patch_jump(E);
}
current_breaks_to_patch.pop_back();
}
@ -1506,8 +1506,8 @@ void GDScriptByteCodeGenerator::start_match() {
void GDScriptByteCodeGenerator::start_match_branch() {
// Patch continue statements.
for (const List<int>::Element *E = match_continues_to_patch.back()->get().front(); E; E = E->next()) {
patch_jump(E->get());
for (const int &E : match_continues_to_patch.back()->get()) {
patch_jump(E);
}
match_continues_to_patch.pop_back();
// Start a new list for next branch.
@ -1516,8 +1516,8 @@ void GDScriptByteCodeGenerator::start_match_branch() {
void GDScriptByteCodeGenerator::end_match() {
// Patch continue statements.
for (const List<int>::Element *E = match_continues_to_patch.back()->get().front(); E; E = E->next()) {
patch_jump(E->get());
for (const int &E : match_continues_to_patch.back()->get()) {
patch_jump(E);
}
match_continues_to_patch.pop_back();
}