From 8e74c0bfd1b61b175f04a7e0a8f0a3d9db809f1a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 2 Aug 2013 18:53:02 +0200 Subject: Let the ordering operators also work on strings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit E.g. ‘"foo" < "bar"’ now works. --- src/libexpr/primops.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/libexpr/primops.cc') diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index f66b24b77..149c7ca39 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 res; set 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])); } -- cgit v1.2.3