Fix issue when deleting script with no evalValue result
This commit is contained in:
parent
fe2007b095
commit
f1fbf7044b
|
@ -22,6 +22,9 @@ void Evaluator::EvaluateBlockStatement(BoundBlockStatement* statement) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Evaluator::EvaluateExpressionStatement(BoundExpressionStatement *statement) {
|
void Evaluator::EvaluateExpressionStatement(BoundExpressionStatement *statement) {
|
||||||
|
// Delete previously saved value.
|
||||||
|
delete this->_scriptData->_lastValue;
|
||||||
|
// Save new value
|
||||||
this->_scriptData->_lastValue = this -> EvaluateExpression(statement->GetExpression());
|
this->_scriptData->_lastValue = this -> EvaluateExpression(statement->GetExpression());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ class Evaluator {
|
||||||
public:
|
public:
|
||||||
Evaluator(Script* script){
|
Evaluator(Script* script){
|
||||||
_scriptData = script;
|
_scriptData = script;
|
||||||
|
_result = nullptr;
|
||||||
}
|
}
|
||||||
void Evaluate(BoundScriptStatement* statement);
|
void Evaluate(BoundScriptStatement* statement);
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ Script Script::Create(string script) {
|
||||||
Script::Script() {
|
Script::Script() {
|
||||||
Diagnostics = new class Diagnostics();
|
Diagnostics = new class Diagnostics();
|
||||||
_evaluator = new Evaluator(this);
|
_evaluator = new Evaluator(this);
|
||||||
|
_lastValue = nullptr;
|
||||||
|
BoundScript = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Script::Evaluate() {
|
void Script::Evaluate() {
|
||||||
|
|
Loading…
Reference in New Issue