aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/macro.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-06 18:29:50 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-06 18:29:50 -0600
commit6dbb6548990841e7aeb991b76a58e14d237e79d0 (patch)
tree5088e96003390ca954a3a7de3ef559d415b0ace0 /src/makefile/macro.rs
parentcffe08ca6db316f48eafb49b914ecd192aa8c45f (diff)
downloadmakers-6dbb6548990841e7aeb991b76a58e14d237e79d0.tar.gz
makers-6dbb6548990841e7aeb991b76a58e14d237e79d0.zip
fix exports oops
Diffstat (limited to 'src/makefile/macro.rs')
-rw-r--r--src/makefile/macro.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/makefile/macro.rs b/src/makefile/macro.rs
index 5e7ea9c..65a87d1 100644
--- a/src/makefile/macro.rs
+++ b/src/makefile/macro.rs
@@ -36,7 +36,7 @@ pub trait LookupInternal: for<'a> Fn(&'a str) -> Result<String> {}
impl<F: for<'a> Fn(&'a str) -> Result<String>> LookupInternal for F {}
#[cfg(feature = "full")]
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub enum ExportConfig {
Only(HashSet<String>),
AllBut(HashSet<String>),
@@ -183,7 +183,21 @@ impl<'parent, 'lookup> Set<'parent, 'lookup> {
.or_else(|| self.parent.and_then(|p| p.get(name).cloned()))
}
- pub fn extend(&mut self, other: HashMap<String, Macro>) {
+ pub fn extend(&mut self, other: HashMap<String, Macro>, other_exports: ExportConfig) {
+ match (&mut self.exported, other_exports) {
+ (ExportConfig::Only(se), ExportConfig::Only(oe)) => {
+ se.extend(oe);
+ }
+ (ExportConfig::AllBut(sne), ExportConfig::AllBut(one)) => {
+ sne.extend(one);
+ }
+ (ExportConfig::Only(se), ExportConfig::AllBut(one)) => {
+ se.extend(other.keys().cloned().filter(|name| !one.contains(name)));
+ }
+ (ExportConfig::AllBut(sne), ExportConfig::Only(oe)) => {
+ sne.extend(other.keys().cloned().filter(|name| !oe.contains(name)));
+ }
+ }
self.data.extend(other);
}