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

Method stack_truncate

crates/vm/src/frame.rs:391–396  ·  view source on GitHub ↗

Truncate the stack to `new_len` elements, dropping excess values.

(&mut self, new_len: usize)

Source from the content-addressed store, hash-verified

389
390 /// Truncate the stack to `new_len` elements, dropping excess values.
391 fn stack_truncate(&mut self, new_len: usize) {
392 debug_assert!(new_len <= self.stack_top as usize);
393 while self.stack_top as usize > new_len {
394 let _ = self.stack_pop();
395 }
396 }
397
398 /// Clear the stack, dropping all values.
399 fn stack_clear(&mut self) {

Callers 2

Calls 1

stack_popMethod · 0.80

Tested by

no test coverage detected