Skip to content

Commit 44f1371

Browse files
committed
Remove outer loop from unsafe constant check
1 parent 8d82978 commit 44f1371

1 file changed

Lines changed: 14 additions & 21 deletions

File tree

‎src/engine/internal/engine.cpp‎

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -249,32 +249,25 @@ void Engine::compile()
249249
// Find unsafe constants (string numerals) in costume and sound names
250250
m_unsafeConstants.clear();
251251

252-
for (auto target : m_targets) {
253-
IEngine *engine = target->engine();
254-
255-
if (engine) {
256-
auto checkConstant = [this](const std::string &str) {
257-
Value stringValue(str);
258-
Value numberValue(stringValue.toDouble());
252+
auto checkConstant = [this](const std::string &str) {
253+
Value stringValue(str);
254+
Value numberValue(stringValue.toDouble());
259255

260-
if (stringValue.isValidNumber() && str == numberValue.toString())
261-
m_unsafeConstants.insert(str);
262-
};
256+
if (stringValue.isValidNumber() && str == numberValue.toString())
257+
m_unsafeConstants.insert(str);
258+
};
263259

264-
const auto &targets = engine->targets();
265-
bool found = false;
260+
bool found = false;
266261

267-
for (const auto &target : targets) {
268-
const auto &costumes = target->costumes();
269-
const auto &sounds = target->sounds();
262+
for (const auto &target : m_targets) {
263+
const auto &costumes = target->costumes();
264+
const auto &sounds = target->sounds();
270265

271-
for (const auto &costume : costumes)
272-
checkConstant(costume->name());
266+
for (const auto &costume : costumes)
267+
checkConstant(costume->name());
273268

274-
for (const auto &sound : sounds)
275-
checkConstant(sound->name());
276-
}
277-
}
269+
for (const auto &sound : sounds)
270+
checkConstant(sound->name());
278271
}
279272

280273
// Compile scripts

0 commit comments

Comments
 (0)