Minor code restructure.

This commit is contained in:
Stephen Chung
2022-10-16 11:35:21 +08:00
parent 45f0fdcbe0
commit 530109275f
6 changed files with 137 additions and 112 deletions

View File

@@ -3,7 +3,7 @@
use super::GlobalRuntimeState;
use crate::types::dynamic::Union;
use crate::{Dynamic, Engine, Position, RhaiResultOf, ERR};
use crate::{Dynamic, Engine, Position, RhaiResult, RhaiResultOf, ERR};
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
@@ -150,4 +150,14 @@ impl Engine {
Ok(())
}
/// Check a result to ensure that it is valid.
#[inline]
pub(crate) fn check_return_value(&self, result: RhaiResult, pos: Position) -> RhaiResult {
if let Ok(ref r) = result {
self.check_data_size(r, pos)?;
}
result
}
}