Rework evaluation to use shared pointers, fix bugs
This commit is contained in:
@@ -90,7 +90,7 @@ VariableAssignment BoundScope::AssignVariable(int identifier, const std::shared_
|
||||
} else{
|
||||
// Assigning
|
||||
auto var = this->GetVariable(exists, identifier);
|
||||
if (var->GetType() != type){
|
||||
if (var->GetType().get()->operator!=(type.get())){
|
||||
return VariableAssignment(VariableAssignmentResult::VariableDefinedWithDifferentType, nullptr);
|
||||
}
|
||||
return VariableAssignment(VariableAssignmentResult::Ok, new BoundVariableKey(identifier, exists, false));
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <utility>
|
||||
|
||||
|
||||
#ifndef PORYGONLANG_BOUNDVARIABLE_HPP
|
||||
#define PORYGONLANG_BOUNDVARIABLE_HPP
|
||||
@@ -10,9 +12,7 @@ using namespace std;
|
||||
class BoundVariable{
|
||||
std::shared_ptr<ScriptType> _type;
|
||||
public:
|
||||
explicit BoundVariable(std::shared_ptr<ScriptType> type) : _type(type){
|
||||
}
|
||||
~BoundVariable(){
|
||||
explicit BoundVariable(std::shared_ptr<ScriptType> type) : _type(std::move(type)){
|
||||
}
|
||||
|
||||
std::shared_ptr<ScriptType> GetType(){
|
||||
|
||||
Reference in New Issue
Block a user