43 |
* JS boolean interface. |
* JS boolean interface. |
44 |
*/ |
*/ |
45 |
|
|
46 |
|
#include "jsapi.h" |
47 |
|
|
48 |
JS_BEGIN_EXTERN_C |
JS_BEGIN_EXTERN_C |
49 |
|
|
50 |
/* |
/* |
54 |
* used in the interpreter to represent "no exception pending". In general it |
* used in the interpreter to represent "no exception pending". In general it |
55 |
* can be used to represent "no value". |
* can be used to represent "no value". |
56 |
* |
* |
57 |
|
* A JSVAL_HOLE can be cheaply converted to undefined without affecting any |
58 |
|
* other boolean (or pseudo boolean) by masking out JSVAL_HOLE_MASK. |
59 |
|
* |
60 |
* JSVAL_ARETURN is used to throw asynchronous return for generator.close(). |
* JSVAL_ARETURN is used to throw asynchronous return for generator.close(). |
61 |
* |
* |
62 |
* NB: BOOLEAN_TO_JSVAL(2) is JSVAL_VOID (see jsapi.h). |
* NB: PSEUDO_BOOLEAN_TO_JSVAL(2) is JSVAL_VOID (see jsapi.h). |
63 |
*/ |
*/ |
64 |
#define JSVAL_HOLE BOOLEAN_TO_JSVAL(3) |
#define JSVAL_HOLE_FLAG jsval(4 << JSVAL_TAGBITS) |
65 |
#define JSVAL_ARETURN BOOLEAN_TO_JSVAL(4) |
#define JSVAL_HOLE (JSVAL_VOID | JSVAL_HOLE_FLAG) |
66 |
|
#define JSVAL_ARETURN PSEUDO_BOOLEAN_TO_JSVAL(8) |
67 |
|
|
68 |
|
static JS_ALWAYS_INLINE JSBool |
69 |
|
JSVAL_TO_PUBLIC_PSEUDO_BOOLEAN(jsval v) |
70 |
|
{ |
71 |
|
JS_ASSERT(v == JSVAL_TRUE || v == JSVAL_FALSE || v == JSVAL_VOID); |
72 |
|
return JSVAL_TO_PSEUDO_BOOLEAN(v); |
73 |
|
} |
74 |
|
|
75 |
extern JSClass js_BooleanClass; |
extern JSClass js_BooleanClass; |
76 |
|
|