Implements assignment binding
This commit is contained in:
@@ -5,13 +5,14 @@
|
||||
#define PORYGONLANG_SCRIPT_HPP
|
||||
|
||||
#include <string>
|
||||
#include <boost/any.hpp>
|
||||
#include <unordered_map>
|
||||
#include "Diagnostics/Diagnostics.hpp"
|
||||
#include "Binder/BoundStatements/BoundStatement.hpp"
|
||||
class Script;
|
||||
class Evaluator;
|
||||
#include "Evaluator/Evaluator.hpp"
|
||||
#include "Evaluator/EvalValues/EvalValue.hpp"
|
||||
#include "Utilities/HashedString.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -19,15 +20,15 @@ class Script {
|
||||
friend class Evaluator;
|
||||
|
||||
EvalValue* _lastValue;
|
||||
|
||||
Evaluator* _evaluator;
|
||||
unordered_map<int, EvalValue*> _scopeVariables;
|
||||
|
||||
explicit Script();
|
||||
|
||||
void Parse(string script);
|
||||
BoundScriptStatement* BoundScript;
|
||||
public:
|
||||
static Script Create(string script);
|
||||
static Script* Create(string script);
|
||||
Diagnostics* Diagnostics;
|
||||
|
||||
~Script();
|
||||
@@ -37,6 +38,10 @@ public:
|
||||
EvalValue* GetLastValue(){
|
||||
return _lastValue;
|
||||
};
|
||||
|
||||
EvalValue* GetVariable(const string& key){
|
||||
return _scopeVariables.at(HashedString(key).GetHash());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user