aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/macro_scope.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2024-11-11 17:15:08 -0700
committerMelody Horn <melody@boringcactus.com>2024-11-11 17:15:08 -0700
commit4f9299b4639802e05e1cb27d8eb40305ff8e110e (patch)
tree0da5529c68c82e97aed67d842e50f6285e79e6c2 /src/makefile/macro_scope.rs
parentfbbcf325b8bbe72f924da6a7cdb128d973ef0026 (diff)
downloadmakers-4f9299b4639802e05e1cb27d8eb40305ff8e110e.tar.gz
makers-4f9299b4639802e05e1cb27d8eb40305ff8e110e.zip
implement rule-specific macros for targets
Diffstat (limited to 'src/makefile/macro_scope.rs')
-rw-r--r--src/makefile/macro_scope.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/makefile/macro_scope.rs b/src/makefile/macro_scope.rs
index ba9b6cf..c03870f 100644
--- a/src/makefile/macro_scope.rs
+++ b/src/makefile/macro_scope.rs
@@ -43,6 +43,12 @@ impl<'a> MacroScope for LookupInternal<'a> {
}
}
+impl<T: MacroScope> MacroScope for Option<&T> {
+ fn get(&self, name: &str) -> Option<Cow<Macro>> {
+ self.as_ref().and_then(|value| value.get(name))
+ }
+}
+
// warning on undefined macros is useful but can get repetitive fast
lazy_static! {
static ref WARNINGS_EMITTED: RwLock<HashSet<String>> = Default::default();