about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-08-02T16·53+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-08-02T16·53+0200
commit8e74c0bfd1b61b175f04a7e0a8f0a3d9db809f1a (patch)
tree247f6bba14add873cbf19e4e5ce5e531edadad52 /src/libexpr/primops.cc
parent3d77b28eacc940356e94c36017fb2d9f1a1b7ec2 (diff)
Let the ordering operators also work on strings
E.g. ‘"foo" < "bar"’ now works.
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index f66b24b7708a..149c7ca399b1 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -183,8 +183,8 @@ static void prim_genericClosure(EvalState & state, Value * * args, Value & v)
     list<Value> res;
     set<Value, CompareValues> doneKeys; // !!! use Value *?
     while (!workSet.empty()) {
-	Value * e = *(workSet.begin());
-	workSet.pop_front();
+        Value * e = *(workSet.begin());
+        workSet.pop_front();
 
         state.forceAttrs(*e);
 
@@ -1032,7 +1032,10 @@ static void prim_div(EvalState & state, Value * * args, Value & v)
 
 static void prim_lessThan(EvalState & state, Value * * args, Value & v)
 {
-    mkBool(v, state.forceInt(*args[0]) < state.forceInt(*args[1]));
+    state.forceValue(*args[0]);
+    state.forceValue(*args[1]);
+    CompareValues comp;
+    mkBool(v, comp(*args[0], *args[1]));
 }