diff options
Diffstat (limited to 'src/makefile/macro_scope.rs')
-rw-r--r-- | src/makefile/macro_scope.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/makefile/macro_scope.rs b/src/makefile/macro_scope.rs index bee603e..ba9b6cf 100644 --- a/src/makefile/macro_scope.rs +++ b/src/makefile/macro_scope.rs @@ -26,7 +26,7 @@ pub trait MacroScope { impl MacroScope for MacroSet { fn get(&self, name: &str) -> Option<Cow<Macro>> { - self.get(name).map(Cow::Borrowed) + self.get_non_recursive(name).map(Cow::Borrowed) } } @@ -82,7 +82,7 @@ impl<'a> MacroScopeStack<'a> { } } - fn get(&self, name: &str) -> Option<Cow<Macro>> { + pub fn get(&self, name: &str) -> Option<Cow<Macro>> { for scope in &self.scopes { if let Some(r#macro) = scope.get(name) { return Some(r#macro); @@ -91,6 +91,11 @@ impl<'a> MacroScopeStack<'a> { None } + #[cfg(feature = "full")] + pub fn is_defined(&self, name: &str) -> bool { + self.get(name).map_or(false, |x| !x.text.is_empty()) + } + pub fn expand<#[cfg(feature = "full")] R: BufRead>( &self, text: &TokenString, |