about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-01-04T14·22+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-01-04T14·22+0000
commit7d0f6aed59b11ef1037e7b0ee4dae1c7288ebb45 (patch)
tree7b158d1eafd04f0d08426a9919beb635c48124d6 /src/libexpr/primops.cc
parent895c9538173a1c1d7e5f6c82e5b7a58b7d904683 (diff)
* New primop `unsafeDiscardStringContext' to get rid of string
  contexts.  Needed to prevent unnecessary dependencies when building
  the NixOS manual.

Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 9b0df9238849..94410e2bdade 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -942,6 +942,14 @@ static Expr prim_stringLength(EvalState & state, const ATermVector & args)
 }
 
 
+static Expr prim_unsafeDiscardStringContext(EvalState & state, const ATermVector & args)
+{
+    PathSet context;
+    string s = coerceToString(state, args[0], context);
+    return makeStr(s, PathSet());
+}
+
+
 /*************************************************************
  * Primop registration
  *************************************************************/
@@ -1009,6 +1017,8 @@ void EvalState::addPrimOps()
     addPrimOp("toString", 1, prim_toString);
     addPrimOp("__substring", 3, prim_substring);
     addPrimOp("__stringLength", 1, prim_stringLength);
+    addPrimOp("__unsafeDiscardStringContext", 1, prim_unsafeDiscardStringContext);
+    
 }