Branch Coverage

lib/SPVM/Builder/src/spvm_op.c
Criterion Covered Total %
branch 446 488 91.3


line true false branch
266 42485 1 if (!basic_type) {
279 3093 39393 if (op_extends) {
293 24714 17772 if (type->basic_type->class_dir) {
302 8093 34393 if (strstr(basic_type_name, "::anon::")) {
307 34393 8093 if (!basic_type->is_anon) {
308 0 34393 assert(!islower(basic_type_name[0]));
311 2 34391 if (strcmp(basic_type_name, compiler->current_outer_class_name) != 0) {
317 8092 34391 for (int32_t i = 0; i < anon_op_types->length; i++) {
321 0 8092 assert(anon_basic_type);
329 9517 32967 if (op_list_attributes) {
331 9521 9517 while ((op_attribute = SPVM_OP_sibling(compiler, op_attribute))) {
376 1 9516 if (class_attributes_count > 1) {
379 1 9516 if (access_control_attributes_count > 1) {
384 33444 9040 if (basic_type->category == 0) {
389 34176 8308 if (basic_type->access_control_type == SPVM_ATTRIBUTE_C_ID_UNKNOWN) {
394 37979 4505 if (op_block) {
397 311589 37972 while ((op_decl = SPVM_OP_sibling(compiler, op_decl))) {
399 210 311379 if (op_decl->id == SPVM_OP_C_ID_VERSION_DECL) {
400 1 209 if (type->basic_type->version_string) {
415 1459 208 for (int32_t version_global_string_address_id = 0; version_global_string_address_id < version_string_length; version_global_string_address_id++) {
418 1251 208 if (!(ch == '.' || isdigit(ch))) {
1 1250 if (!(ch == '.' || isdigit(ch))) {
423 208 1250 if (ch == '.') {
427 1238 220 if (dot_count > 0 && isdigit(ch)) {
1030 208 if (dot_count > 0 && isdigit(ch)) {
432 1 208 if (invalid_char) {
437 1 207 if (!isdigit(version_string[0])) {
442 1 206 if (!isdigit(version_string[version_string_length - 1])) {
447 1 205 if (!(dot_count <= 1)) {
452 2 203 if (!(digits_after_dot % 3 == 0)) {
460 0 203 if (*end != '\0') {
471 28908 282471 else if (op_decl->id == SPVM_OP_C_ID_USE) {
478 16 28892 if (alias_name) {
482 1 15 if (islower(alias_name[0])) {
488 2 13 if (use_basic_type_name_exists) {
498 525 281946 else if (op_decl->id == SPVM_OP_C_ID_ALLOW) {
502 1394 280552 else if (op_decl->id == SPVM_OP_C_ID_INTERFACE) {
503 1 1393 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_MULNUM) {
511 8115 272437 else if (op_decl->id == SPVM_OP_C_ID_CLASS_VAR) {
514 1 8114 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_INTERFACE) {
520 7518 597 if (class_var->has_getter) {
533 7516 2 if (SPVM_TYPE_is_byte_type(compiler, class_var_type->basic_type->id, class_var_type->dimension, class_var_type->flag)
534 2 7514 || SPVM_TYPE_is_short_type(compiler, class_var_type->basic_type->id, class_var_type->dimension, class_var_type->flag))
566 91 8024 if (class_var->has_setter) {
587 89 2 if (SPVM_TYPE_is_byte_type(compiler, class_var_type->basic_type->id, class_var_type->dimension, class_var_type->flag)
588 2 87 || SPVM_TYPE_is_short_type(compiler, class_var_type->basic_type->id, class_var_type->dimension, class_var_type->flag))
633 27424 245013 else if (op_decl->id == SPVM_OP_C_ID_FIELD) {
636 1 27423 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_INTERFACE) {
642 17351 10073 if (field->has_getter) {
653 15768 1583 if (SPVM_TYPE_is_byte_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)
654 1583 14185 || SPVM_TYPE_is_short_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag))
688 1481 25943 if (field->has_setter) {
706 1379 102 if (SPVM_TYPE_is_byte_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)
707 102 1277 || SPVM_TYPE_is_short_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag))
758 3203 241810 else if (op_decl->id == SPVM_OP_C_ID_ENUM) {
762 3751 3203 while ((op_method = SPVM_OP_sibling(compiler, op_method))) {
767 241810 0 else if (op_decl->id == SPVM_OP_C_ID_METHOD) {
774 35 241810 for (int32_t i = 0; i < anon_method_fields->length; i++) {
782 1530 240280 if (op_decl->uv.method->is_init) {
793 27459 42484 for (int32_t i = 0; i < type->basic_type->unmerged_fields->length; i++) {
797 26027 1432 if (field->access_control_type == SPVM_ATTRIBUTE_C_ID_UNKNOWN) {
799 35 25992 if (basic_type->is_anon) {
803 1294 24698 else if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_MULNUM) {
817 1 27458 if (found_field) {
829 8115 42484 for (int32_t i = 0; i < type->basic_type->class_vars->length; i++) {
835 1 8114 if (found_class_var) {
850 261410 40954 for (int32_t i = 0; i < type->basic_type->methods->length; i++) {
852 1530 259880 if (method->is_init) {
859 36411 6073 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_CLASS && !has_init_block) {
34882 1529 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_CLASS && !has_init_block) {
876 306884 42484 for (int32_t i = 0; i < type->basic_type->methods->length; i++) {
879 114271 192613 if (!method->is_class_method) {
888 6064 300820 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_INTERFACE) {
892 64985 235835 if (method->is_native) {
900 235835 71049 if (must_have_block && !method->op_block) {
2 235833 if (must_have_block && !method->op_block) {
907 228178 78706 if (method->args_length > 0) {
910 114271 113907 if (!method->is_class_method) {
914 0 114271 assert(arg_invocant_type->basic_type);
920 0 113907 assert(op_arg_first_type->uv.type->basic_type);
923 503366 228178 for (int32_t arg_index = 0; arg_index < method->args_length; arg_index++) {
931 12902 293982 if (strlen(method_name) == 0 && method->is_class_method) {
1 12901 if (strlen(method_name) == 0 && method->is_class_method) {
935 6064 300820 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_INTERFACE) {
937 4 6060 if (method->is_class_method) {
941 300818 2 else if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_CLASS) {
942 1 300817 if (method->is_required) {
947 64986 241898 if (method->is_native) {
948 2 64984 if (method->op_block) {
955 3 306881 if (found_method) {
961 0 306881 if (found_method_name) {
968 745 306136 if (method->is_destructor) {
972 36410 270471 if (method->is_init) {
976 0 306881 assert(method->op_method->file);
993 284 42200 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_MULNUM) {
994 2 282 if (type->basic_type->methods->length > 0) {
997 2 282 if (type->basic_type->class_vars->length > 0) {
1000 8 276 if (type->basic_type->unmerged_fields->length == 0) {
1003 1 275 else if (type->basic_type->unmerged_fields->length > 255) {
1059 14 80293 if (op_name_alias) {
1075 3751 3203 while ((op_method = SPVM_OP_sibling(compiler, op_method))) {
1080 3751 0 if (op_attributes) {
1082 532 3751 while ((op_attribute = SPVM_OP_sibling(compiler, op_attribute))) {
1106 2 3749 if (access_control_attributes_count > 1) {
1112 0 3751 if (method->access_control_type == SPVM_ATTRIBUTE_C_ID_UNKNOWN) {
1125 3698 53 if (op_constant) {
1129 3698 0 if (constant->type->dimension == 0 && constant->type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) {
3697 1 if (constant->type->dimension == 0 && constant->type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) {
1188 1 8114 if (strstr(name, "::")) {
1199 8115 0 if (op_attributes) {
1203 7657 8115 while ((op_attribute = SPVM_OP_sibling(compiler, op_attribute))) {
1242 2 7655 if (field_method_attributes_count > 1) {
1245 1 7656 if (access_control_attributes_count > 1) {
1252 7980 135 if (class_var->access_control_type == SPVM_ATTRIBUTE_C_ID_UNKNOWN) {
1268 2 27457 if (strstr(field->op_name->uv.name, "::")) {
1279 27459 0 if (op_attributes) {
1283 18787 27459 while ((op_attribute = SPVM_OP_sibling(compiler, op_attribute))) {
1323 2 18785 if (field_method_attributes_count > 1) {
1326 1 18786 if (access_control_attributes_count > 1) {
1341 8093 298797 if (is_anon) {
1345 12902 293988 if (op_name_method == NULL) {
1351 2 306888 if (strstr(method_name, "::")) {
1356 235975 70915 if (op_block) {
1366 270478 36412 if (!is_init && strcmp(method_name, "INIT") == 0) {
2 270476 if (!is_init && strcmp(method_name, "INIT") == 0) {
1372 288058 18832 if (op_attributes) {
1374 317042 288058 while ((op_attribute = SPVM_OP_sibling(compiler, op_attribute))) {
1415 64986 223072 if (method->is_native && method->is_precompile) {
1 64985 if (method->is_native && method->is_precompile) {
1418 0 288058 if (access_control_attributes_count > 1) {
1424 291997 14893 if (method->access_control_type == SPVM_ATTRIBUTE_C_ID_UNKNOWN) {
1429 64986 241904 if ((method->is_native) && op_block) {
2 64984 if ((method->is_native) && op_block) {
1434 40163 266727 if (!op_args) {
1439 114271 192619 if (!method->is_class_method) {
1454 503366 306890 while ((op_arg = SPVM_OP_sibling(compiler, op_arg))) {
1456 475383 27983 if (!found_optional_arg) {
1457 31935 443448 if (arg_var_decl->op_optional_arg_default) {
1471 22 306868 if (op_anon_method_fields) {
1473 35 22 while ((op_anon_method_field = SPVM_OP_sibling(compiler, op_anon_method_field))) {
1480 503366 306890 while ((op_arg = SPVM_OP_sibling(compiler, op_arg))) {
1487 745 306145 if (strcmp(method->op_name->uv.name, "DESTROY") == 0) {
1491 745 0 if (!(method->return_type->dimension == 0 && method->return_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_VOID)) {
2 743 if (!(method->return_type->dimension == 0 && method->return_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_VOID)) {
1496 2 743 if (method->is_class_method) {
1501 4 741 if (method->args_length != 1) {
1506 235975 70915 if (op_block) {
1511 385167 235975 for (int32_t i = method->args_length - 1; i >= 0; i--) {
1513 0 385167 assert(arg_var_decl);
1539 90873 145102 if (SPVM_TYPE_is_void_type(compiler, return_type->basic_type->id, return_type->dimension, return_type->flag)) {
1692 0 1651 if (op_case_statements->id != SPVM_OP_C_ID_LIST) {
1699 568 1083 if (op_default_statement) {
1712 7481 2094 if (op_block) {
1714 7481 0 if (op_statements) {
1720 0 7481 if (!op_last_statement) {
1725 28 7453 else if (op_last_statement->id != SPVM_OP_C_ID_BREAK) {
1743 1610 20 if (op_block) {
1753 225775 280243 if (is_not) {
1761 0 506018 if (SPVM_OP_is_comparison_op(compiler, op_condition_operand)) {
1762 0 0 assert(op_condition_operand->moresib == 0);
1885 0 536 if (!op_statements) {
1913 0 26172 assert(op_while_operand->moresib == 0);
1944 8 4 if (!op_block_false) {
1957 156994 280243 if (op_if->id == SPVM_OP_C_ID_UNLESS) {
1961 25232 255011 else if (op_if->id == SPVM_OP_C_ID_ELSIF) {
1970 116183 321054 if (op_block_true->id != SPVM_OP_C_ID_BLOCK) {
1982 390005 47232 if (op_block_false->id != SPVM_OP_C_ID_BLOCK) {
2019 29920 26167 if (op_length) {
2023 47548 8539 if (op_type->id == SPVM_OP_C_ID_TYPE) {
2027 47548 8539 if (op_type->id == SPVM_OP_C_ID_TYPE && strstr(op_type->uv.type->unresolved_basic_type_name, "::anon::")) {
8093 39455 if (op_type->id == SPVM_OP_C_ID_TYPE && strstr(op_type->uv.type->unresolved_basic_type_name, "::anon::")) {
2034 22 8071 if (anon_method->anon_method_fields->length) {
2057 35 22 for (int32_t caputre_index = 0; caputre_index < anon_method->anon_method_fields->length; caputre_index++) {
2063 27 8 if (op_anon_method_field_default) {
2093 17037 8592 while ((op_element = SPVM_OP_sibling(compiler, op_element))) {
2098 584 8008 if (is_key_value_pairs && length % 2 != 0) {
1 583 if (is_key_value_pairs && length % 2 != 0) {
2105 51 8540 if (length == 0) {
2111 8540 0 else if (length > 0) {
2115 1 8539 if (op_first_element->id == SPVM_OP_C_ID_UNDEF) {
2121 555 7984 if (is_key_value_pairs) {
2124 555 0 if (is_key_value_pairs) {
2163 17033 8539 while ((op_element = SPVM_OP_sibling(compiler, op_element))) {
2171 8539 8494 if (index == 0) {
2220 4 15 if (op_name->id == SPVM_OP_C_ID_CONSTANT) {
2226 4 0 if (SPVM_TYPE_is_string_type(compiler, constant_type->basic_type->id, constant_type->dimension, constant_type->flag)) {
2227 3 1 if (strcmp(constant_chars, "") == 0) {
2232 1 3 if (!is_empty_string) {
2330 2353668 480738 if (op_type) {
2343 7 2834399 if (strstr(op_var->uv.var->name, "::")) {
2359 0 252759 assert(op_invocant->id != SPVM_OP_C_ID_NAME);
2360 137507 115252 if (op_invocant->id == SPVM_OP_C_ID_TYPE || op_invocant->id == SPVM_OP_C_ID_CURRENT_CLASS) {
50437 87070 if (op_invocant->id == SPVM_OP_C_ID_TYPE || op_invocant->id == SPVM_OP_C_ID_CURRENT_CLASS) {
2363 115252 50437 if (op_invocant->id == SPVM_OP_C_ID_TYPE) {
2369 50437 0 else if (op_invocant->id == SPVM_OP_C_ID_CURRENT_CLASS) {
2377 83771 3299 if (op_invocant->id == SPVM_OP_C_ID_VAR) {
2400 120800 7550 for (int32_t i = 0; i < 16; i++) {
2401 57966 62834 if (op_name_lc[i] != '\0') {
2406 1 7549 if (op_first->id != SPVM_OP_C_ID_VAR) {
2542 1 81529 if (!SPVM_OP_is_mutable(compiler, op_dist)) {
2553 1 10200 if (!SPVM_OP_is_mutable(compiler, op_dist)) {
2562 1 14880 if (!SPVM_OP_is_mutable(compiler, op_dist)) {
2633 9288 97321 if (op_dist->id == SPVM_OP_C_ID_VAR || op_dist->id == SPVM_OP_C_ID_EXCEPTION_VAR) {
0 9288 if (op_dist->id == SPVM_OP_C_ID_VAR || op_dist->id == SPVM_OP_C_ID_EXCEPTION_VAR) {
2640 1106 8182 else if (op_dist->id == SPVM_OP_C_ID_DEREF) {
2648 131 8051 else if (op_dist->id == SPVM_OP_C_ID_ARRAY_ACCESS) {
2688 8051 0 else if (op_dist->id == SPVM_OP_C_ID_FIELD_ACCESS) {
2697 86 7965 if (op_invocant->id == SPVM_OP_C_ID_ARRAY_ACCESS) {
2765 35155 71454 if (op_special_assign->id == SPVM_OP_C_ID_POST_INC || op_special_assign->id == SPVM_OP_C_ID_POST_DEC) {
8014 27141 if (op_special_assign->id == SPVM_OP_C_ID_POST_INC || op_special_assign->id == SPVM_OP_C_ID_POST_DEC) {
2947 3 3530583 if (!SPVM_OP_is_mutable(compiler, op_dist)) {
2956 158100 12054 if (op_operand) {
2970 140551 10 if (!op_operand || op_operand->id == SPVM_OP_C_ID_UNDEF) {
3 140548 if (!op_operand || op_operand->id == SPVM_OP_C_ID_UNDEF) {
2984 140552 9 if (!op_type) {
2995 247 17 if (!op_operand || op_operand->id == SPVM_OP_C_ID_UNDEF) {
17 230 if (!op_operand || op_operand->id == SPVM_OP_C_ID_UNDEF) {
3034 128545 206844 if (found_basic_type) {
3082 21330 111471 if (op_length) {
3277 0 1002055 assert(constant);
3310 0 747358 assert(op_constant->uv.constant);
3577 0 53326358 assert(!op->file);
3578 0 53326358 assert(!op->line);
3596 0 19037 if (strcmp(current_basic_type_name, dist_basic_type_name) == 0) {
3600 19028 9 for (int32_t i = 0; i < allows->length; i++) {
3603 19028 0 if (strcmp(current_basic_type_name, allow_basic_type_name) == 0) {
3615 3637192 6 switch (op->id) {
3631 0 506018 switch (op->id) {
3663 3936890 6488448 if (op_cur->moresib) {
3682 1562204 1682020 if (op_parent->first == op_target) {
3689 1682020 1645034 if (op_before->sibparent == op_target) {
3716 774509 820565 if (next_is_child) {
3718 257843 516666 if (op_before->first == op_before->last) {
3733 888635 706439 if (op_target_is_last_child) {
3752 787695 861455 if (next_is_child) {
3755 265894 521801 if (op_before->first == op_before->last) {
3774 929065 720085 if (op_target_is_last_child) {
3785 0 25109895 assert(parent);
3786 0 25109895 assert(insert);
3787 0 25109895 assert(insert->moresib == 0);
3789 10934221 14175674 if (start) {
3790 733276 10200945 if (start->moresib) {
3807 0 14175674 if (parent->first) {
3825 56390275 1286834 return op->moresib ? op->sibparent : NULL;