Fixed memory issue when assigning new method options
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
ccc6e297f2
commit
82c82ae93d
|
@ -25,15 +25,15 @@ namespace Porygon::Evaluation {
|
|||
|
||||
public:
|
||||
EvaluationScriptFunctionOption(shared_ptr<const BoundBlockStatement> innerBlock, shared_ptr<EvaluationScope> scope)
|
||||
: _innerBlock(std::move(innerBlock)), _scope(std::move(scope)) {
|
||||
: GenericFunctionOption(), _innerBlock(std::move(innerBlock)), _scope(std::move(scope)) {
|
||||
}
|
||||
~EvaluationScriptFunctionOption() final = default;
|
||||
~EvaluationScriptFunctionOption() final{};
|
||||
|
||||
inline std::shared_ptr<const BoundBlockStatement> GetInnerBlock() const {
|
||||
[[nodiscard]] inline std::shared_ptr<const BoundBlockStatement> GetInnerBlock() const {
|
||||
return _innerBlock;
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<EvaluationScope> &GetScope() const {
|
||||
[[nodiscard]] inline const std::shared_ptr<EvaluationScope> &GetScope() const {
|
||||
return _scope;
|
||||
}
|
||||
};
|
||||
|
@ -50,7 +50,8 @@ namespace Porygon::Evaluation {
|
|||
public:
|
||||
GenericFunctionEvalValue(shared_ptr<const GenericFunctionScriptType> type, size_t hash)
|
||||
: _type(move(type)),
|
||||
_hash(hash), _options(make_shared<vector<shared_ptr<GenericFunctionOption>>>()){
|
||||
_hash(hash),
|
||||
_options(make_shared<vector<shared_ptr<GenericFunctionOption>>>()){
|
||||
}
|
||||
|
||||
GenericFunctionEvalValue(const GenericFunctionEvalValue& _) = delete;
|
||||
|
|
|
@ -108,9 +108,9 @@ namespace Porygon::Evaluation {
|
|||
auto value = EvalValuePointer(p);
|
||||
this->_evaluationScope->CreateVariable(key, value);
|
||||
} else {
|
||||
auto var = (GenericFunctionEvalValue*)this -> _evaluationScope ->GetVariable(key).Get();
|
||||
auto var = (GenericFunctionEvalValue*)this -> _evaluationScope ->GetVariable(key).Take();
|
||||
var->RegisterOption(option);
|
||||
//this->_evaluationScope->SetVariable(key, var);
|
||||
delete var;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue