Added namespaces to most classes, general cleanup
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:
@@ -11,63 +11,65 @@
|
||||
#include "../Evaluator.hpp"
|
||||
#include "../EvaluationScope/EvaluationScope.hpp"
|
||||
|
||||
namespace Porygon::Evaluation {
|
||||
class ScriptFunctionEvalValue : public EvalValue {
|
||||
const std::shared_ptr<BoundBlockStatement> _innerBlock;
|
||||
const std::shared_ptr<FunctionScriptType> _type;
|
||||
const std::shared_ptr<EvaluationScope> _scope;
|
||||
const std::size_t _hash;
|
||||
|
||||
class ScriptFunctionEvalValue : public EvalValue{
|
||||
const std::shared_ptr<BoundBlockStatement> _innerBlock;
|
||||
const std::shared_ptr<FunctionScriptType> _type;
|
||||
const std::shared_ptr<EvaluationScope> _scope;
|
||||
const std::size_t _hash;
|
||||
explicit ScriptFunctionEvalValue(std::shared_ptr<BoundBlockStatement> innerBlock, std::shared_ptr<EvaluationScope> scope,
|
||||
std::shared_ptr<FunctionScriptType> type, size_t hash)
|
||||
: _type(std::move(type)),
|
||||
_innerBlock(std::move(innerBlock)),
|
||||
_scope(std::move(scope)),
|
||||
_hash(hash)
|
||||
{
|
||||
}
|
||||
explicit ScriptFunctionEvalValue(std::shared_ptr<BoundBlockStatement> innerBlock,
|
||||
std::shared_ptr<EvaluationScope> scope,
|
||||
std::shared_ptr<FunctionScriptType> type, size_t hash)
|
||||
: _type(std::move(type)),
|
||||
_innerBlock(std::move(innerBlock)),
|
||||
_scope(std::move(scope)),
|
||||
_hash(hash) {
|
||||
}
|
||||
|
||||
public:
|
||||
explicit ScriptFunctionEvalValue(std::shared_ptr<BoundBlockStatement> innerBlock, std::shared_ptr<EvaluationScope> scope,
|
||||
std::shared_ptr<FunctionScriptType> type)
|
||||
: _type(std::move(type)),
|
||||
_innerBlock(std::move(innerBlock)),
|
||||
_scope(std::move(scope)),
|
||||
_hash(rand())
|
||||
{
|
||||
}
|
||||
public:
|
||||
explicit ScriptFunctionEvalValue(std::shared_ptr<BoundBlockStatement> innerBlock,
|
||||
std::shared_ptr<EvaluationScope> scope,
|
||||
std::shared_ptr<FunctionScriptType> type)
|
||||
: _type(std::move(type)),
|
||||
_innerBlock(std::move(innerBlock)),
|
||||
_scope(std::move(scope)),
|
||||
_hash(rand()) {
|
||||
}
|
||||
|
||||
const std::shared_ptr<ScriptType> GetType() const{
|
||||
return _type;
|
||||
}
|
||||
const std::shared_ptr<ScriptType> GetType() const {
|
||||
return _type;
|
||||
}
|
||||
|
||||
const TypeClass GetTypeClass() const final{
|
||||
return TypeClass ::Function;
|
||||
}
|
||||
const TypeClass GetTypeClass() const final {
|
||||
return TypeClass::Function;
|
||||
}
|
||||
|
||||
const shared_ptr<EvalValue> Clone() const final{
|
||||
// We don't run make_shared here as it can't call private constructors
|
||||
return shared_ptr<ScriptFunctionEvalValue>(new ScriptFunctionEvalValue(_innerBlock, _scope, _type, _hash));
|
||||
}
|
||||
const shared_ptr<EvalValue> Clone() const final {
|
||||
// We don't run make_shared here as it can't call private constructors
|
||||
return shared_ptr<ScriptFunctionEvalValue>(new ScriptFunctionEvalValue(_innerBlock, _scope, _type, _hash));
|
||||
}
|
||||
|
||||
|
||||
const bool operator ==(EvalValue* b) const final{
|
||||
if (b->GetTypeClass() != TypeClass::Function)
|
||||
return false;
|
||||
return this->_hash == ((ScriptFunctionEvalValue*)b)->_hash;
|
||||
const bool operator==(EvalValue *b) const final {
|
||||
if (b->GetTypeClass() != TypeClass::Function)
|
||||
return false;
|
||||
return this->_hash == ((ScriptFunctionEvalValue *) b)->_hash;
|
||||
};
|
||||
|
||||
const std::shared_ptr<BoundBlockStatement> &GetInnerBlock() const {
|
||||
return _innerBlock;
|
||||
}
|
||||
|
||||
const std::size_t GetHashCode() const final {
|
||||
return _hash;
|
||||
}
|
||||
|
||||
const std::shared_ptr<EvaluationScope> &GetScope() const {
|
||||
return _scope;
|
||||
}
|
||||
};
|
||||
|
||||
const std::shared_ptr<BoundBlockStatement>& GetInnerBlock() const{
|
||||
return _innerBlock;
|
||||
}
|
||||
|
||||
const std::size_t GetHashCode() const final{
|
||||
return _hash;
|
||||
}
|
||||
|
||||
const std::shared_ptr<EvaluationScope>& GetScope() const{
|
||||
return _scope;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //PORYGONLANG_SCRIPTFUNCTIONEVALVALUE_HPP
|
||||
|
||||
Reference in New Issue
Block a user