1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::{collections::HashMap, path::PathBuf};

use derive_enum_from_into::EnumFrom;

use crate::{Diagnostic, Variable};

pub struct Module {
	pub path: PathBuf,
}

pub struct SynthesizedModule {
	pub module: Module,
	// TODO this should not be on unchecked module
	// TODO export default
	pub(crate) exported_variables: HashMap<String, Variable>,
}

// TODO
// pub(crate) struct CheckedModule<TStage> { exported }

#[derive(Debug, EnumFrom)]
pub enum ModuleFromPathError {
	// ParseError
	ParseError(()),
	PathDoesNotExist(PathBuf),
	NoResolverForExtension(String),
}

impl From<ModuleFromPathError> for Diagnostic {
	fn from(err: ModuleFromPathError) -> Self {
		todo!()
	}
}

impl SynthesizedModule {
	pub fn get_exports(&self) -> &HashMap<String, Variable> {
		&self.exported_variables
	}
}