File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -494,15 +494,28 @@ class Eval {
494
494
}
495
495
}
496
496
497
+ function getInt64 ( v : Value ) : haxe. Int64 {
498
+ return switch ( v .v ) {
499
+ case VInt64 (i ): i ;
500
+ case VInt (i ): i ;
501
+ default : throw valueStr (v )+ " should be a number" ;
502
+ }
503
+ }
504
+
497
505
function compare (a : Value ,b : Value ) : Int {
498
506
switch [a .v , b .v ] {
507
+ case [VInt (_ ) | VFloat (_ ), VInt (_ ) | VFloat (_ )]:
508
+ var d = getNum (a ) - getNum (b );
509
+ return d == 0 ? 0 : d > 0 ? 1 : - 1 ;
510
+ case [VInt (_ ) | VInt64 (_ ), VInt (_ ) | VInt64 (_ )]:
511
+ var d = getInt64 (a ) - getInt64 (b );
512
+ return d == 0 ? 0 : d > 0 ? 1 : - 1 ;
513
+ case [VBool (ab ), VBool ((bb ))]:
514
+ return ab == bb ? 0 : ab ? 1 : - 1 ;
499
515
case [VPointer (aptr ), VPointer (bptr )]:
500
516
return aptr .sub (bptr );
501
517
case [VString (as ,_ ), VString (bs ,_ )]:
502
518
return Reflect .compare (as , bs );
503
- case [VInt (_ ) | VFloat (_ ), VInt (_ ) | VFloat (_ )]:
504
- var d = getNum (a ) - getNum (b );
505
- return d == 0 ? 0 : d > 0 ? 1 : - 1 ;
506
519
default :
507
520
throw " Don't know how to compare " + a .v .getName () + " and " + b .v .getName ();
508
521
}
You can’t perform that action at this time.
0 commit comments