Check whether the post-walk scope has any NEW or CHANGED variable types compared to the pre-loop scope. This is the Mago-style fixed-point check that runs BEFORE a re-walk: if nothing changed, there's no point walking the body again. Unlike `scopes_equal`, this is asymmetric: new variables in `after` that weren't in `before` count as changes, but variables in `before` that aren't in `after` do n
(before: &ScopeState, after: &ScopeState)
| 6082 | /// in `before` that aren't in `after` do not (they were just not |
| 6083 | /// assigned in the loop body). |
| 6084 | fn scope_has_changes(before: &ScopeState, after: &ScopeState) -> bool { |
| 6085 | for (name, after_types) in &after.locals { |
| 6086 | match before.locals.get(name) { |
| 6087 | None => { |
| 6088 | // New variable assigned in the loop body. |
| 6089 | if !after_types.is_empty() { |
| 6090 | return true; |
| 6091 | } |
| 6092 | } |
| 6093 | Some(before_types) => { |
| 6094 | if after_types.len() != before_types.len() { |
| 6095 | return true; |
| 6096 | } |
| 6097 | for (at, bt) in after_types.iter().zip(before_types.iter()) { |
| 6098 | if at.type_string != bt.type_string { |
| 6099 | return true; |
| 6100 | } |
| 6101 | } |
| 6102 | } |
| 6103 | } |
| 6104 | } |
| 6105 | false |
| 6106 | } |
| 6107 | |
| 6108 | /// Process a `foreach` statement. |
| 6109 | fn process_foreach<'b>(foreach: &'b Foreach<'b>, scope: &mut ScopeState, ctx: &ForwardWalkCtx<'_>) { |
no test coverage detected