Support for loading variables from module with require
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -630,12 +630,12 @@ namespace Porygon::Binder {
|
||||
exp->GetLength());
|
||||
return new BoundBadExpression(exp->GetStartPosition(), exp ->GetLength());
|
||||
}
|
||||
auto module = opt->ResolveModule(transformedKey);
|
||||
auto module = Script::Clone(opt->ResolveModule(transformedKey));
|
||||
if (module -> GetReturnType() == nullptr){
|
||||
for (const auto& v: *module->GetScriptVariables()){
|
||||
//TODO: Currently a hack, will always make all variables nil
|
||||
auto type = make_shared<const ScriptType>(TypeClass::Nil);
|
||||
this -> _scope -> AssignVariable(v.first, type);
|
||||
auto type = module->GetVariableType(v.first);
|
||||
auto result = this -> _scope -> AssignVariable(v.first, type);
|
||||
delete result.GetKey();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -737,7 +737,7 @@ namespace Porygon::Binder {
|
||||
|
||||
BoundExpression *Binder::BindTableExpression(const ParsedTableExpression *expression) {
|
||||
auto tableScope = new map<Utilities::HashedString, BoundVariable *>();
|
||||
auto innerScope = new BoundScope(tableScope);
|
||||
auto innerScope = new BoundScope(tableScope, nullptr);
|
||||
auto currentScope = this->_scope;
|
||||
this->_scope = innerScope;
|
||||
auto block = dynamic_cast<BoundBlockStatement*>(this->BindBlockStatement(expression->GetBlock()));
|
||||
|
||||
Reference in New Issue
Block a user