From deb342fb08fb7b366af482664f44e52f749e63b8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 22 Oct 2009 08:10:12 +0000 Subject: [PATCH] * builtins.trace: in the common case that the value is a string, then show the string, not the ATerm, so we get `trace: bla' instead of `trace: Str("bla",[])'. --- src/libexpr/primops.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index d4a83cafe..7dddc91a8 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -256,7 +256,12 @@ static Expr prim_getEnv(EvalState & state, const ATermVector & args) static Expr prim_trace(EvalState & state, const ATermVector & args) { Expr e = evalExpr(state, args[0]); - printMsg(lvlError, format("trace: %1%") % e); + string s; + PathSet context; + if (matchStr(e, s, context)) + printMsg(lvlError, format("trace: %1%") % s); + else + printMsg(lvlError, format("trace: %1%") % e); return evalExpr(state, args[1]); }