Nest two enum types in CXFA_FMExpression.

Avoid more top-level pollution.

-- make AccessorIndex an enum class.
-- remove unreachable default since all enum class values are handled.
-- avoid single-character variable name.
-- spell kInferred with two Rs.

Change-Id: I290317f7473844b4eea574e93138dc09ccb0fbbc
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/84330
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
index 89f3d43..cdec1ab 100644
--- a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
@@ -228,7 +228,7 @@
 
   CFX_WideTextBuf tempExp1;
   const CXFA_FMSimpleExpression* exp1 = GetFirstExpression();
-  if (!exp1->ToJavaScript(&tempExp1, ReturnType::kInfered))
+  if (!exp1->ToJavaScript(&tempExp1, ReturnType::kInferred))
     return false;
 
   *js << "if (pfm_rt.is_obj(" << tempExp1 << "))\n{\n";
@@ -237,7 +237,7 @@
 
   CFX_WideTextBuf tempExp2;
   const CXFA_FMSimpleExpression* exp2 = GetSecondExpression();
-  if (!exp2->ToJavaScript(&tempExp2, ReturnType::kInfered))
+  if (!exp2->ToJavaScript(&tempExp2, ReturnType::kInferred))
     return false;
 
   *js << "pfm_rt.asgn_val_op(" << tempExp1 << ", " << tempExp2 << ");\n}\n";
@@ -270,10 +270,10 @@
     return false;
 
   *js << "pfm_rt." << m_OpName << "(";
-  if (!GetFirstExpression()->ToJavaScript(js, ReturnType::kInfered))
+  if (!GetFirstExpression()->ToJavaScript(js, ReturnType::kInferred))
     return false;
   *js << ", ";
-  if (!GetSecondExpression()->ToJavaScript(js, ReturnType::kInfered))
+  if (!GetSecondExpression()->ToJavaScript(js, ReturnType::kInferred))
     return false;
   *js << ")";
   return !CXFA_IsTooBig(*js);
@@ -385,7 +385,7 @@
     return false;
 
   *js << "pfm_rt." << m_OpName.c_str() << "(";
-  if (!m_pExp->ToJavaScript(js, ReturnType::kInfered))
+  if (!m_pExp->ToJavaScript(js, ReturnType::kInferred))
     return false;
   *js << ")";
   return !CXFA_IsTooBig(*js);
@@ -463,7 +463,7 @@
     return false;
 
   CFX_WideTextBuf funcName;
