Fix no_function build.
This commit is contained in:
parent
dc2e824ce2
commit
3d1b2d6f10
@ -1187,7 +1187,7 @@ impl Engine {
|
|||||||
(_, Some((namespace, hash_var)), var_name) => {
|
(_, Some((namespace, hash_var)), var_name) => {
|
||||||
if let Some(module) = self.search_imports(mods, state, namespace) {
|
if let Some(module) = self.search_imports(mods, state, namespace) {
|
||||||
// foo:bar::baz::VARIABLE
|
// foo:bar::baz::VARIABLE
|
||||||
match module.get_qualified_var(*hash_var) {
|
return match module.get_qualified_var(*hash_var) {
|
||||||
Ok(target) => {
|
Ok(target) => {
|
||||||
let mut target = target.clone();
|
let mut target = target.clone();
|
||||||
// Module variables are constant
|
// Module variables are constant
|
||||||
@ -1208,10 +1208,13 @@ impl Engine {
|
|||||||
}
|
}
|
||||||
Err(err.fill_position(*_var_pos))
|
Err(err.fill_position(*_var_pos))
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
} else if namespace.len() == 1 && namespace[0].name == KEYWORD_GLOBAL {
|
|
||||||
|
#[cfg(not(feature = "no_function"))]
|
||||||
|
if namespace.len() == 1 && namespace[0].name == KEYWORD_GLOBAL {
|
||||||
// global::VARIABLE
|
// global::VARIABLE
|
||||||
if let Some(value) = state.global_constants.get_mut(var_name) {
|
return if let Some(value) = state.global_constants.get_mut(var_name) {
|
||||||
let mut target: Target = value.clone().into();
|
let mut target: Target = value.clone().into();
|
||||||
// Module variables are constant
|
// Module variables are constant
|
||||||
target.set_access_mode(AccessMode::ReadOnly);
|
target.set_access_mode(AccessMode::ReadOnly);
|
||||||
@ -1227,17 +1230,16 @@ impl Engine {
|
|||||||
namespace[0].pos,
|
namespace[0].pos,
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
|
};
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Err(EvalAltResult::ErrorModuleNotFound(
|
Err(
|
||||||
namespace.to_string(),
|
EvalAltResult::ErrorModuleNotFound(namespace.to_string(), namespace[0].pos)
|
||||||
namespace[0].pos,
|
.into(),
|
||||||
)
|
)
|
||||||
.into())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#[cfg(feature = "no_module")]
|
#[cfg(feature = "no_module")]
|
||||||
(_, Some((_, _)), _) => unreachable!("no_module is active"),
|
(_, Some((_, _)), _) => unreachable!("qualified access under no_module"),
|
||||||
},
|
},
|
||||||
_ => unreachable!("Expr::Variable expected, but gets {:?}", expr),
|
_ => unreachable!("Expr::Variable expected, but gets {:?}", expr),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user