Make a lot of one-liner functions inline
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -49,15 +49,15 @@ namespace Porygon::Binder {
|
||||
return _type;
|
||||
};
|
||||
|
||||
const unsigned int GetStartPosition() const {
|
||||
inline const unsigned int GetStartPosition() const {
|
||||
return _start;
|
||||
}
|
||||
|
||||
const unsigned int GetLength() const {
|
||||
inline const unsigned int GetLength() const {
|
||||
return _length;
|
||||
}
|
||||
|
||||
const unsigned int GetEndPosition() const {
|
||||
inline const unsigned int GetEndPosition() const {
|
||||
return _start + _length - 1;
|
||||
}
|
||||
};
|
||||
@@ -68,7 +68,7 @@ namespace Porygon::Binder {
|
||||
make_shared<ScriptType>(
|
||||
TypeClass::Error)) {}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::Bad;
|
||||
}
|
||||
};
|
||||
@@ -81,11 +81,11 @@ namespace Porygon::Binder {
|
||||
_value(value) {
|
||||
}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::LiteralInteger;
|
||||
}
|
||||
|
||||
const long GetValue() const {
|
||||
inline const long GetValue() const {
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
@@ -98,11 +98,11 @@ namespace Porygon::Binder {
|
||||
_value(value) {
|
||||
}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::LiteralFloat;
|
||||
}
|
||||
|
||||
const double GetValue() const {
|
||||
inline const double GetValue() const {
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
@@ -116,11 +116,11 @@ namespace Porygon::Binder {
|
||||
_value(value) {
|
||||
}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::LiteralString;
|
||||
}
|
||||
|
||||
const u16string GetValue() const {
|
||||
inline const u16string GetValue() const {
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
@@ -133,11 +133,11 @@ namespace Porygon::Binder {
|
||||
_value(value) {
|
||||
}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::LiteralBool;
|
||||
}
|
||||
|
||||
const bool GetValue() const {
|
||||
inline const bool GetValue() const {
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
@@ -155,11 +155,11 @@ namespace Porygon::Binder {
|
||||
delete _key;
|
||||
}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::Variable;
|
||||
}
|
||||
|
||||
const BoundVariableKey *GetKey() const {
|
||||
inline const BoundVariableKey *GetKey() const {
|
||||
return _key;
|
||||
}
|
||||
};
|
||||
@@ -183,19 +183,19 @@ namespace Porygon::Binder {
|
||||
delete _right;
|
||||
}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::Binary;
|
||||
}
|
||||
|
||||
const BoundExpression *GetLeft() const {
|
||||
inline const BoundExpression *GetLeft() const {
|
||||
return _left;
|
||||
}
|
||||
|
||||
const BoundExpression *GetRight() const {
|
||||
inline const BoundExpression *GetRight() const {
|
||||
return _right;
|
||||
}
|
||||
|
||||
const BoundBinaryOperation GetOperation() const {
|
||||
inline const BoundBinaryOperation GetOperation() const {
|
||||
return _operation;
|
||||
}
|
||||
};
|
||||
@@ -215,15 +215,15 @@ namespace Porygon::Binder {
|
||||
delete _operand;
|
||||
}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::Unary;
|
||||
}
|
||||
|
||||
const BoundExpression *GetOperand() const {
|
||||
inline const BoundExpression *GetOperand() const {
|
||||
return _operand;
|
||||
}
|
||||
|
||||
const BoundUnaryOperation GetOperation() const {
|
||||
inline const BoundUnaryOperation GetOperation() const {
|
||||
return _operation;
|
||||
}
|
||||
};
|
||||
@@ -243,15 +243,15 @@ namespace Porygon::Binder {
|
||||
delete _indexExpression;
|
||||
}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::Index;
|
||||
}
|
||||
|
||||
const BoundExpression *GetIndexableExpression() const {
|
||||
inline const BoundExpression *GetIndexableExpression() const {
|
||||
return _indexableExpression;
|
||||
}
|
||||
|
||||
const BoundExpression *GetIndexExpression() const {
|
||||
inline const BoundExpression *GetIndexExpression() const {
|
||||
return _indexExpression;
|
||||
}
|
||||
};
|
||||
@@ -270,15 +270,15 @@ namespace Porygon::Binder {
|
||||
delete _indexableExpression;
|
||||
}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::PeriodIndex;
|
||||
}
|
||||
|
||||
const BoundExpression *GetIndexableExpression() const {
|
||||
inline const BoundExpression *GetIndexableExpression() const {
|
||||
return _indexableExpression;
|
||||
}
|
||||
|
||||
const Utilities::HashedString GetIndex() const {
|
||||
inline const Utilities::HashedString GetIndex() const {
|
||||
return _index;
|
||||
}
|
||||
};
|
||||
@@ -297,11 +297,11 @@ namespace Porygon::Binder {
|
||||
}
|
||||
}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::NumericalTable;
|
||||
}
|
||||
|
||||
const vector<const BoundExpression *> *GetExpressions() const {
|
||||
inline const vector<const BoundExpression *> *GetExpressions() const {
|
||||
return &_expressions;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,19 +22,19 @@ namespace Porygon::Binder {
|
||||
}
|
||||
}
|
||||
|
||||
const Porygon::Binder::BoundExpressionKind GetKind() const final {
|
||||
inline const Porygon::Binder::BoundExpressionKind GetKind() const final {
|
||||
return Porygon::Binder::BoundExpressionKind::FunctionCall;
|
||||
}
|
||||
|
||||
const BoundExpression *GetFunctionExpression() const {
|
||||
inline const BoundExpression *GetFunctionExpression() const {
|
||||
return _functionExpression;
|
||||
}
|
||||
|
||||
const vector<BoundExpression *> *GetParameters() const {
|
||||
inline const vector<BoundExpression *> *GetParameters() const {
|
||||
return &_parameters;
|
||||
}
|
||||
|
||||
const Porygon::GenericFunctionOption *GetFunctionOption() const {
|
||||
inline const Porygon::GenericFunctionOption *GetFunctionOption() const {
|
||||
return _option;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,11 +20,11 @@ namespace Porygon::Binder {
|
||||
delete _block;
|
||||
}
|
||||
|
||||
const BoundExpressionKind GetKind() const final {
|
||||
inline const BoundExpressionKind GetKind() const final {
|
||||
return BoundExpressionKind::Table;
|
||||
}
|
||||
|
||||
const BoundBlockStatement *GetBlock() const {
|
||||
inline const BoundBlockStatement *GetBlock() const {
|
||||
return _block;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,19 +21,19 @@ namespace Porygon::Binder {
|
||||
delete _key;
|
||||
}
|
||||
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::FunctionDeclaration;
|
||||
}
|
||||
|
||||
const BoundVariableKey *GetKey() const {
|
||||
inline const BoundVariableKey *GetKey() const {
|
||||
return _key;
|
||||
}
|
||||
|
||||
const std::shared_ptr<BoundBlockStatement> GetBlock() const {
|
||||
inline const std::shared_ptr<BoundBlockStatement> GetBlock() const {
|
||||
return _block;
|
||||
}
|
||||
|
||||
const std::shared_ptr<GenericFunctionScriptType> GetType() const {
|
||||
inline const std::shared_ptr<GenericFunctionScriptType> GetType() const {
|
||||
return _type;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -35,14 +35,14 @@ namespace Porygon::Binder {
|
||||
|
||||
class BoundBadStatement : public BoundStatement {
|
||||
public:
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::Bad;
|
||||
}
|
||||
};
|
||||
|
||||
class BoundBreakStatement : public BoundStatement {
|
||||
public:
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::Break;
|
||||
}
|
||||
};
|
||||
@@ -60,11 +60,11 @@ namespace Porygon::Binder {
|
||||
}
|
||||
}
|
||||
|
||||
const BoundStatementKind GetKind() const override {
|
||||
inline const BoundStatementKind GetKind() const override {
|
||||
return BoundStatementKind::Block;
|
||||
}
|
||||
|
||||
const vector<BoundStatement *> *GetStatements() const {
|
||||
inline const vector<BoundStatement *> *GetStatements() const {
|
||||
return &_statements;
|
||||
}
|
||||
};
|
||||
@@ -77,11 +77,11 @@ namespace Porygon::Binder {
|
||||
_localVariableCount(localVariableCount) {
|
||||
}
|
||||
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::Script;
|
||||
}
|
||||
|
||||
const int GetLocalVariableCount() const {
|
||||
inline const int GetLocalVariableCount() const {
|
||||
return _localVariableCount;
|
||||
}
|
||||
};
|
||||
@@ -98,11 +98,11 @@ namespace Porygon::Binder {
|
||||
delete _expression;
|
||||
}
|
||||
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::Expression;
|
||||
}
|
||||
|
||||
const BoundExpression *GetExpression() const {
|
||||
inline const BoundExpression *GetExpression() const {
|
||||
return _expression;
|
||||
}
|
||||
};
|
||||
@@ -120,15 +120,15 @@ namespace Porygon::Binder {
|
||||
delete _expression;
|
||||
}
|
||||
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::Assignment;
|
||||
}
|
||||
|
||||
const BoundVariableKey *GetKey() const {
|
||||
inline const BoundVariableKey *GetKey() const {
|
||||
return _key;
|
||||
}
|
||||
|
||||
const BoundExpression *GetExpression() const {
|
||||
inline const BoundExpression *GetExpression() const {
|
||||
return _expression;
|
||||
}
|
||||
};
|
||||
@@ -146,15 +146,15 @@ namespace Porygon::Binder {
|
||||
delete _valueExpression;
|
||||
}
|
||||
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::IndexAssignment;
|
||||
}
|
||||
|
||||
const BoundExpression *GetIndexExpression() const {
|
||||
inline const BoundExpression *GetIndexExpression() const {
|
||||
return _indexExpression;
|
||||
}
|
||||
|
||||
const BoundExpression *GetValueExpression() const {
|
||||
inline const BoundExpression *GetValueExpression() const {
|
||||
return _valueExpression;
|
||||
}
|
||||
};
|
||||
@@ -170,11 +170,11 @@ namespace Porygon::Binder {
|
||||
delete _expression;
|
||||
}
|
||||
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::Return;
|
||||
}
|
||||
|
||||
const BoundExpression *GetExpression() const {
|
||||
inline const BoundExpression *GetExpression() const {
|
||||
return _expression;
|
||||
}
|
||||
};
|
||||
@@ -194,19 +194,19 @@ namespace Porygon::Binder {
|
||||
delete _elseStatement;
|
||||
}
|
||||
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::Conditional;
|
||||
}
|
||||
|
||||
const BoundExpression *GetCondition() const {
|
||||
inline const BoundExpression *GetCondition() const {
|
||||
return _condition;
|
||||
}
|
||||
|
||||
const BoundStatement *GetBlock() const {
|
||||
inline const BoundStatement *GetBlock() const {
|
||||
return _block;
|
||||
}
|
||||
|
||||
const BoundStatement *GetElseStatement() const {
|
||||
inline const BoundStatement *GetElseStatement() const {
|
||||
return _elseStatement;
|
||||
}
|
||||
};
|
||||
@@ -233,27 +233,27 @@ namespace Porygon::Binder {
|
||||
delete _block;
|
||||
}
|
||||
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::NumericalFor;
|
||||
}
|
||||
|
||||
const BoundVariableKey* GetIdentifier() const{
|
||||
inline const BoundVariableKey* GetIdentifier() const{
|
||||
return _identifier;
|
||||
}
|
||||
|
||||
const BoundExpression* GetStart() const{
|
||||
inline const BoundExpression* GetStart() const{
|
||||
return _start;
|
||||
}
|
||||
|
||||
const BoundExpression* GetEnd() const{
|
||||
inline const BoundExpression* GetEnd() const{
|
||||
return _end;
|
||||
}
|
||||
|
||||
const BoundExpression* GetStep() const{
|
||||
inline const BoundExpression* GetStep() const{
|
||||
return _step;
|
||||
}
|
||||
|
||||
const BoundStatement* GetBlock() const{
|
||||
inline const BoundStatement* GetBlock() const{
|
||||
return _block;
|
||||
}
|
||||
};
|
||||
@@ -278,23 +278,23 @@ namespace Porygon::Binder {
|
||||
delete _block;
|
||||
}
|
||||
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::GenericFor;
|
||||
}
|
||||
|
||||
const BoundVariableKey* GetKeyIdentifier() const{
|
||||
inline const BoundVariableKey* GetKeyIdentifier() const{
|
||||
return _keyIdentifier;
|
||||
}
|
||||
|
||||
const BoundVariableKey* GetValueIdentifier() const{
|
||||
inline const BoundVariableKey* GetValueIdentifier() const{
|
||||
return _valueIdentifier;
|
||||
}
|
||||
|
||||
const BoundExpression* GetIterator() const{
|
||||
inline const BoundExpression* GetIterator() const{
|
||||
return _iterator;
|
||||
}
|
||||
|
||||
const BoundStatement* GetBlock() const{
|
||||
inline const BoundStatement* GetBlock() const{
|
||||
return _block;
|
||||
}
|
||||
};
|
||||
@@ -312,15 +312,15 @@ namespace Porygon::Binder {
|
||||
delete _block;
|
||||
}
|
||||
|
||||
const BoundStatementKind GetKind() const final {
|
||||
inline const BoundStatementKind GetKind() const final {
|
||||
return BoundStatementKind::While;
|
||||
}
|
||||
|
||||
const BoundExpression* GetCondition() const{
|
||||
inline const BoundExpression* GetCondition() const{
|
||||
return _condition;
|
||||
}
|
||||
|
||||
const BoundStatement* GetBlock() const{
|
||||
inline const BoundStatement* GetBlock() const{
|
||||
return _block;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -36,11 +36,11 @@ namespace Porygon::Binder {
|
||||
|
||||
VariableAssignment AssignVariable(const Utilities::HashedString& identifier, const std::shared_ptr<ScriptType> &type);
|
||||
|
||||
size_t GetLocalVariableCount() {
|
||||
inline size_t GetLocalVariableCount() {
|
||||
return _localScope.size();
|
||||
}
|
||||
|
||||
int GetCurrentScope() {
|
||||
inline int GetCurrentScope() {
|
||||
return _currentScope;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace Porygon::Binder {
|
||||
class BoundVariable {
|
||||
std::shared_ptr<ScriptType> _type;
|
||||
public:
|
||||
explicit BoundVariable(std::shared_ptr<ScriptType> type) : _type(std::move(type)) {
|
||||
inline explicit BoundVariable(std::shared_ptr<ScriptType> type) : _type(std::move(type)) {
|
||||
}
|
||||
|
||||
std::shared_ptr<ScriptType> GetType() {
|
||||
inline std::shared_ptr<ScriptType> GetType() {
|
||||
return _type;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,19 +26,19 @@ namespace Porygon::Binder {
|
||||
_hash(KnuthsHash(id.GetHash(), scope)) {}
|
||||
|
||||
|
||||
const Utilities::HashedString GetIdentifier() const {
|
||||
inline const Utilities::HashedString GetIdentifier() const {
|
||||
return _identifier;
|
||||
}
|
||||
|
||||
const unsigned int GetScopeId() const {
|
||||
inline const unsigned int GetScopeId() const {
|
||||
return _scopeId;
|
||||
}
|
||||
|
||||
const bool IsCreation() const {
|
||||
inline const bool IsCreation() const {
|
||||
return _isCreation;
|
||||
}
|
||||
|
||||
const uint64_t GetHash() const {
|
||||
inline const uint64_t GetHash() const {
|
||||
return _hash;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,11 +20,11 @@ namespace Porygon::Binder {
|
||||
_key = key;
|
||||
}
|
||||
|
||||
VariableAssignmentResult GetResult() {
|
||||
inline VariableAssignmentResult GetResult() {
|
||||
return _result;
|
||||
}
|
||||
|
||||
BoundVariableKey *GetKey() {
|
||||
inline BoundVariableKey *GetKey() {
|
||||
return _key;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user