Skip to content

Commit

Permalink
Support integer return type in array_sort closure
Browse files Browse the repository at this point in the history
  • Loading branch information
Pieter12345 committed Dec 17, 2023
1 parent 02d3094 commit e59e645
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1826,9 +1826,12 @@ private CArray merge(CArray left, CArray right, CClosure closure, Target t) {
} else {
value = -1;
}
} else if(c.isInstanceOf(CInt.TYPE)) {
long longVal = ((CInt) c).getInt();
value = (longVal > 0 ? 1 : (longVal < 0 ? -1 : 0));
} else {
throw new CRECastException("The custom closure did not return a value (or returned an invalid"
+ " type). It must always return true, false, or null.", t);
+ " type). It must always return true, false, null, or an integer.", t);
}
if(value <= 0) {
result.push(left.get(0, t), t);
Expand Down

0 comments on commit e59e645

Please sign in to comment.