-  if (!m_pExp->ToJavaScript(&funcName, ReturnType::kInfered))
+  if (!m_pExp->ToJavaScript(&funcName, ReturnType::kInferred))
     return false;
 
   if (m_bIsSomMethod) {
@@ -481,7 +481,7 @@
           *js << "val";
 
         *js << "(";
-        if (!m_Arguments[i]->ToJavaScript(js, ReturnType::kInfered))
+        if (!m_Arguments[i]->ToJavaScript(js, ReturnType::kInferred))
           return false;
         *js << ")";
         if (i + 1 < m_Arguments.size())
@@ -490,7 +490,7 @@
     } else {
       for (const auto& expr : m_Arguments) {
         *js << "pfm_rt.get_val(";
-        if (!expr->ToJavaScript(js, ReturnType::kInfered))
+        if (!expr->ToJavaScript(js, ReturnType::kInferred))
           return false;
         *js << ")";
         if (expr != m_Arguments.back())
@@ -526,7 +526,7 @@
     *js << "\n(\nfunction ()\n{\ntry\n{\n";
     if (!m_Arguments.empty()) {
       *js << "return ";
-      if (!m_Arguments[0]->ToJavaScript(js, ReturnType::kInfered))
+      if (!m_Arguments[0]->ToJavaScript(js, ReturnType::kInferred))
         return false;
       *js << ";\n}\n";
     } else {
@@ -536,7 +536,7 @@
     *js << "{\nreturn 0;\n}\n}\n).call(this)\n";
   } else {
     for (const auto& expr : m_Arguments) {
-      if (!expr->ToJavaScript(js, ReturnType::kInfered))
+      if (!expr->ToJavaScript(js, ReturnType::kInferred))
         return false;
       if (expr != m_Arguments.back())
         *js << ", ";
@@ -570,7 +570,7 @@
   CFX_WideTextBuf tempExp1;
   CXFA_FMSimpleExpression* exp1 = GetFirstExpression();
   if (exp1) {
-    if (!exp1->ToJavaScript(&tempExp1, ReturnType::kInfered))
+    if (!exp1->ToJavaScript(&tempExp1, ReturnType::kInferred))
       return false;
 
     *js << tempExp1;
@@ -593,7 +593,7 @@
     *js << "\"" << m_wsIdentifier << "\", ";
 
   CXFA_FMSimpleExpression* exp2 = GetSecondExpression();
-  if (!exp2->ToJavaScript(js, ReturnType::kInfered))
+  if (!exp2->ToJavaScript(js, ReturnType::kInferred))
     return false;
 
   *js << ")";
@@ -601,7 +601,7 @@
 }
 
 CXFA_FMIndexExpression::CXFA_FMIndexExpression(
-    XFA_FM_AccessorIndex accessorIndex,
+    AccessorIndex accessorIndex,
     CXFA_FMSimpleExpression* pIndexExp,
     bool bIsStarIndex)
     : CXFA_FMSimpleExpression(TOKlbracket),
@@ -623,27 +623,25 @@
     return false;
 
   switch (m_accessorIndex) {
-    case ACCESSOR_NO_INDEX:
+    case AccessorIndex::kNoIndex:
       *js << "0";
       break;
-    case ACCESSOR_NO_RELATIVEINDEX:
+    case AccessorIndex::kNoRelativeIndex:
       *js << "1";
       break;
-    case ACCESSOR_POSITIVE_INDEX:
+    case AccessorIndex::kPositiveIndex:
       *js << "2";
       break;
-    case ACCESSOR_NEGATIVE_INDEX:
+    case AccessorIndex::kNegativeIndex:
       *js << "3";
       break;
-    default:
-      *js << "0";
   }
   if (m_bIsStarIndex)
     return !CXFA_IsTooBig(*js);
 
   *js << ", ";
   if (m_pExp) {
-    if (!m_pExp->ToJavaScript(js, ReturnType::kInfered))
+    if (!m_pExp->ToJavaScript(js, ReturnType::kInferred))
       return false;
   } else {
     *js << "0";
@@ -669,18 +667,18 @@
 
   CXFA_FMSimpleExpression* exp1 = GetFirstExpression();
   *js << "pfm_rt.dotdot_acc(";
-  if (!exp1->ToJavaScript(js, ReturnType::kInfered))
+  if (!exp1->ToJavaScript(js, ReturnType::kInferred))
     return false;
   *js << ", "
       << "\"";
   if (exp1->GetOperatorToken() == TOKidentifier) {
-    if (!exp1->ToJavaScript(js, ReturnType::kInfered))
+    if (!exp1->ToJavaScript(js, ReturnType::kInferred))
       return false;
   }
 
   CXFA_FMSimpleExpression* exp2 = GetSecondExpression();
   *js << "\", \"" << m_wsIdentifier << "\", ";
-  if (!exp2->ToJavaScript(js, ReturnType::kInfered))
+  if (!exp2->ToJavaScript(js, ReturnType::kInferred))
     return false;
   *js << ")";
   return !CXFA_IsTooBig(*js);
@@ -700,13 +698,13 @@
     return false;
 
   CFX_WideTextBuf buf;
-  if (!GetFirstExpression()->ToJavaScript(&buf, ReturnType::kInfered))
+  if (!GetFirstExpression()->ToJavaScript(&buf, ReturnType::kInferred))
     return false;
 
   *js << "(function() {\n";
   *js << "  return pfm_method_runner(" << buf << ", function(obj) {\n";
   *js << "    return obj.";
-  if (!GetSecondExpression()->ToJavaScript(js, ReturnType::kInfered))
+  if (!GetSecondExpression()->ToJavaScript(js, ReturnType::kInferred))
     return false;
   *js << ";\n";
   *js << "  });\n";
@@ -752,7 +750,7 @@
   *js << "var pfm_ret = null;\n";
   for (const auto& expr : m_pExpressions) {
     ReturnType ret_type = expr == m_pExpressions.back() ? ReturnType::kImplied
-                                                        : ReturnType::kInfered;
+                                                        : ReturnType::kInferred;
     if (!expr->ToJavaScript(js, ret_type))
       return false;
   }
@@ -793,8 +791,10 @@
   js << "};\n";
   js << "var pfm_ret = null;\n";
   for (const auto& expr : expressions_) {
-    ReturnType ret_type = expr == expressions_.back() ? ReturnType::kImplied
-                                                      : ReturnType::kInfered;
+    CXFA_FMAssignExpression::ReturnType ret_type =
+        expr == expressions_.back()
+            ? CXFA_FMAssignExpression::ReturnType::kImplied
+            : CXFA_FMAssignExpression::ReturnType::kInferred;
     if (!expr->ToJavaScript(&js, ret_type))
       return pdfium::nullopt;
   }
@@ -827,7 +827,7 @@
   WideString tempName = IdentifierToName(m_wsName);
   *js << "var " << tempName << " = ";
   if (m_pInit) {
-    if (!m_pInit->ToJavaScript(js, ReturnType::kInfered))
+    if (!m_pInit->ToJavaScript(js, ReturnType::kInferred))
       return false;
 
     *js << ";\n";
@@ -858,8 +858,8 @@
   if (CXFA_IsTooBig(*js) || !depthManager.IsWithinMaxDepth())
     return false;
 
-  if (type == ReturnType::kInfered) {
-    bool ret = m_pExpression->ToJavaScript(js, ReturnType::kInfered);
+  if (type == ReturnType::kInferred) {
+    bool ret = m_pExpression->ToJavaScript(js, ReturnType::kInferred);
     if (m_pExpression->GetOperatorToken() != TOKassign)
       *js << ";\n";
 
@@ -875,7 +875,7 @@
       m_pExpression->GetOperatorToken() == TOKdotdot ||
       m_pExpression->GetOperatorToken() == TOKdot) {
     *js << "pfm_ret = pfm_rt.get_val(";
-    if (!m_pExpression->ToJavaScript(js, ReturnType::kInfered))
+    if (!m_pExpression->ToJavaScript(js, ReturnType::kInferred))
       return false;
 
     *js << ");\n";
@@ -883,7 +883,7 @@
   }
 
   *js << "pfm_ret = ";
-  if (!m_pExpression->ToJavaScript(js, ReturnType::kInfered))
+  if (!m_pExpression->ToJavaScript(js, ReturnType::kInferred))
     return false;
 
   *js << ";\n";
@@ -909,13 +909,13 @@
 
   *js << "{\n";
   for (const auto& expr : m_ExpressionList) {
-    if (type == ReturnType::kInfered) {
-      if (!expr->ToJavaScript(js, ReturnType::kInfered))
+    if (type == ReturnType::kInferred) {
+      if (!expr->ToJavaScript(js, ReturnType::kInferred))
         return false;
     } else {
       ReturnType ret_type = expr == m_ExpressionList.back()
                                 ? ReturnType::kImplied
-                                : ReturnType::kInfered;
+                                : ReturnType::kInferred;
       if (!expr->ToJavaScript(js, ret_type))
         return false;
     }
@@ -976,7 +976,7 @@
     *js << "pfm_ret = 0;\n";
 
   *js << "if (pfm_rt.get_val(";
-  if (!m_pExpression->ToJavaScript(js, ReturnType::kInfered))
+  if (!m_pExpression->ToJavaScript(js, ReturnType::kInferred))
     return false;
   *js << "))\n";
 
@@ -992,7 +992,7 @@
 
   for (auto& expr : m_pElseIfExpressions) {
     *js << "else ";
-    if (!expr->ToJavaScript(js, ReturnType::kInfered))
+    if (!expr->ToJavaScript(js, ReturnType::kInferred))
       return false;
   }
 
@@ -1027,7 +1027,7 @@
     *js << "pfm_ret = 0;\n";
 
   *js << "while (";
-  if (!m_pCondition->ToJavaScript(js, ReturnType::kInfered))
+  if (!m_pCondition->ToJavaScript(js, ReturnType::kInferred))
     return false;
 
   *js << ")\n";
@@ -1106,20 +1106,20 @@
   *js << "var " << tmpName << " = null;\n";
 
   *js << "for (" << tmpName << " = pfm_rt.get_val(";
-  if (!m_pAssignment->ToJavaScript(js, ReturnType::kInfered))
+  if (!m_pAssignment->ToJavaScript(js, ReturnType::kInferred))
     return false;
   *js << "); ";
 
   *js << tmpName << (m_bDirection ? kLessEqual : kGreaterEqual);
   *js << "pfm_rt.get_val(";
-  if (!m_pAccessor->ToJavaScript(js, ReturnType::kInfered))
+  if (!m_pAccessor->ToJavaScript(js, ReturnType::kInferred))
     return false;
   *js << "); ";
 
   *js << tmpName << (m_bDirection ? kPlusEqual : kMinusEqual);
   if (m_pStep) {
     *js << "pfm_rt.get_val(";
-    if (!m_pStep->ToJavaScript(js, ReturnType::kInfered))
+    if (!m_pStep->ToJavaScript(js, ReturnType::kInferred))
       return false;
     *js << ")";
   } else {
@@ -1167,7 +1167,7 @@
   *js << "var " << tmpName << " = null;\n";
   *js << "var pfm_ary = pfm_rt.concat_obj(";
   for (const auto& expr : m_pAccessors) {
-    if (!expr->ToJavaScript(js, ReturnType::kInfered))
+    if (!expr->ToJavaScript(js, ReturnType::kInferred))
       return false;
     if (expr != m_pAccessors.back())
       *js << ", ";
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.h b/xfa/fxfa/fm2js/cxfa_fmexpression.h
index 13700c2..15e2ca1 100644
--- a/xfa/fxfa/fm2js/cxfa_fmexpression.h
+++ b/xfa/fxfa/fm2js/cxfa_fmexpression.h
@@ -18,17 +18,10 @@
 
 class CFX_WideTextBuf;
 
-enum XFA_FM_AccessorIndex {
-  ACCESSOR_NO_INDEX,
-  ACCESSOR_NO_RELATIVEINDEX,
-  ACCESSOR_POSITIVE_INDEX,
-  ACCESSOR_NEGATIVE_INDEX
-};
-
-enum class ReturnType { kImplied, kInfered };
-
 class CXFA_FMExpression : public cppgc::GarbageCollected<CXFA_FMExpression> {
  public:
+  enum class ReturnType { kImplied, kInferred };
+
   virtual ~CXFA_FMExpression();
   virtual void Trace(cppgc::Visitor* visitor) const;
 
@@ -364,6 +357,13 @@
 
 class CXFA_FMIndexExpression final : public CXFA_FMSimpleExpression {
  public:
+  enum class AccessorIndex : uint8_t {
+    kNoIndex,
+    kNoRelativeIndex,
+    kPositiveIndex,
+    kNegativeIndex
+  };
+
   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
   ~CXFA_FMIndexExpression() override;
 
@@ -371,12 +371,12 @@
   bool ToJavaScript(CFX_WideTextBuf* js, ReturnType type) const override;
 
  private:
-  CXFA_FMIndexExpression(XFA_FM_AccessorIndex accessorIndex,
+  CXFA_FMIndexExpression(AccessorIndex accessorIndex,
                          CXFA_FMSimpleExpression* pIndexExp,
                          bool bIsStarIndex);
 
   cppgc::Member<CXFA_FMSimpleExpression> m_pExp;
-  XFA_FM_AccessorIndex m_accessorIndex;
+  AccessorIndex m_accessorIndex;
   bool m_bIsStarIndex;
 };
 
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression_unittest.cpp
index b7b20c4..8ef3880 100644
--- a/xfa/fxfa/fm2js/cxfa_fmexpression_unittest.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmexpression_unittest.cpp
@@ -34,7 +34,7 @@
       heap()->GetAllocationHandle(), exp, std::move(args), true);
 
   CFX_WideTextBuf js;
-  callExp->ToJavaScript(&js, ReturnType::kInfered);
+  callExp->ToJavaScript(&js, CXFA_FMAssignExpression::ReturnType::kInferred);
 
   // Generate the result javascript string.
   WideString result = L"sign(";
@@ -59,7 +59,8 @@
   CFX_WideTextBuf accumulator;
   auto* exp = cppgc::MakeGarbageCollected<CXFA_FMStringExpression>(
       heap()->GetAllocationHandle(), L"");
-  exp->ToJavaScript(&accumulator, ReturnType::kInfered);
+  exp->ToJavaScript(&accumulator,
+                    CXFA_FMAssignExpression::ReturnType::kInferred);
   EXPECT_EQ(L"", accumulator.AsStringView());
 }
 
@@ -68,7 +69,8 @@
   CFX_WideTextBuf accumulator;
   auto* exp = cppgc::MakeGarbageCollected<CXFA_FMStringExpression>(
       heap()->GetAllocationHandle(), L"a");
-  exp->ToJavaScript(&accumulator, ReturnType::kInfered);
+  exp->ToJavaScript(&accumulator,
+                    CXFA_FMAssignExpression::ReturnType::kInferred);
   EXPECT_EQ(L"a", accumulator.AsStringView());
 }
 
@@ -77,7 +79,8 @@
   CFX_WideTextBuf accumulator;
   auto* exp = cppgc::MakeGarbageCollected<CXFA_FMStringExpression>(
       heap()->GetAllocationHandle(), L".abcd.");
-  exp->ToJavaScript(&accumulator, ReturnType::kInfered);
+  exp->ToJavaScript(&accumulator,
+                    CXFA_FMAssignExpression::ReturnType::kInferred);
   EXPECT_EQ(L"\"abcd\"", accumulator.AsStringView());
 }
 
@@ -87,7 +90,8 @@
   std::vector<WideStringView::UnsignedType> vec(140000, L'A');
   auto* exp = cppgc::MakeGarbageCollected<CXFA_FMStringExpression>(
       heap()->GetAllocationHandle(), WideString(WideStringView(vec)));
-  exp->ToJavaScript(&accumulator, ReturnType::kInfered);
+  exp->ToJavaScript(&accumulator,
+                    CXFA_FMAssignExpression::ReturnType::kInferred);
   EXPECT_EQ(140000u, accumulator.GetLength());
 }
 
@@ -96,7 +100,8 @@
   CFX_WideTextBuf accumulator;
   auto* exp = cppgc::MakeGarbageCollected<CXFA_FMStringExpression>(
       heap()->GetAllocationHandle(), L".Simon says \"\"run\"\".");
-  exp->ToJavaScript(&accumulator, ReturnType::kInfered);
+  exp->ToJavaScript(&accumulator,
+                    CXFA_FMAssignExpression::ReturnType::kInferred);
   EXPECT_EQ(L"\"Simon says \\\"run\\\"\"", accumulator.AsStringView());
 }
 
@@ -106,7 +111,8 @@
 
   auto* expr = cppgc::MakeGarbageCollected<CXFA_FMVarExpression>(
       heap()->GetAllocationHandle(), L"s", nullptr);
-  expr->ToJavaScript(&accumulator, ReturnType::kInfered);
+  expr->ToJavaScript(&accumulator,
+                     CXFA_FMAssignExpression::ReturnType::kInferred);
   EXPECT_STREQ(
       LR"***(var s = "";
 )***",
@@ -121,7 +127,8 @@
       heap()->GetAllocationHandle(), LR"("")");
   auto* expr = cppgc::MakeGarbageCollected<CXFA_FMVarExpression>(
       heap()->GetAllocationHandle(), L"s", init);
-  expr->ToJavaScript(&accumulator, ReturnType::kInfered);
+  expr->ToJavaScript(&accumulator,
+                     CXFA_FMAssignExpression::ReturnType::kInferred);
   EXPECT_STREQ(
       LR"***(var s = "";
 s = pfm_rt.var_filter(s);
@@ -137,7 +144,8 @@
       heap()->GetAllocationHandle(), LR"("foo")");
   auto* expr = cppgc::MakeGarbageCollected<CXFA_FMVarExpression>(
       heap()->GetAllocationHandle(), L"s", init);
-  expr->ToJavaScript(&accumulator, ReturnType::kInfered);
+  expr->ToJavaScript(&accumulator,
+                     CXFA_FMAssignExpression::ReturnType::kInferred);
   EXPECT_STREQ(
       LR"***(var s = "foo";
 s = pfm_rt.var_filter(s);
@@ -153,7 +161,8 @@
       heap()->GetAllocationHandle(), L"112");
   auto* expr = cppgc::MakeGarbageCollected<CXFA_FMVarExpression>(
       heap()->GetAllocationHandle(), L"s", init);
-  expr->ToJavaScript(&accumulator, ReturnType::kInfered);
+  expr->ToJavaScript(&accumulator,
+                     CXFA_FMAssignExpression::ReturnType::kInferred);
   EXPECT_STREQ(
       LR"***(var s = 112;
 s = pfm_rt.var_filter(s);
diff --git a/xfa/fxfa/fm2js/cxfa_fmparser.cpp b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
index dce6721..a3ef873 100644
--- a/xfa/fxfa/fm2js/cxfa_fmparser.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmparser.cpp
@@ -716,13 +716,12 @@
               m_heap->GetAllocationHandle(), expr, TOKdot, std::move(tempStr),
               s);
         } else {
-          CXFA_FMSimpleExpression* s =
-              cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
-                  m_heap->GetAllocationHandle(), ACCESSOR_NO_INDEX, nullptr,
-                  false);
+          auto* subexpr = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
+              m_heap->GetAllocationHandle(),
+              CXFA_FMIndexExpression::AccessorIndex::kNoIndex, nullptr, false);
           expr = cppgc::MakeGarbageCollected<CXFA_FMDotAccessorExpression>(
               m_heap->GetAllocationHandle(), expr, TOKdot, std::move(tempStr),
-              s);
+              subexpr);
           continue;
         }
         break;
@@ -745,13 +744,12 @@
               m_heap->GetAllocationHandle(), expr, TOKdotdot,
               std::move(tempStr), s);
         } else {
-          CXFA_FMSimpleExpression* s =
-              cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
-                  m_heap->GetAllocationHandle(), ACCESSOR_NO_INDEX, nullptr,
-                  false);
+          auto* subexpr = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
+              m_heap->GetAllocationHandle(),
+              CXFA_FMIndexExpression::AccessorIndex::kNoIndex, nullptr, false);
           expr = cppgc::MakeGarbageCollected<CXFA_FMDotDotAccessorExpression>(
               m_heap->GetAllocationHandle(), expr, TOKdotdot,
-              std::move(tempStr), s);
+              std::move(tempStr), subexpr);
           continue;
         }
         break;
