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) {
|
||||
// Delete previously saved value.
|
||||
delete this->_scriptData->_lastValue;
|
||||
// Save new value
|
||||
this->_scriptData->_lastValue = this -> EvaluateExpression(statement->GetExpression());
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ class Evaluator {
|
|||
public:
|
||||
Evaluator(Script* script){
|
||||
_scriptData = script;
|
||||
_result = nullptr;
|
||||
}
|
||||
void Evaluate(BoundScriptStatement* statement);
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ Script Script::Create(string script) {
|
|||
Script::Script() {
|
||||
Diagnostics = new class Diagnostics();
|
||||
_evaluator = new Evaluator(this);
|
||||
_lastValue = nullptr;
|
||||
BoundScript = nullptr;
|
||||
}
|
||||
|
||||
void Script::Evaluate() {
|
||||
|
|
Loading…
Reference in New Issue