| 566 | } |
| 567 | |
| 568 | void ProgramMemoryState::removeModifiedVars(const Token* tok) |
| 569 | { |
| 570 | const ProgramMemory& pm = state; |
| 571 | auto eval = [&](const Token* cond) -> std::vector<MathLib::bigint> { |
| 572 | ProgramMemory pm2 = pm; |
| 573 | auto result = execute(cond, pm2, settings); |
| 574 | if (isTrue(result)) |
| 575 | return {1}; |
| 576 | if (isFalse(result)) |
| 577 | return {0}; |
| 578 | return {}; |
| 579 | }; |
| 580 | state.erase_if([&](const ExprIdToken& e) { |
| 581 | const Token* start = origins[e.getExpressionId()]; |
| 582 | const Token* expr = e.tok; |
| 583 | if (!expr || findExpressionChangedSkipDeadCode(expr, start, tok, settings, eval)) { |
| 584 | origins.erase(e.getExpressionId()); |
| 585 | return true; |
| 586 | } |
| 587 | return false; |
| 588 | }); |
| 589 | } |
| 590 | |
| 591 | ProgramMemory ProgramMemoryState::get(const Token* tok, const Token* ctx, const ProgramMemory::Map& vars) const |
| 592 | { |
no test coverage detected