diff --git a/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.cpp b/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.cpp index bda9bd69..7788d757 100644 --- a/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.cpp +++ b/src/ObjLoading/Game/IW4/Menu/MenuConverterIW4.cpp @@ -110,7 +110,7 @@ namespace IW4 if (!dvarNameExpression->IsStatic()) return false; - const auto staticDvarNameExpressionValue = dvarNameExpression->Evaluate(); + const auto staticDvarNameExpressionValue = dvarNameExpression->EvaluateStatic(); if (staticDvarNameExpressionValue.m_type != SimpleExpressionValue::Type::STRING) return false; @@ -353,7 +353,7 @@ namespace IW4 { if (!m_disable_optimizations && expression->IsStatic()) { - const auto expressionStaticValue = expression->Evaluate(); + const auto expressionStaticValue = expression->EvaluateStatic(); ConvertExpressionEntryExpressionValue(entries, &expressionStaticValue); } else if (const auto* expressionValue = dynamic_cast(expression)) @@ -419,7 +419,7 @@ namespace IW4 if (expression->IsStatic()) { - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); switch (value.m_type) { case SimpleExpressionValue::Type::DOUBLE: @@ -447,7 +447,7 @@ namespace IW4 if (expression->IsStatic()) { - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); switch (value.m_type) { case SimpleExpressionValue::Type::STRING: @@ -474,7 +474,7 @@ namespace IW4 if (expression->IsStatic()) { - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); switch (value.m_type) { case SimpleExpressionValue::Type::STRING: @@ -507,7 +507,7 @@ namespace IW4 else { isStatic = expression->IsStatic(); - isTruthy = isStatic && expression->Evaluate().IsTruthy(); + isTruthy = isStatic && expression->EvaluateStatic().IsTruthy(); } if (isStatic) @@ -580,7 +580,7 @@ namespace IW4 if(!m_disable_optimizations && condition->m_condition->IsStatic()) { - const auto staticValueIsTruthy = condition->m_condition->Evaluate().IsTruthy(); + const auto staticValueIsTruthy = condition->m_condition->EvaluateStatic().IsTruthy(); if(staticValueIsTruthy) ConvertEventHandlerElements(elements, condition->m_condition_elements.get(), menu, item); @@ -725,7 +725,7 @@ namespace IW4 if (expressionIsStatic) { - const auto evaluatedValue = expression->Evaluate(); + const auto evaluatedValue = expression->EvaluateStatic(); if (evaluatedValue.m_type == SimpleExpressionValue::Type::INT) { diff --git a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.cpp b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.cpp index 487d3688..3b235a2b 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.cpp +++ b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.cpp @@ -37,7 +37,12 @@ bool CommonExpressionBaseFunctionCall::IsStatic() const return false; } -SimpleExpressionValue CommonExpressionBaseFunctionCall::Evaluate() const +SimpleExpressionValue CommonExpressionBaseFunctionCall::EvaluateStatic() const +{ + return SimpleExpressionValue(0); +} + +SimpleExpressionValue CommonExpressionBaseFunctionCall::EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const { return SimpleExpressionValue(0); } diff --git a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.h b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.h index e1626bc2..d5a4e356 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.h +++ b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionBaseFunctionCall.h @@ -16,6 +16,7 @@ namespace menu _NODISCARD bool Equals(const ISimpleExpression* other) const override; _NODISCARD bool IsStatic() const override; - _NODISCARD SimpleExpressionValue Evaluate() const override; + _NODISCARD SimpleExpressionValue EvaluateStatic() const override; + _NODISCARD SimpleExpressionValue EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const override; }; } diff --git a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.cpp b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.cpp index af702165..43007218 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.cpp +++ b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.cpp @@ -18,7 +18,12 @@ bool CommonExpressionCustomFunctionCall::IsStatic() const return false; } -SimpleExpressionValue CommonExpressionCustomFunctionCall::Evaluate() const +SimpleExpressionValue CommonExpressionCustomFunctionCall::EvaluateStatic() const +{ + return SimpleExpressionValue(0); +} + +SimpleExpressionValue CommonExpressionCustomFunctionCall::EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const { return SimpleExpressionValue(0); } diff --git a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.h b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.h index 7536d96a..98cabc23 100644 --- a/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.h +++ b/src/ObjLoading/Parsing/Menu/Domain/Expression/CommonExpressionCustomFunctionCall.h @@ -13,6 +13,7 @@ namespace menu _NODISCARD bool Equals(const ISimpleExpression* other) const override; _NODISCARD bool IsStatic() const override; - _NODISCARD SimpleExpressionValue Evaluate() const override; + _NODISCARD SimpleExpressionValue EvaluateStatic() const override; + _NODISCARD SimpleExpressionValue EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const override; }; } diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp index 6fc242f8..b857c6f4 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp @@ -120,7 +120,7 @@ int MenuMatcherFactory::TokenIntExpressionValue(MenuFileParserState* state, Sequ if (!expression || !expression->IsStatic()) throw ParsingException(result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), "Not a valid static expression"); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); if (value.m_type != SimpleExpressionValue::Type::INT) throw ParsingException(result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), "Expression MUST be int type"); @@ -150,7 +150,7 @@ double MenuMatcherFactory::TokenNumericExpressionValue(MenuFileParserState* stat if (!expression || !expression->IsStatic()) throw ParsingException(result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), "Not a valid static expression"); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); if (value.m_type == SimpleExpressionValue::Type::INT) return value.m_int_value; diff --git a/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp index 0f5c0d05..d4fa456b 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp @@ -573,7 +573,7 @@ namespace menu::event_handler_set_scope_sequences static void EmitStaticSetLocalVar(MenuFileParserState* state, const TokenPos& pos, const SetLocalVarType type, const std::string& varName, std::unique_ptr expression) { state->m_current_script << "\"" << ScriptKeywordForType(type) << "\" \"" << varName << "\" \""; - const auto staticValue = expression->Evaluate(); + const auto staticValue = expression->EvaluateStatic(); CheckStaticValueType(pos, type, staticValue); EmitStaticValue(state, staticValue); state->m_current_script << "\" ; "; diff --git a/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp b/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp index 8eaf8bb6..a4764b20 100644 --- a/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp +++ b/src/Parser/Parsing/Impl/DefinesStreamProxy.cpp @@ -327,7 +327,7 @@ bool DefinesStreamProxy::MatchIfDirective(const ParserLine& line, const unsigned if (!expression) throw ParsingException(CreatePos(line, currentPos), "Failed to parse if expression"); - m_modes.push(expression->Evaluate().IsTruthy() ? BlockMode::IN_BLOCK : BlockMode::NOT_IN_BLOCK); + m_modes.push(expression->EvaluateStatic().IsTruthy() ? BlockMode::IN_BLOCK : BlockMode::NOT_IN_BLOCK); return true; } @@ -369,7 +369,7 @@ bool DefinesStreamProxy::MatchElIfDirective(const ParserLine& line, const unsign if (!expression) throw ParsingException(CreatePos(line, currentPos), "Failed to parse elif expression"); - m_modes.top() = expression->Evaluate().IsTruthy() ? BlockMode::IN_BLOCK : BlockMode::NOT_IN_BLOCK; + m_modes.top() = expression->EvaluateStatic().IsTruthy() ? BlockMode::IN_BLOCK : BlockMode::NOT_IN_BLOCK; return true; } diff --git a/src/Parser/Parsing/Simple/Expression/ISimpleExpression.h b/src/Parser/Parsing/Simple/Expression/ISimpleExpression.h index f21e7725..18342614 100644 --- a/src/Parser/Parsing/Simple/Expression/ISimpleExpression.h +++ b/src/Parser/Parsing/Simple/Expression/ISimpleExpression.h @@ -1,8 +1,24 @@ #pragma once +#include + #include "Utils/ClassUtils.h" class SimpleExpressionValue; +class ISimpleExpressionScopeValues +{ +protected: + ISimpleExpressionScopeValues() = default; +public: + virtual ~ISimpleExpressionScopeValues() = default; + ISimpleExpressionScopeValues(const ISimpleExpressionScopeValues& other) = default; + ISimpleExpressionScopeValues(ISimpleExpressionScopeValues&& other) noexcept = default; + ISimpleExpressionScopeValues& operator=(const ISimpleExpressionScopeValues& other) = default; + ISimpleExpressionScopeValues& operator=(ISimpleExpressionScopeValues&& other) noexcept = default; + + _NODISCARD virtual SimpleExpressionValue ValueByName(const std::string& name) const = 0; +}; + class ISimpleExpression { protected: @@ -16,7 +32,8 @@ public: _NODISCARD virtual bool Equals(const ISimpleExpression* other) const = 0; _NODISCARD virtual bool IsStatic() const = 0; - _NODISCARD virtual SimpleExpressionValue Evaluate() const = 0; + _NODISCARD virtual SimpleExpressionValue EvaluateStatic() const = 0; + _NODISCARD virtual SimpleExpressionValue EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const = 0; }; // Include SimpleExpressionValue after definition to avoid "base class not defined" diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp index a9787688..42e44b87 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp @@ -460,7 +460,12 @@ bool SimpleExpressionBinaryOperation::IsStatic() const return m_operand1->IsStatic() && m_operand2->IsStatic(); } -SimpleExpressionValue SimpleExpressionBinaryOperation::Evaluate() const +SimpleExpressionValue SimpleExpressionBinaryOperation::EvaluateStatic() const { - return m_operation_type->m_evaluation_function(m_operand1->Evaluate(), m_operand2->Evaluate()); + return m_operation_type->m_evaluation_function(m_operand1->EvaluateStatic(), m_operand2->EvaluateStatic()); +} + +SimpleExpressionValue SimpleExpressionBinaryOperation::EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const +{ + return m_operation_type->m_evaluation_function(m_operand1->EvaluateNonStatic(scopeValues), m_operand2->EvaluateNonStatic(scopeValues)); } diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.h b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.h index f1a907bd..5d276ccd 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.h +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.h @@ -95,5 +95,6 @@ public: _NODISCARD bool Equals(const ISimpleExpression* other) const override; _NODISCARD bool IsStatic() const override; - _NODISCARD SimpleExpressionValue Evaluate() const override; + _NODISCARD SimpleExpressionValue EvaluateStatic() const override; + _NODISCARD SimpleExpressionValue EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const override; }; diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.cpp index 13dc6acf..40763be3 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.cpp @@ -26,7 +26,14 @@ bool SimpleExpressionConditionalOperator::IsStatic() const return m_condition->IsStatic() && m_true_value->IsStatic() && m_false_value->IsStatic(); } -SimpleExpressionValue SimpleExpressionConditionalOperator::Evaluate() const +SimpleExpressionValue SimpleExpressionConditionalOperator::EvaluateStatic() const { - return m_condition->Evaluate().IsTruthy() ? m_true_value->Evaluate() : m_false_value->Evaluate(); + return m_condition->EvaluateStatic().IsTruthy() ? m_true_value->EvaluateStatic() : m_false_value->EvaluateStatic(); +} + +SimpleExpressionValue SimpleExpressionConditionalOperator::EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const +{ + return m_condition->EvaluateNonStatic(scopeValues).IsTruthy() + ? m_true_value->EvaluateNonStatic(scopeValues) + : m_false_value->EvaluateNonStatic(scopeValues); } diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.h b/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.h index b24e5ec7..bdbf47ba 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.h +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionConditionalOperator.h @@ -10,7 +10,8 @@ public: _NODISCARD bool Equals(const ISimpleExpression* other) const override; _NODISCARD bool IsStatic() const override; - _NODISCARD SimpleExpressionValue Evaluate() const override; + _NODISCARD SimpleExpressionValue EvaluateStatic() const override; + _NODISCARD SimpleExpressionValue EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const override; SimpleExpressionConditionalOperator(); SimpleExpressionConditionalOperator(std::unique_ptr condition, std::unique_ptr trueExpression, std::unique_ptr falseExpression); diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionScopeValue.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionScopeValue.cpp new file mode 100644 index 00000000..26682e95 --- /dev/null +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionScopeValue.cpp @@ -0,0 +1,28 @@ +#include "SimpleExpressionScopeValue.h" + +SimpleExpressionScopeValue::SimpleExpressionScopeValue(std::string valueName) + : m_value_name(std::move(valueName)) +{ +} + +bool SimpleExpressionScopeValue::Equals(const ISimpleExpression* other) const +{ + const auto* otherScopeValue = dynamic_cast(other); + + return otherScopeValue && otherScopeValue->m_value_name == m_value_name; +} + +bool SimpleExpressionScopeValue::IsStatic() const +{ + return false; +} + +SimpleExpressionValue SimpleExpressionScopeValue::EvaluateStatic() const +{ + return SimpleExpressionValue(0); +} + +SimpleExpressionValue SimpleExpressionScopeValue::EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const +{ + return scopeValues->ValueByName(m_value_name); +} diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionScopeValue.h b/src/Parser/Parsing/Simple/Expression/SimpleExpressionScopeValue.h new file mode 100644 index 00000000..b6f73976 --- /dev/null +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionScopeValue.h @@ -0,0 +1,19 @@ +#pragma once + +#include + +#include "ISimpleExpression.h" +#include "SimpleExpressionValue.h" + +class SimpleExpressionScopeValue final : public ISimpleExpression +{ +public: + std::string m_value_name; + + explicit SimpleExpressionScopeValue(std::string valueName); + + _NODISCARD bool Equals(const ISimpleExpression* other) const override; + _NODISCARD bool IsStatic() const override; + _NODISCARD SimpleExpressionValue EvaluateStatic() const override; + _NODISCARD SimpleExpressionValue EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const override; +}; diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.cpp index 90c38c63..74d5c528 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.cpp @@ -78,7 +78,12 @@ bool SimpleExpressionUnaryOperation::IsStatic() const return m_operand->IsStatic(); } -SimpleExpressionValue SimpleExpressionUnaryOperation::Evaluate() const +SimpleExpressionValue SimpleExpressionUnaryOperation::EvaluateStatic() const { - return m_operation_type->m_evaluation_function(m_operand->Evaluate()); + return m_operation_type->m_evaluation_function(m_operand->EvaluateStatic()); +} + +SimpleExpressionValue SimpleExpressionUnaryOperation::EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const +{ + return m_operation_type->m_evaluation_function(m_operand->EvaluateNonStatic(scopeValues)); } diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.h b/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.h index 90ba7763..e8aef4a7 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.h +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionUnaryOperation.h @@ -48,5 +48,6 @@ public: _NODISCARD bool Equals(const ISimpleExpression* other) const override; _NODISCARD bool IsStatic() const override; - _NODISCARD SimpleExpressionValue Evaluate() const override; + _NODISCARD SimpleExpressionValue EvaluateStatic() const override; + _NODISCARD SimpleExpressionValue EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const override; }; diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.cpp index 7099e724..0059b191 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.cpp @@ -46,7 +46,12 @@ bool SimpleExpressionValue::IsStatic() const return true; } -SimpleExpressionValue SimpleExpressionValue::Evaluate() const +SimpleExpressionValue SimpleExpressionValue::EvaluateStatic() const +{ + return *this; +} + +SimpleExpressionValue SimpleExpressionValue::EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const { return *this; } diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.h b/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.h index 097c6ef8..0a45cb24 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.h +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionValue.h @@ -31,6 +31,7 @@ public: _NODISCARD bool Equals(const ISimpleExpression* other) const override; _NODISCARD bool IsStatic() const override; - _NODISCARD SimpleExpressionValue Evaluate() const override; + _NODISCARD SimpleExpressionValue EvaluateStatic() const override; + _NODISCARD SimpleExpressionValue EvaluateNonStatic(ISimpleExpressionScopeValues* scopeValues) const override; _NODISCARD bool IsTruthy() const; }; diff --git a/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp b/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp index 28d50bd4..4e1dab43 100644 --- a/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp +++ b/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp @@ -1047,7 +1047,7 @@ namespace test::parsing::menu::sequence::event_handler_set REQUIRE(conditionElement->m_condition != nullptr); REQUIRE(conditionElement->m_condition->IsStatic()); - const auto staticValue = conditionElement->m_condition->Evaluate(); + const auto staticValue = conditionElement->m_condition->EvaluateStatic(); REQUIRE(staticValue.m_type == SimpleExpressionValue::Type::INT); REQUIRE(staticValue.m_int_value == 1337); @@ -1140,7 +1140,7 @@ namespace test::parsing::menu::sequence::event_handler_set REQUIRE(conditionElement->m_condition != nullptr); REQUIRE(conditionElement->m_condition->IsStatic()); - const auto staticValue = conditionElement->m_condition->Evaluate(); + const auto staticValue = conditionElement->m_condition->EvaluateStatic(); REQUIRE(staticValue.m_type == SimpleExpressionValue::Type::INT); REQUIRE(staticValue.m_int_value == 1337); diff --git a/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp b/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp index a7fde18b..c7dfada4 100644 --- a/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp +++ b/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp @@ -156,7 +156,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1337); } @@ -180,7 +180,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 420); } @@ -204,7 +204,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 420); } @@ -228,7 +228,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1337); } @@ -252,7 +252,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 420); } @@ -276,7 +276,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 0x2AAAAAA0); } @@ -300,7 +300,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 7); } @@ -324,7 +324,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 420); } @@ -348,7 +348,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1337); } @@ -372,7 +372,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1); } @@ -396,7 +396,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1); } @@ -420,7 +420,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1); } @@ -444,7 +444,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1); } @@ -468,7 +468,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1); } @@ -492,7 +492,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 0); } @@ -516,7 +516,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 420); } @@ -540,7 +540,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1337); } @@ -568,7 +568,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 420); } @@ -596,7 +596,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 420); } @@ -622,7 +622,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 420); } @@ -648,7 +648,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1337); } @@ -678,7 +678,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 421); } @@ -708,7 +708,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1338); } @@ -738,7 +738,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 420); } @@ -768,7 +768,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 420); } @@ -798,7 +798,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1337); } @@ -817,7 +817,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 1); } @@ -834,7 +834,7 @@ namespace test::parsing::simple::expression const auto& expression = helper.m_state->m_expression; REQUIRE(expression->IsStatic()); - const auto value = expression->Evaluate(); + const auto value = expression->EvaluateStatic(); REQUIRE(value.m_type == SimpleExpressionValue::Type::INT); REQUIRE(value.m_int_value == 11); }