MCPcopy Index your code
hub / github.com/RustPython/RustPython / compatible_stack

Function compatible_stack

crates/vm/src/builtins/frame.rs:115–134  ·  view source on GitHub ↗
(from_stack: i64, to_stack: i64)

Source from the content-addressed store, hash-verified

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);

Callers 1

set_f_linenoMethod · 0.85

Calls 3

pop_valueFunction · 0.85
top_of_stackFunction · 0.85
compatible_kindFunction · 0.85

Tested by

no test coverage detected