| 399 | } |
| 400 | |
| 401 | static void fillProgramMemoryFromConditions(ProgramMemory& pm, const Scope* scope, const Token* endTok, const Settings& settings) |
| 402 | { |
| 403 | if (!scope) |
| 404 | return; |
| 405 | if (!scope->isLocal()) |
| 406 | return; |
| 407 | assert(scope != scope->nestedIn); |
| 408 | fillProgramMemoryFromConditions(pm, scope->nestedIn, endTok, settings); |
| 409 | if (scope->type == ScopeType::eIf || scope->type == ScopeType::eWhile || scope->type == ScopeType::eElse || scope->type == ScopeType::eFor) { |
| 410 | const Token* condTok = getCondTokFromEnd(scope->bodyEnd); |
| 411 | if (!condTok) |
| 412 | return; |
| 413 | MathLib::bigint result = 0; |
| 414 | bool error = false; |
| 415 | execute(condTok, pm, &result, &error, settings); |
| 416 | if (error) |
| 417 | programMemoryParseCondition(pm, condTok, endTok, settings, scope->type != ScopeType::eElse); |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | static void fillProgramMemoryFromConditions(ProgramMemory& pm, const Token* tok, const Settings& settings) |
| 422 | { |
no test coverage detected