From 457bcbfd1116f0b3330f9b409395beabffe6ca18 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Wed, 14 Apr 2021 11:51:38 -0600 Subject: keep track of sources for inference rules too --- src/makefile/functions.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/makefile/functions.rs') diff --git a/src/makefile/functions.rs b/src/makefile/functions.rs index feb0e54..295e50f 100644 --- a/src/makefile/functions.rs +++ b/src/makefile/functions.rs @@ -6,8 +6,9 @@ use std::rc::Rc; use eyre::{bail, Result, WrapErr}; use super::pattern::r#match; -use super::r#macro::{Macro, Set as MacroSet, Source as MacroSource}; +use super::r#macro::{Macro, Set as MacroSet}; use super::token::TokenString; +use super::ItemSource; pub fn expand_call( name: &str, @@ -471,7 +472,7 @@ pub fn foreach( macros.set( var.clone(), Macro { - source: MacroSource::File, + source: ItemSource::FunctionCall, text: TokenString::text(word), #[cfg(feature = "full")] eagerly_expanded: false, @@ -495,7 +496,7 @@ pub fn call<'a>(macros: &MacroSet, args: impl Iterator) macros.set( i.to_string(), Macro { - source: MacroSource::File, + source: ItemSource::FunctionCall, text: TokenString::text(x), #[cfg(feature = "full")] eagerly_expanded: false, @@ -552,8 +553,6 @@ pub fn shell(macros: &MacroSet, command: &TokenString) -> Result { mod test { use super::*; - use crate::makefile::r#macro::{Set as MacroSet, Source as MacroSource}; - type R = Result<()>; fn call(name: &str, args: &[TokenString], macros: &MacroSet) -> Result { @@ -663,7 +662,7 @@ mod test { macros.set( "test1".to_owned(), Macro { - source: MacroSource::File, + source: ItemSource::Builtin, text: TokenString::text("something"), #[cfg(feature = "full")] eagerly_expanded: false, @@ -672,7 +671,7 @@ mod test { macros.set( "test2".to_owned(), Macro { - source: MacroSource::File, + source: ItemSource::Builtin, text: TokenString::text(""), #[cfg(feature = "full")] eagerly_expanded: false, @@ -764,7 +763,7 @@ mod test { macros.set( "test".to_owned(), Macro { - source: MacroSource::File, + source: ItemSource::Builtin, text: "worked for $(item).".parse()?, #[cfg(feature = "full")] eagerly_expanded: false, @@ -791,7 +790,7 @@ mod test { macros.set( "reverse".to_owned(), Macro { - source: MacroSource::File, + source: ItemSource::Builtin, text: "$(2) $(1)".parse()?, #[cfg(feature = "full")] eagerly_expanded: false, -- cgit v1.2.3