(from_stack: i64, to_stack: i64)
| 113 | } |
| 114 | |
| 115 | pub fn compatible_stack(from_stack: i64, to_stack: i64) -> bool { |
| 116 | if from_stack < 0 || to_stack < 0 { |
| 117 | return false; |
| 118 | } |
| 119 | let mut from = from_stack; |
| 120 | let mut to = to_stack; |
| 121 | while from > to { |
| 122 | from = pop_value(from); |
| 123 | } |
| 124 | while from != 0 { |
| 125 | let from_top = top_of_stack(from); |
| 126 | let to_top = top_of_stack(to); |
| 127 | if !compatible_kind(from_top, to_top) { |
| 128 | return false; |
| 129 | } |
| 130 | from = pop_value(from); |
| 131 | to = pop_value(to); |
| 132 | } |
| 133 | to == 0 |
| 134 | } |
| 135 | |
| 136 | pub fn explain_incompatible_stack(to_stack: i64) -> &'static str { |
| 137 | debug_assert!(to_stack != 0); |
no test coverage detected