File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,14 @@ STable.prototype.setboolspec = function(mode, method) {
33
33
this . obj_constructor . prototype . $$to_bool = function ( ctx ) {
34
34
return method . $call ( ctx , { } , this ) ;
35
35
} ;
36
+ } else if ( mode == 1 ) {
37
+ this . obj_constructor . prototype . $$to_bool = function ( ctx ) {
38
+ return this . $$get_int ( ) == 0 ? 0 : 1 ;
39
+ } ;
40
+ } else if ( mode == 2 ) {
41
+ this . obj_constructor . prototype . $$to_bool = function ( ctx ) {
42
+ return this . $$get_num ( ) == 0 ? 0 : 1 ;
43
+ } ;
36
44
} else if ( mode == 3 ) {
37
45
this . obj_constructor . prototype . $$to_bool = function ( ctx ) {
38
46
return this . $$get_str ( ) == '' ? 0 : 1 ;
@@ -44,8 +52,16 @@ STable.prototype.setboolspec = function(mode, method) {
44
52
} ;
45
53
} else if ( mode == 5 ) {
46
54
// this is the default - do nothing
47
- } else if ( mode == 7 || mode == 8 ) {
55
+ } else if ( mode == 6 ) {
56
+ this . obj_constructor . prototype . $$to_bool = function ( ctx ) {
57
+ return this . $$get_bignum ( ) . eq ( 0 ) ? 0 : 1 ;
58
+ } ;
59
+ } else if ( mode == 7 ) {
48
60
// STUB
61
+ } else if ( mode == 8 ) {
62
+ this . obj_constructor . prototype . $$to_bool = function ( ctx ) {
63
+ return this . $$elems ( ) ? 1 : 0 ;
64
+ } ;
49
65
} else {
50
66
throw 'setboolspec with mode: ' + mode + ' NYI' ;
51
67
}
You can’t perform that action at this time.
0 commit comments