aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/macro.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2024-11-11 14:46:19 -0700
committerMelody Horn <melody@boringcactus.com>2024-11-11 14:46:19 -0700
commitfbbcf325b8bbe72f924da6a7cdb128d973ef0026 (patch)
tree783dc988b77c95fd739b30a436a496b7c0c550c2 /src/makefile/macro.rs
parent5aa6e1122830611dccc2eab9b7f4a53a10056111 (diff)
downloadmakers-fbbcf325b8bbe72f924da6a7cdb128d973ef0026.tar.gz
makers-fbbcf325b8bbe72f924da6a7cdb128d973ef0026.zip
fix conditional assignment when original is inherited
Diffstat (limited to 'src/makefile/macro.rs')
-rw-r--r--src/makefile/macro.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/makefile/macro.rs b/src/makefile/macro.rs
index 301173a..b2a1510 100644
--- a/src/makefile/macro.rs
+++ b/src/makefile/macro.rs
@@ -119,7 +119,8 @@ impl Set {
}
}
- pub fn get(&self, name: &str) -> Option<&Macro> {
+ /// To properly process inherited macros, use [MacroScopeStack::get].
+ pub fn get_non_recursive(&self, name: &str) -> Option<&Macro> {
self.data.get(name)
}
@@ -127,17 +128,6 @@ impl Set {
self.data.insert(name, r#macro);
}
- #[cfg(feature = "full")]
- pub fn is_defined(&self, name: &str) -> bool {
- self.get(name).map_or(false, |x| !x.text.is_empty())
- }
-
- // `remove` is fine, but I think for "remove-and-return" `pop` is better
- pub fn pop(&mut self, name: &str) -> Option<Macro> {
- // TODO figure out a better way to handle inheritance
- self.data.remove(name)
- }
-
pub fn extend(
&mut self,
other: HashMap<String, Macro>,