@@ -496,21 +496,16 @@ function P6int() {
496
496
P6int . prototype . flattened_default = 0 ;
497
497
P6int . prototype . boxed_primitive = 1 ;
498
498
499
- P6int . prototype . basic_constructor = basic_constructor ;
500
- P6int . prototype . basic_type_object_for = basic_type_object_for ;
501
-
502
- P6int . prototype . create_obj_constructor = function ( STable ) {
503
- var c = this . basic_constructor ( STable ) ;
504
-
505
- STable . obj_constructor = c ; // HACK it's set again later, we set it for addInternalMethod
499
+ P6int . prototype . create_obj_constructor = basic_constructor ;
500
+ P6int . prototype . type_object_for = basic_type_object_for ;
506
501
502
+ P6int . prototype . setup_STable = function ( STable ) {
507
503
STable . addInternalMethod ( '$$set_int' , function ( value ) {
508
504
this . value = value ;
509
505
} ) ;
510
506
STable . addInternalMethod ( '$$get_int' , function ( ) {
511
507
return this . value ;
512
508
} ) ;
513
- return c ;
514
509
} ;
515
510
516
511
P6int . prototype . compose = function ( STable , repr_info_hash ) {
@@ -538,11 +533,6 @@ P6int.prototype.serialize = function(data, obj) {
538
533
} ;
539
534
540
535
541
- P6int . prototype . type_object_for = function ( HOW ) {
542
- var type_object = this . basic_type_object_for ( HOW ) ;
543
- return type_object ;
544
- } ;
545
-
546
536
module . exports . P6int = P6int ;
547
537
548
538
function P6num ( ) {
@@ -677,28 +667,24 @@ function P6bigint() {
677
667
}
678
668
P6bigint . prototype . create_obj_constructor = basic_constructor ;
679
669
680
- P6bigint . prototype . basic_type_object_for = basic_type_object_for ;
681
-
682
- P6bigint . prototype . type_object_for = function ( HOW ) {
683
- var type_object = this . basic_type_object_for ( HOW ) ;
670
+ P6bigint . prototype . type_object_for = basic_type_object_for ;
684
671
685
- this . _STable . addInternalMethod ( '$$set_int' , function ( value ) {
672
+ P6bigint . prototype . setup_STable = function ( STable ) {
673
+ STable . addInternalMethod ( '$$set_int' , function ( value ) {
686
674
this . value = bignum ( value ) ;
687
675
} ) ;
688
676
689
- this . _STable . addInternalMethod ( '$$get_int' , function ( ) {
677
+ STable . addInternalMethod ( '$$get_int' , function ( ) {
690
678
return this . value . toNumber ( ) | 0 ;
691
679
} ) ;
692
680
693
- this . _STable . addInternalMethod ( '$$set_bignum' , function ( value ) {
681
+ STable . addInternalMethod ( '$$set_bignum' , function ( value ) {
694
682
this . value = value ;
695
683
} ) ;
696
684
697
- this . _STable . addInternalMethod ( '$$get_bignum' , function ( ) {
685
+ STable . addInternalMethod ( '$$get_bignum' , function ( ) {
698
686
return this . value ;
699
687
} ) ;
700
-
701
- return type_object ;
702
688
} ;
703
689
704
690
P6bigint . prototype . generateBoxingMethods = function ( repr , attr ) {
@@ -779,12 +765,9 @@ MultiDimArray.prototype.compose = function(STable, repr_info_hash) {
779
765
} ;
780
766
MultiDimArray . prototype . allocate = basic_allocate ;
781
767
782
- MultiDimArray . prototype . basic_constructor = basic_constructor ;
783
- MultiDimArray . prototype . create_obj_constructor = function ( STable ) {
784
- var c = this . basic_constructor ( STable ) ;
785
-
786
- STable . obj_constructor = c ; // HACK it's set again later, we set it for addInternalMethod
768
+ MultiDimArray . prototype . create_obj_constructor = basic_constructor ;
787
769
770
+ MultiDimArray . prototype . setup_STable = function ( STable ) {
788
771
STable . addInternalMethod ( '$$numdimensions' , function ( value ) {
789
772
if ( this . type_object_ ) {
790
773
throw new NQPException ( 'Cannot get number of dimensions of a type object' ) ;
@@ -910,9 +893,6 @@ MultiDimArray.prototype.create_obj_constructor = function(STable) {
910
893
STable . addInternalMethod ( '$$atpos' , function ( index ) {
911
894
return this . $$atposnd ( new NQPArray ( [ index ] ) ) ;
912
895
} ) ;
913
-
914
-
915
- return c ;
916
896
} ;
917
897
918
898
MultiDimArray . prototype . serialize_repr_data = function ( st , cursor ) {
@@ -999,15 +979,12 @@ VMException.prototype.type_object_for = basic_type_object_for;
999
979
VMException . prototype . compose = noop_compose ;
1000
980
VMException . prototype . basic_type_object_for = basic_type_object_for ;
1001
981
1002
- VMException . prototype . basic_constructor = basic_constructor ;
982
+ VMException . prototype . create_obj_constructor = basic_constructor ;
1003
983
1004
- VMException . prototype . create_obj_constructor = function ( STable ) {
1005
- var c = this . basic_constructor ( STable ) ;
1006
- STable . obj_constructor = c ; // HACK it's set again later, we set it for addInternalMethod
984
+ VMException . prototype . setup_STable = function ( STable ) {
1007
985
STable . addInternalMethod ( '$$get_str' , function ( ) {
1008
986
return this . message ;
1009
987
} ) ;
1010
- return c ;
1011
988
} ;
1012
989
1013
990
module . exports . VMException = VMException ;
0 commit comments