MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / step

Method step

aiscript-vm/src/vm/state.rs:1160–1172  ·  view source on GitHub ↗

Runs the VM for a period of time controlled by the `fuel` parameter. Returns `Ok(false)` if the method has exhausted its fuel, but there is more work to do, and returns `Ok(true)` if no more progress can be made.

(&mut self, fuel: &mut Fuel)

Source from the content-addressed store, hash-verified

1158 // Returns `Ok(false)` if the method has exhausted its fuel, but there is more work to
1159 // do, and returns `Ok(true)` if no more progress can be made.
1160 pub(super) fn step(&mut self, fuel: &mut Fuel) -> Result<Option<ReturnValue>, VmError> {
1161 loop {
1162 if let Some(result) = self.dispatch_next(0)? {
1163 return Ok(Some(ReturnValue::from(result)));
1164 }
1165 const FUEL_PER_STEP: i32 = 1;
1166 fuel.consume(FUEL_PER_STEP);
1167
1168 if !fuel.should_continue() {
1169 return Ok(None);
1170 }
1171 }
1172 }
1173
1174 fn capture_upvalue(&mut self, slot: usize) -> GcRefLock<'gc, UpvalueObj<'gc>> {
1175 let mut prev_upvalue = None;

Callers 1

interpretMethod · 0.80

Calls 3

dispatch_nextMethod · 0.80
should_continueMethod · 0.80
consumeMethod · 0.45

Tested by

no test coverage detected