about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-10-22T08·10+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-10-22T08·10+0000
commitdeb342fb08fb7b366af482664f44e52f749e63b8 (patch)
treef2299bfc15acddd7daffad390acf6e0dab816f47 /src/libexpr/primops.cc
parent437077c39dd7abb44b2ab02cb9c6215d125bef04 (diff)
* 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",[])'.

Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index d4a83cafe4fe..7dddc91a86ab 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]);
 }