Combine code in CFXJSE_FormCalcContext::GenerateSomExpression().

There exists an if-else branch where the two branches are very similar.

Change-Id: Ic6c6ed1120dca2b9bdd9b17ea371b8f5f8ac5243
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52050
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index 9651ac8..3d06629 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -5412,18 +5412,16 @@
     return ByteString(bsName, "[") + ByteString::FormatInteger(iIndexValue) +
            "]";
   }
-  ByteString bsSomExp;
-  if (iIndexFlags == 2) {
-    bsSomExp = (iIndexValue < 0) ? (bsName + "[-") : (bsName + "[+");
-    iIndexValue = (iIndexValue < 0) ? (0 - iIndexValue) : iIndexValue;
-    bsSomExp += ByteString::FormatInteger(iIndexValue);
-    bsSomExp += "]";
-  } else {
-    bsSomExp = (iIndexValue < 0) ? (bsName + "[") : (bsName + "[-");
-    iIndexValue = (iIndexValue < 0) ? (0 - iIndexValue) : iIndexValue;
-    bsSomExp += ByteString::FormatInteger(iIndexValue);
-    bsSomExp += "]";
-  }
+
+  const bool bNegative = iIndexValue < 0;
+  ByteString bsSomExp(bsName);
+  if (iIndexFlags == 2)
+    bsSomExp += bNegative ? "[-" : "[+";
+  else
+    bsSomExp += bNegative ? "[" : "[-";
+  iIndexValue = bNegative ? 0 - iIndexValue : iIndexValue;
+  bsSomExp += ByteString::FormatInteger(iIndexValue);
+  bsSomExp += "]";
   return bsSomExp;
 }