Simplified initialization of Transformation's action_kind

- Some of the Transformation classes would initialize their Action's
  action_kind using the default (using Transformation constructor
  without an action_kind parameter).
- Others, however, would use that constructor and initialize action_kind
  manually in their constructor, but setting the default value
  (RunTimeBeforeMatchAttemptKind = 1), which was redundant.
- Removed unused Transformation constructor to specify action_kind.
- Converted Action::Kind into an 'enum class' to require using the enum
  constants (instead of integer values, which are difficult to track in
  the codebase and change)
This commit is contained in:
Eduardo Arias
2024-08-19 11:26:56 -07:00
parent 7023c0a8b4
commit 2f5dac5c4c
96 changed files with 131 additions and 237 deletions

View File

@@ -2424,8 +2424,8 @@ namespace yy {
definedPhase = phase->m_phase;
secRuleDefinedPhase = phase->m_secRulesPhase;
delete phase;
} else if (a->action_kind == actions::Action::RunTimeOnlyIfMatchKind ||
a->action_kind == actions::Action::RunTimeBeforeMatchAttemptKind) {
} else if (a->action_kind == actions::Action::Kind::RunTimeOnlyIfMatchKind ||
a->action_kind == actions::Action::Kind::RunTimeBeforeMatchAttemptKind) {
actions::transformations::None *none = dynamic_cast<actions::transformations::None *>(a);
if (none != NULL) {
driver.error(yystack_[2].location, "The transformation none is not suitable to be part of the SecDefaultActions");

View File

@@ -1199,8 +1199,8 @@ expression:
definedPhase = phase->m_phase;
secRuleDefinedPhase = phase->m_secRulesPhase;
delete phase;
} else if (a->action_kind == actions::Action::RunTimeOnlyIfMatchKind ||
a->action_kind == actions::Action::RunTimeBeforeMatchAttemptKind) {
} else if (a->action_kind == actions::Action::Kind::RunTimeOnlyIfMatchKind ||
a->action_kind == actions::Action::Kind::RunTimeBeforeMatchAttemptKind) {
actions::transformations::None *none = dynamic_cast<actions::transformations::None *>(a);
if (none != NULL) {
driver.error(@0, "The transformation none is not suitable to be part of the SecDefaultActions");