Coverage Report

Created: 2025-01-11 06:55

/src/mupdf/thirdparty/mujs/jsboolean.c
Line
Count
Source (jump to first uncovered line)
1
#include "jsi.h"
2
3
static void jsB_new_Boolean(js_State *J)
4
0
{
5
0
  js_newboolean(J, js_toboolean(J, 1));
6
0
}
7
8
static void jsB_Boolean(js_State *J)
9
0
{
10
0
  js_pushboolean(J, js_toboolean(J, 1));
11
0
}
12
13
static void Bp_toString(js_State *J)
14
0
{
15
0
  js_Object *self = js_toobject(J, 0);
16
0
  if (self->type != JS_CBOOLEAN) js_typeerror(J, "not a boolean");
17
0
  js_pushliteral(J, self->u.boolean ? "true" : "false");
18
0
}
19
20
static void Bp_valueOf(js_State *J)
21
0
{
22
0
  js_Object *self = js_toobject(J, 0);
23
0
  if (self->type != JS_CBOOLEAN) js_typeerror(J, "not a boolean");
24
0
  js_pushboolean(J, self->u.boolean);
25
0
}
26
27
void jsB_initboolean(js_State *J)
28
0
{
29
0
  J->Boolean_prototype->u.boolean = 0;
30
31
0
  js_pushobject(J, J->Boolean_prototype);
32
0
  {
33
0
    jsB_propf(J, "Boolean.prototype.toString", Bp_toString, 0);
34
0
    jsB_propf(J, "Boolean.prototype.valueOf", Bp_valueOf, 0);
35
0
  }
36
0
  js_newcconstructor(J, jsB_Boolean, jsB_new_Boolean, "Boolean", 1);
37
0
  js_defglobal(J, "Boolean", JS_DONTENUM);
38
0
}