diff options
author | Puck Meerburg <puck@puckipedia.com> | 2024-05-17 21:37:41 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@lix-systems> | 2024-05-17 21:37:41 +0000 |
commit | 23c92f08151acf9823fd4f6cfd0a91aadb45961b (patch) | |
tree | 79547340e9059b355546f004afc280cf944b3daa /src/libexpr/primops.cc | |
parent | 92e1df23b3daa4ba36926ca96392c8236ddde5e9 (diff) | |
parent | 194654c96f61acc6dc47dd3126ad47618d45a0c8 (diff) |
Merge "primops: change to std::function, allowing the passing of user data" into main
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r-- | src/libexpr/primops.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index e36b800c3..77e7cf22b 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -3329,8 +3329,11 @@ static void prim_sort(EvalState & state, const PosIdx pos, Value * * args, Value callFunction. */ /* TODO: (layus) this is absurd. An optimisation like this should be outside the lambda creation */ - if (args[0]->isPrimOp() && args[0]->primOp->fun == prim_lessThan) - return CompareValues(state, noPos, "while evaluating the ordering function passed to builtins.sort")(a, b); + if (args[0]->isPrimOp()) { + auto ptr = args[0]->primOp->fun.target<decltype(&prim_lessThan)>(); + if (ptr && *ptr == prim_lessThan) + return CompareValues(state, noPos, "while evaluating the ordering function passed to builtins.sort")(a, b); + } Value * vs[] = {a, b}; Value vBool; |