Fix sync build.

This commit is contained in:
Stephen Chung
2022-01-28 22:07:49 +08:00
parent c93e94c7cd
commit c397a6dcb5
4 changed files with 19 additions and 12 deletions

View File

@@ -92,13 +92,13 @@ impl Engine {
// global::VARIABLE
#[cfg(not(feature = "no_function"))]
if namespace.len() == 1 && namespace[0].name == crate::engine::KEYWORD_GLOBAL {
let mut guard = crate::func::native::locked_write(&global.constants);
if let Some(value) = guard.get_mut(var_name) {
let mut target: Target = value.clone().into();
// Module variables are constant
target.set_access_mode(AccessMode::ReadOnly);
return Ok((target.into(), *_var_pos));
if let Some(ref constants) = global.constants {
if let Some(value) = crate::func::locked_write(constants).get_mut(var_name) {
let mut target: Target = value.clone().into();
// Module variables are constant
target.set_access_mode(AccessMode::ReadOnly);
return Ok((target.into(), *_var_pos));
}
}
return Err(ERR::ErrorVariableNotFound(