@@ -767,11 +765,12 @@
           return nullptr;
 
         if (m_token.m_type != TOKlbracket) {
-          auto* s = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
-              m_heap->GetAllocationHandle(), ACCESSOR_NO_INDEX, nullptr, false);
+          auto* subexpr = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
+              m_heap->GetAllocationHandle(),
+              CXFA_FMIndexExpression::AccessorIndex::kNoIndex, nullptr, false);
           expr = cppgc::MakeGarbageCollected<CXFA_FMDotAccessorExpression>(
               m_heap->GetAllocationHandle(), expr, TOKdotscream,
-              std::move(tempStr), s);
+              std::move(tempStr), subexpr);
           continue;
         }
 
@@ -785,10 +784,11 @@
         break;
       }
       case TOKdotstar: {
-        auto* s = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
-            m_heap->GetAllocationHandle(), ACCESSOR_NO_INDEX, nullptr, false);
+        auto* subexpr = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
+            m_heap->GetAllocationHandle(),
+            CXFA_FMIndexExpression::AccessorIndex::kNoIndex, nullptr, false);
         expr = cppgc::MakeGarbageCollected<CXFA_FMDotAccessorExpression>(
-            m_heap->GetAllocationHandle(), expr, TOKdotstar, L"*", s);
+            m_heap->GetAllocationHandle(), expr, TOKdotstar, L"*", subexpr);
         break;
       }
       default:
