Implements assignment binding
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
#include <utility>
|
||||
|
||||
|
||||
#include <unordered_map>
|
||||
#include "Script.hpp"
|
||||
#include "Parser/Lexer.hpp"
|
||||
#include "Parser/Parser.hpp"
|
||||
#include "Binder/Binder.hpp"
|
||||
|
||||
Script Script::Create(string script) {
|
||||
auto s = Script();
|
||||
s.Parse(std::move(script));
|
||||
Script* Script::Create(string script) {
|
||||
auto s = new Script();
|
||||
s -> Parse(std::move(script));
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -40,7 +39,14 @@ void Script::Parse(string script) {
|
||||
}
|
||||
lexResult.clear();
|
||||
if (!Diagnostics->HasErrors()){
|
||||
this->BoundScript = Binder::Bind(this, parseResult);
|
||||
unordered_map<int, BoundVariable*> scriptScope;
|
||||
auto bindScope = new BoundScope(&scriptScope);
|
||||
this->BoundScript = Binder::Bind(this, parseResult, bindScope);
|
||||
for (const auto& v : scriptScope){
|
||||
this->_scopeVariables.insert({v.first, nullptr});
|
||||
delete v.second;
|
||||
}
|
||||
scriptScope.clear();
|
||||
}
|
||||
delete parseResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user