aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/functions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/makefile/functions.rs')
-rw-r--r--src/makefile/functions.rs17
1 files changed, 8 insertions, 9 deletions
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<Item = &'a TokenString>)
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<String> {
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<String> {
@@ -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,