@@ -838,8 +838,8 @@
 
   if (m_token.m_type == TOKmul) {
     auto* pExp = cppgc::MakeGarbageCollected<CXFA_FMIndexExpression>(
-        m_heap->GetAllocationHandle(), ACCESSOR_NO_RELATIVEINDEX, nullptr,
-        true);
+        m_heap->GetAllocationHandle(),
+        CXFA_FMIndexExpression::AccessorIndex::kNoRelativeIndex, nullptr, true);
     if (!pExp || !NextToken())
       return nullptr;
 
@@ -850,13 +850,14 @@
     return pExp;
   }
 
-  XFA_FM_AccessorIndex accessorIndex = ACCESSOR_NO_RELATIVEINDEX;
+  CXFA_FMIndexExpression::AccessorIndex accessorIndex =
+      CXFA_FMIndexExpression::AccessorIndex::kNoRelativeIndex;
   if (m_token.m_type == TOKplus) {
-    accessorIndex = ACCESSOR_POSITIVE_INDEX;
+    accessorIndex = CXFA_FMIndexExpression::AccessorIndex::kPositiveIndex;
     if (!NextToken())
       return nullptr;
   } else if (m_token.m_type == TOKminus) {
-    accessorIndex = ACCESSOR_NEGATIVE_INDEX;
+    accessorIndex = CXFA_FMIndexExpression::AccessorIndex::kNegativeIndex;
     if (!NextToken())
       return nullptr;
   }