50 |
*/ |
*/ |
51 |
static const char * file_id = NULL; |
static const char * file_id = NULL; |
52 |
static char * lines = NULL; |
static char * lines = NULL; |
53 |
|
static uint16_t num_lines = 0; |
54 |
|
|
55 |
void jscoverage_init(void) { |
void jscoverage_init(void) { |
56 |
runtime = JS_NewRuntime(8L * 1024L * 1024L); |
runtime = JS_NewRuntime(8L * 1024L * 1024L); |
875 |
*/ |
*/ |
876 |
static void instrument_statement(JSParseNode * node, Stream * f, int indent) { |
static void instrument_statement(JSParseNode * node, Stream * f, int indent) { |
877 |
if (node->pn_type != TOK_LC) { |
if (node->pn_type != TOK_LC) { |
878 |
int line = node->pn_pos.begin.lineno; |
uint16_t line = node->pn_pos.begin.lineno; |
879 |
|
if (line > num_lines) { |
880 |
|
fatal("%s: script contains more than 65,535 lines", file_id); |
881 |
|
} |
882 |
|
|
883 |
/* the root node has line number 0 */ |
/* the root node has line number 0 */ |
884 |
if (line != 0) { |
if (line != 0) { |
885 |
Stream_printf(f, "%*s", indent, ""); |
Stream_printf(f, "%*s", indent, ""); |
923 |
if (node == NULL) { |
if (node == NULL) { |
924 |
fatal("parse error in file: %s", file_id); |
fatal("parse error in file: %s", file_id); |
925 |
} |
} |
926 |
int num_lines = node->pn_pos.end.lineno; |
num_lines = node->pn_pos.end.lineno; |
927 |
lines = xmalloc(num_lines); |
lines = xmalloc(num_lines); |
928 |
for (int i = 0; i < num_lines; i++) { |
for (int i = 0; i < num_lines; i++) { |
929 |
lines[i] = 0; |
lines[i] = 0; |