@@ -540,6 +540,48 @@ exports.arg_i = function(ctx, contedArg) {
540
540
}
541
541
} ;
542
542
543
+ exports . arg_i64 = function ( ctx , contedArg ) {
544
+ if ( contedArg instanceof NativeIntArg ) {
545
+ return BigInt ( contedArg . value ) ;
546
+ } else if ( contedArg instanceof NativeUIntArg ) {
547
+ return BigInt ( contedArg . value ) ;
548
+ } else if ( contedArg instanceof NativeNumArg ) {
549
+ throw new NQPException ( 'Expected native int64 argument, but got num' ) ;
550
+ } else if ( contedArg instanceof NativeStrArg ) {
551
+ throw new NQPException ( 'Expected native int64 argument, but got str' ) ;
552
+ }
553
+
554
+ const arg = contedArg . $$decont ( ctx ) ;
555
+ if ( arg instanceof NQPInt ) {
556
+ return BigInt ( arg . value ) ;
557
+ } else if ( arg . $$getInt64 ) {
558
+ return BigInt ( arg . $$getInt64 ( ) ) ;
559
+ } else {
560
+ throw new NQPException ( 'Expected native int64 argument, but got something else' ) ;
561
+ }
562
+ } ;
563
+
564
+ exports . arg_u64 = function ( ctx , contedArg ) {
565
+ if ( contedArg instanceof NativeIntArg ) {
566
+ return BigInt . asUintN ( 64 , contedArg . value ) ;
567
+ } else if ( contedArg instanceof NativeUIntArg ) {
568
+ return BigInt ( contedArg . value ) ;
569
+ } else if ( contedArg instanceof NativeNumArg ) {
570
+ throw new NQPException ( 'Expected native uint64 argument, but got num' ) ;
571
+ } else if ( contedArg instanceof NativeStrArg ) {
572
+ throw new NQPException ( 'Expected native uint64 argument, but got str' ) ;
573
+ }
574
+
575
+ const arg = contedArg . $$decont ( ctx ) ;
576
+ if ( arg instanceof NQPInt ) {
577
+ return BigInt . asUintN ( 64 , BigInt ( arg . value ) ) ;
578
+ } else if ( arg . $$getUint64 ) {
579
+ return BigInt ( arg . $$getUint64 ( ) ) ;
580
+ } else {
581
+ throw new NQPException ( 'Expected native uint64 argument, but got something else' ) ;
582
+ }
583
+ } ;
584
+
543
585
exports . arg_n = function ( ctx , contedArg ) {
544
586
if ( contedArg instanceof NativeNumArg ) {
545
587
return contedArg . value ;
0 commit comments