mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 15:29:48 -10:00
This introduces action definitions which can then be instantiated to form actual actions with expressions as their parameters.
32 lines
762 B
C++
32 lines
762 B
C++
|
|
#include "AbstractExpression.h"
|
|
|
|
namespace actions {
|
|
namespace expression {
|
|
namespace nodes {
|
|
|
|
AbstractExpression::AbstractExpression(antlr4::Token* token) : m_token(token) {}
|
|
AbstractExpression::~AbstractExpression() = default;
|
|
|
|
antlr4::Token* AbstractExpression::getToken() const
|
|
{
|
|
return m_token;
|
|
}
|
|
ValueType AbstractExpression::getExpressionType() const
|
|
{
|
|
// Since expressions are immutable, caching this will be more efficient
|
|
if (m_cachedType == ValueType::Invalid) {
|
|
m_cachedType = determineReturnType();
|
|
}
|
|
return m_cachedType;
|
|
}
|
|
void AbstractExpression::validationDone()
|
|
{
|
|
// This pointer will become invalid after this so reset it now to avoid issues
|
|
m_token = nullptr;
|
|
}
|
|
|
|
} // namespace nodes
|
|
} // namespace expression
|
|
} // namespace actions
|