From 0c1eb53281d64c978a19369321f501b486f897da Mon Sep 17 00:00:00 2001 From: Vedant Tewari Date: Mon, 2 Sep 2024 14:59:06 -0500 Subject: [PATCH] Refactored malformed checks in parser --- cobc/parser.y | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cobc/parser.y b/cobc/parser.y index 85575841d..9aec12614 100644 --- a/cobc/parser.y +++ b/cobc/parser.y @@ -12257,15 +12257,14 @@ call_body: char* s = (char *)CB_LITERAL ($3)->data; if (strncasecmp("Java.", s, 5) == 0) { call_conv = CB_CONV_JAVA; - } - /* Check for malformed Java method names */ - char* class_and_method_name = s + 5; - if (strchr(class_and_method_name, '.') == NULL) { - cb_error_x ($3, _("malformed Java method name '%s', expected format 'Java.ClassName.methodName'"), s); - } - /* Check for unsupported Java method calls with parameters or return values */ - if($7 != NULL || $8 != NULL) { - CB_PENDING("Java method calls with parameters or return values"); + /* Check for malformed Java method names */ + if (strchr(s + 5, '.') == NULL) { + cb_error_x ($3, _("malformed Java method name '%s', expected format 'Java.ClassName.methodName'"), s); + } + /* Check for unsupported Java method calls with parameters or return values */ + if($7 != NULL || $8 != NULL) { + CB_PENDING("Java method calls with parameters or return values"); + } } cb_check_conformance ($3, $7, $8); } else if (CB_REFERENCE_P ($3)) {