about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-05-07T12·33+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-05-07T12·33+0000
commit83d7b89660ebb942ad844b9be260492b2ea9fb24 (patch)
tree3a26163bf83051f8bfee16cc65cc2ad2552fc6a9 /src/libexpr/primops.cc
parente2d5e40f4fdd98e5d2ad7b77c00fb97caa3aa259 (diff)
* Updated addErrorContext.
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 981f87ce81e5..d33b0030f7aa 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -189,19 +189,20 @@ static void prim_throw(EvalState & state, Value * * args, Value & v)
 }
 
 
-#if 0
 static void prim_addErrorContext(EvalState & state, Value * * args, Value & v)
 {
-    PathSet context;
     try {
-        return evalExpr(state, args[1]);
+        state.forceValue(*args[1]);
+        v = *args[1];
     } catch (Error & e) {
-        e.addPrefix(format("%1%\n") %
-            evalString(state, args[0], context));
+        PathSet context;
+        e.addPrefix(format("%1%\n") % state.coerceToString(*args[0], context));
         throw;
     }
 }
 
+
+#if 0
 /* Try evaluating the argument. Success => {success=true; value=something;}, 
  * else => {success=false; value=false;} */
 static void prim_tryEval(EvalState & state, Value * * args, Value & v)
@@ -1060,8 +1061,8 @@ void EvalState::createBaseEnv()
     addPrimOp("__genericClosure", 1, prim_genericClosure);
     addPrimOp("abort", 1, prim_abort);
     addPrimOp("throw", 1, prim_throw);
-#if 0
     addPrimOp("__addErrorContext", 2, prim_addErrorContext);
+#if 0
     addPrimOp("__tryEval", 1, prim_tryEval);
 #endif
     addPrimOp("__getEnv", 1, prim_getEnv);