(to_stack: i64)
| 134 | } |
| 135 | |
| 136 | pub fn explain_incompatible_stack(to_stack: i64) -> &'static str { |
| 137 | debug_assert!(to_stack != 0); |
| 138 | if to_stack == OVERFLOWED { |
| 139 | return "stack is too deep to analyze"; |
| 140 | } |
| 141 | if to_stack == UNINITIALIZED { |
| 142 | return "can't jump into an exception handler, or code may be unreachable"; |
| 143 | } |
| 144 | match Kind::from_i64(top_of_stack(to_stack)) { |
| 145 | Some(Kind::Except) => "can't jump into an 'except' block as there's no exception", |
| 146 | Some(Kind::Lasti) => "can't jump into a re-raising block as there's no location", |
| 147 | Some(Kind::Iterator) => "can't jump into the body of a for loop", |
| 148 | _ => "incompatible stacks", |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | /// Analyze bytecode and compute the stack state at each instruction index. |
| 153 | pub fn mark_stacks<C: Constant>(code: &bytecode::CodeObject<C>) -> Vec<i64> { |
no test coverage detected