Parse sources of conditional env modules.
Do nothing about it yet, but trigger an error if env/default.ak is missing; but only if there's any module at all under env.
This commit is contained in:
@@ -28,6 +28,7 @@ pub type UntypedModule = Module<(), UntypedDefinition>;
|
||||
pub enum ModuleKind {
|
||||
Lib,
|
||||
Validator,
|
||||
Env,
|
||||
}
|
||||
|
||||
impl ModuleKind {
|
||||
@@ -38,6 +39,10 @@ impl ModuleKind {
|
||||
pub fn is_lib(&self) -> bool {
|
||||
matches!(self, ModuleKind::Lib)
|
||||
}
|
||||
|
||||
pub fn is_env(&self) -> bool {
|
||||
matches!(self, ModuleKind::Env)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
|
||||
@@ -785,7 +785,9 @@ impl<'a> Environment<'a> {
|
||||
})?;
|
||||
|
||||
if module_info.kind.is_validator()
|
||||
&& (self.current_kind.is_lib() || !self.current_module.starts_with("tests"))
|
||||
&& (self.current_kind.is_lib()
|
||||
|| self.current_kind.is_env()
|
||||
|| !self.current_module.starts_with("tests"))
|
||||
{
|
||||
return Err(Error::ValidatorImported {
|
||||
location: *location,
|
||||
|
||||
Reference in New Issue
Block a user