From 6cecad2be0f7ced82658ec2a86bcf61583487959 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 1 May 2006 09:56:56 +0000 Subject: * Allow string concatenations involving derivations, e.g., configureFlags = "--with-freetype2-library=" + freetype + "/lib"; --- src/libexpr/primops.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/libexpr/primops.cc') diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 3a291e007f66..8935b147e559 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -109,6 +109,14 @@ static void processBinding(EvalState & state, Expr e, Derivation & drv, int n; Expr e1, e2; + if (matchContext(e, es, e2)) { + e = e2; + for (ATermIterator i(es); i; ++i) { + Strings dummy; + processBinding(state, *i, drv, dummy); + } + } + if (matchStr(e, s)) ss.push_back(aterm2String(s)); else if (matchUri(e, s)) ss.push_back(aterm2String(s)); else if (e == eTrue) ss.push_back("1"); @@ -408,9 +416,10 @@ ATerm coerceToString(Expr e) /* Convert the argument (which can be a path or a uri) to a string. */ static Expr primToString(EvalState & state, const ATermVector & args) { - ATerm s = coerceToString(evalExpr(state, args[0])); - if (!s) throw Error("cannot coerce value to string"); - return makeStr(s); + ATermList context = ATempty; + bool dummy; + string s = coerceToStringWithContext(state, context, args[0], dummy); + return wrapInContext(context, makeStr(toATerm(s))); } -- cgit 1.4.1