Branch Coverage

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


line true false branch
266 43085 1 if (!basic_type) {
279 3131 39955 if (op_extends) {
293 25074 18012 if (type->basic_type->class_dir) {
302 8213 34873 if (strstr(basic_type_name, "::anon::")) {
307 34873 8213 if (!basic_type->is_anon) {
308 0 34873 assert(!islower(basic_type_name[0]));
311 2 34871 if (strcmp(basic_type_name, compiler->current_outer_class_name) != 0) {
317 8212 34871 for (int32_t i = 0; i < anon_op_types->length; i++) {
321 0 8212 assert(anon_basic_type);
329 9638 33446 if (op_list_attributes) {
331 9642 9638 while ((op_attribute = SPVM_OP_sibling(compiler, op_attribute))) {
376 1 9637 if (class_attributes_count > 1) {
379 1 9637 if (access_control_attributes_count > 1) {
384 33918 9166 if (basic_type->category == 0) {
389 34660 8424 if (basic_type->access_control_type == SPVM_ATTRIBUTE_C_ID_UNKNOWN) {
394 38523 4561 if (op_block) {
397 315837 38516 while ((op_decl = SPVM_OP_sibling(compiler, op_decl))) {
399 206 315631 if (op_decl->id == SPVM_OP_C_ID_VERSION_DECL) {
400 1 205 if (type->basic_type->version_string) {
415 1427 204 for (int32_t version_global_string_address_id = 0; version_global_string_address_id < version_string_length; version_global_string_address_id++) {
418 1223 204 if (!(ch == '.' || isdigit(ch))) {
1 1222 if (!(ch == '.' || isdigit(ch))) {
423 204 1222 if (ch == '.') {
427 1210 216 if (dot_count > 0 && isdigit(ch)) {
1006 204 if (dot_count > 0 && isdigit(ch)) {
432 1 204 if (invalid_char) {
437 1 203 if (!isdigit(version_string[0])) {
442 1 202 if (!isdigit(version_string[version_string_length - 1])) {
447 1 201 if (!(dot_count <= 1)) {
452 2 199 if (!(digits_after_dot % 3 == 0)) {
460 0 199 if (*end != '\0') {
471 29406 286225 else if (op_decl->id == SPVM_OP_C_ID_USE) {
478 16 29390 if (alias_name) {
482 1 15 if (islower(alias_name[0])) {
488 2 13 if (use_basic_type_name_exists) {
498 533 285692 else if (op_decl->id == SPVM_OP_C_ID_ALLOW) {
502 1386 284306 else if (op_decl->id == SPVM_OP_C_ID_INTERFACE) {
503 1 1385 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_MULNUM) {
511 8179 276127 else if (op_decl->id == SPVM_OP_C_ID_CLASS_VAR) {
514 1 8178 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_INTERFACE) {
520 7616 563 if (class_var->has_getter) {
533 7614 2 if (SPVM_TYPE_is_byte_type(compiler, class_var_type->basic_type->id, class_var_type->dimension, class_var_type->flag)
534 2 7612 || SPVM_TYPE_is_short_type(compiler, class_var_type->basic_type->id, class_var_type->dimension, class_var_type->flag))
566 89 8090 if (class_var->has_setter) {
587 87 2 if (SPVM_TYPE_is_byte_type(compiler, class_var_type->basic_type->id, class_var_type->dimension, class_var_type->flag)
588 2 85 || SPVM_TYPE_is_short_type(compiler, class_var_type->basic_type->id, class_var_type->dimension, class_var_type->flag))
633 27760 248367 else if (op_decl->id == SPVM_OP_C_ID_FIELD) {
636 1 27759 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_INTERFACE) {
642 17511 10249 if (field->has_getter) {
653 15912 1599 if (SPVM_TYPE_is_byte_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)
654 1599 14313 || SPVM_TYPE_is_short_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag))
688 1423 26337 if (field->has_setter) {
706 1325 98 if (SPVM_TYPE_is_byte_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag)
707 98 1227 || SPVM_TYPE_is_short_type(compiler, field_type->basic_type->id, field_type->dimension, field_type->flag))
758 3249 245118 else if (op_decl->id == SPVM_OP_C_ID_ENUM) {
762 3805 3249 while ((op_method = SPVM_OP_sibling(compiler, op_method))) {
767 245118 0 else if (op_decl->id == SPVM_OP_C_ID_METHOD) {
774 35 245118 for (int32_t i = 0; i < anon_method_fields->length; i++) {
782 1548 243570 if (op_decl->uv.method->is_init) {
793 27795 43084 for (int32_t i = 0; i < type->basic_type->unmerged_fields->length; i++) {
797 26411 1384 if (field->access_control_type == SPVM_ATTRIBUTE_C_ID_UNKNOWN) {
799 35 26376 if (basic_type->is_anon) {
803 1290 25086 else if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_MULNUM) {
817 1 27794 if (found_field) {
829 8179 43084 for (int32_t i = 0; i < type->basic_type->class_vars->length; i++) {
835 1 8178 if (found_class_var) {
850 265404 41536 for (int32_t i = 0; i < type->basic_type->methods->length; i++) {
852 1548 263856 if (method->is_init) {
859 36939 6145 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_CLASS && !has_init_block) {
35392 1547 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_CLASS && !has_init_block) {
876 310954 43084 for (int32_t i = 0; i < type->basic_type->methods->length; i++) {
879 116141 194813 if (!method->is_class_method) {
888 6130 304824 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_INTERFACE) {
892 66055 238769 if (method->is_native) {
900 238769 72185 if (must_have_block && !method->op_block) {
2 238767 if (must_have_block && !method->op_block) {
907 231570 79384 if (method->args_length > 0) {
910 116141 115429 if (!method->is_class_method) {
914 0 116141 assert(arg_invocant_type->basic_type);
920 0 115429 assert(op_arg_first_type->uv.type->basic_type);
923 510868 231570 for (int32_t arg_index = 0; arg_index < method->args_length; arg_index++) {
931 13088 297866 if (strlen(method_name) == 0 && method->is_class_method) {
1 13087 if (strlen(method_name) == 0 && method->is_class_method) {
935 6130 304824 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_INTERFACE) {
937 4 6126 if (method->is_class_method) {
941 304822 2 else if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_CLASS) {
942 1 304821 if (method->is_required) {
947 66056 244898 if (method->is_native) {
948 2 66054 if (method->op_block) {
955 3 310951 if (found_method) {
961 0 310951 if (found_method_name) {
968 763 310188 if (method->is_destructor) {
972 36938 274013 if (method->is_init) {
976 0 310951 assert(method->op_method->file);
993 282 42802 if (type->basic_type->category == SPVM_NATIVE_C_BASIC_TYPE_CATEGORY_MULNUM) {
994 2 280 if (type->basic_type->methods->length > 0) {
997 2 280 if (type->basic_type->class_vars->length > 0) {
1000 8 274 if (type->basic_type->unmerged_fields->length == 0) {
1003 1 273 else if (type->basic_type->unmerged_fields->length > 255) {
1059 14 81833 if (op_name_alias) {
1075 3805 3249 while ((op_method = SPVM_OP_sibling(compiler, op_method))) {
1080 3805 0 if (op_attributes) {
1082 540 3805 while ((op_attribute = SPVM_OP_sibling(compiler, op_attribute))) {
1106 2 3803 if (access_control_attributes_count > 1) {
1112 0 3805 if (method->access_control_type == SPVM_ATTRIBUTE_C_ID_UNKNOWN) {
1125 3754 51 if (op_constant) {
1129 3754 0 if (constant->type->dimension == 0 && constant->type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) {
3753 1 if (constant->type->dimension == 0 && constant->type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_INT) {
1188 1 8178 if (strstr(name, "::")) {
1199 8179 0 if (op_attributes) {
1203 7751 8179 while ((op_attribute = SPVM_OP_sibling(compiler, op_attribute))) {
1242 2 7749 if (field_method_attributes_count > 1) {
1245 1 7750 if (access_control_attributes_count > 1) {
1252 8048 131 if (class_var->access_control_type == SPVM_ATTRIBUTE_C_ID_UNKNOWN) {
1268 2 27793 if (strstr(field->op_name->uv.name, "::")) {
1279 27795 0 if (op_attributes) {
1283 18899 27795 while ((op_attribute = SPVM_OP_sibling(compiler, op_attribute))) {
1323 2 18897 if (field_method_attributes_count > 1) {
1326 1 18898 if (access_control_attributes_count > 1) {
1341 8213 302747 if (is_anon) {
1345 13088 297872 if (op_name_method == NULL) {
1351 2 310958 if (strstr(method_name, "::")) {
1356 238905 72055 if (op_block) {
1366 274020 36940 if (!is_init && strcmp(method_name, "INIT") == 0) {
2 274018 if (!is_init && strcmp(method_name, "INIT") == 0) {
1372 292026 18934 if (op_attributes) {
1374 321198 292026 while ((op_attribute = SPVM_OP_sibling(compiler, op_attribute))) {
1415 66056 225970 if (method->is_native && method->is_precompile) {
1 66055 if (method->is_native && method->is_precompile) {
1418 0 292026 if (access_control_attributes_count > 1) {
1424 295845 15115 if (method->access_control_type == SPVM_ATTRIBUTE_C_ID_UNKNOWN) {
1429 66056 244904 if ((method->is_native) && op_block) {
2 66054 if ((method->is_native) && op_block) {
1434 40745 270215 if (!op_args) {
1439 116141 194819 if (!method->is_class_method) {
1454 510868 310960 while ((op_arg = SPVM_OP_sibling(compiler, op_arg))) {
1456 482487 28381 if (!found_optional_arg) {
1457 32405 450082 if (arg_var_decl->op_optional_arg_default) {
1471 22 310938 if (op_anon_method_fields) {
1473 35 22 while ((op_anon_method_field = SPVM_OP_sibling(compiler, op_anon_method_field))) {
1480 510868 310960 while ((op_arg = SPVM_OP_sibling(compiler, op_arg))) {
1487 763 310197 if (strcmp(method->op_name->uv.name, "DESTROY") == 0) {
1491 763 0 if (!(method->return_type->dimension == 0 && method->return_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_VOID)) {
2 761 if (!(method->return_type->dimension == 0 && method->return_type->basic_type->id == SPVM_NATIVE_C_BASIC_TYPE_ID_VOID)) {
1496 2 761 if (method->is_class_method) {
1501 4 759 if (method->args_length != 1) {
1506 238905 72055 if (op_block) {
1511 390547 238905 for (int32_t i = method->args_length - 1; i >= 0; i--) {
1513 0 390547 assert(arg_var_decl);
1539 92129 146776 if (SPVM_TYPE_is_void_type(compiler, return_type->basic_type->id, return_type->dimension, return_type->flag)) {
1692 0 1675 if (op_case_statements->id != SPVM_OP_C_ID_LIST) {
1699 576 1099 if (op_default_statement) {
1712 7593 2126 if (op_block) {
1714 7593 0 if (op_statements) {
1720 0 7593 if (!op_last_statement) {
1725 28 7565 else if (op_last_statement->id != SPVM_OP_C_ID_BREAK) {
1743 1634 20 if (op_block) {
1753 228931 284293 if (is_not) {
1761 0 513224 if (SPVM_OP_is_comparison_op(compiler, op_condition_operand)) {
1762 0 0 assert(op_condition_operand->moresib == 0);
1885 0 544 if (!op_statements) {
1913 0 26572 assert(op_while_operand->moresib == 0);
1944 8 4 if (!op_block_false) {
1957 159090 284293 if (op_if->id == SPVM_OP_C_ID_UNLESS) {
1961 25614 258679 else if (op_if->id == SPVM_OP_C_ID_ELSIF) {
1970 117945 325438 if (op_block_true->id != SPVM_OP_C_ID_BLOCK) {
1982 395439 47944 if (op_block_false->id != SPVM_OP_C_ID_BLOCK) {
2019 30294 26499 if (op_length) {
2023 48178 8615 if (op_type->id == SPVM_OP_C_ID_TYPE) {
2027 48178 8615 if (op_type->id == SPVM_OP_C_ID_TYPE && strstr(op_type->uv.type->unresolved_basic_type_name, "::anon::")) {
8213 39965 if (op_type->id == SPVM_OP_C_ID_TYPE && strstr(op_type->uv.type->unresolved_basic_type_name, "::anon::")) {
2034 22 8191 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 17121 8668 while ((op_element = SPVM_OP_sibling(compiler, op_element))) {
2098 592 8076 if (is_key_value_pairs && length % 2 != 0) {
1 591 if (is_key_value_pairs && length % 2 != 0) {
2105 51 8616 if (length == 0) {
2111 8616 0 else if (length > 0) {
2115 1 8615 if (op_first_element->id == SPVM_OP_C_ID_UNDEF) {
2121 563 8052 if (is_key_value_pairs) {
2124 563 0 if (is_key_value_pairs) {
2163 17117 8615 while ((op_element = SPVM_OP_sibling(compiler, op_element))) {
2171 8615 8502 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 2385466 487462 if (op_type) {
2343 7 2872921 if (strstr(op_var->uv.var->name, "::")) {
2359 0 255949 assert(op_invocant->id != SPVM_OP_C_ID_NAME);
2360 139477 116472 if (op_invocant->id == SPVM_OP_C_ID_TYPE || op_invocant->id == SPVM_OP_C_ID_CURRENT_CLASS) {
51165 88312 if (op_invocant->id == SPVM_OP_C_ID_TYPE || op_invocant->id == SPVM_OP_C_ID_CURRENT_CLASS) {
2363 116472 51165 if (op_invocant->id == SPVM_OP_C_ID_TYPE) {
2369 51165 0 else if (op_invocant->id == SPVM_OP_C_ID_CURRENT_CLASS) {
2377 84965 3347 if (op_invocant->id == SPVM_OP_C_ID_VAR) {
2400 122080 7630 for (int32_t i = 0; i < 16; i++) {
2401 58606 63474 if (op_name_lc[i] != '\0') {
2406 1 7629 if (op_first->id != SPVM_OP_C_ID_VAR) {
2542 1 82781 if (!SPVM_OP_is_mutable(compiler, op_dist)) {
2553 1 10352 if (!SPVM_OP_is_mutable(compiler, op_dist)) {
2562 1 15104 if (!SPVM_OP_is_mutable(compiler, op_dist)) {
2633 9424 98813 if (op_dist->id == SPVM_OP_C_ID_VAR || op_dist->id == SPVM_OP_C_ID_EXCEPTION_VAR) {
0 9424 if (op_dist->id == SPVM_OP_C_ID_VAR || op_dist->id == SPVM_OP_C_ID_EXCEPTION_VAR) {
2640 1122 8302 else if (op_dist->id == SPVM_OP_C_ID_DEREF) {
2648 131 8171 else if (op_dist->id == SPVM_OP_C_ID_ARRAY_ACCESS) {
2688 8171 0 else if (op_dist->id == SPVM_OP_C_ID_FIELD_ACCESS) {
2697 86 8085 if (op_invocant->id == SPVM_OP_C_ID_ARRAY_ACCESS) {
2765 35683 72554 if (op_special_assign->id == SPVM_OP_C_ID_POST_INC || op_special_assign->id == SPVM_OP_C_ID_POST_DEC) {
8134 27549 if (op_special_assign->id == SPVM_OP_C_ID_POST_INC || op_special_assign->id == SPVM_OP_C_ID_POST_DEC) {
2947 3 3579679 if (!SPVM_OP_is_mutable(compiler, op_dist)) {
2956 159700 12238 if (op_operand) {
2970 142693 10 if (!op_operand || op_operand->id == SPVM_OP_C_ID_UNDEF) {
3 142690 if (!op_operand || op_operand->id == SPVM_OP_C_ID_UNDEF) {
2984 142694 9 if (!op_type) {
2995 245 17 if (!op_operand || op_operand->id == SPVM_OP_C_ID_UNDEF) {
17 228 if (!op_operand || op_operand->id == SPVM_OP_C_ID_UNDEF) {
3034 130975 209130 if (found_basic_type) {
3082 21628 113157 if (op_length) {
3277 0 1015383 assert(constant);
3310 0 757012 assert(op_constant->uv.constant);
3577 0 54061880 assert(!op->file);
3578 0 54061880 assert(!op->line);
3596 0 19333 if (strcmp(current_basic_type_name, dist_basic_type_name) == 0) {
3600 19324 9 for (int32_t i = 0; i < allows->length; i++) {
3603 19324 0 if (strcmp(current_basic_type_name, allow_basic_type_name) == 0) {
3615 3687916 6 switch (op->id) {
3631 0 513224 switch (op->id) {
3663 3989394 6574180 if (op_cur->moresib) {
3682 1581932 1705158 if (op_parent->first == op_target) {
3689 1705158 1668302 if (op_before->sibparent == op_target) {
3716 784335 831943 if (next_is_child) {
3718 260903 523432 if (op_before->first == op_before->last) {
3733 900315 715963 if (op_target_is_last_child) {
3752 797597 873215 if (next_is_child) {
3755 269074 528523 if (op_before->first == op_before->last) {
3774 941239 729573 if (op_target_is_last_child) {
3785 0 25455845 assert(parent);
3786 0 25455845 assert(insert);
3787 0 25455845 assert(insert->moresib == 0);
3789 11085388 14370457 if (start) {
3790 743354 10342034 if (start->moresib) {
3807 0 14370457 if (parent->first) {
3825 57186780 1303873 return op->moresib ? op->sibparent : NULL;