@@ -78,7 +78,7 @@ static std::unordered_set<std::string> Metamethods = {
7878 " close" s // Lua 5.4
7979};
8080
81- const std::string_view version = " 0.31.0 " sv;
81+ const std::string_view version = " 0.31.1 " sv;
8282const std::string_view extension = " yue" sv;
8383
8484class CompileError : public std ::logic_error {
@@ -437,7 +437,7 @@ class YueCompilerImpl {
437437 struct Scope ;
438438 struct ImportedGlobal {
439439 std::string* globalCodeLine = nullptr ;
440- Scope* importingScope = nullptr ;
440+ std::unordered_map<std::string, VarType>* vars = nullptr ;
441441 std::string indent;
442442 std::string nl;
443443 std::unordered_set<std::string_view> globals;
@@ -1625,7 +1625,7 @@ class YueCompilerImpl {
16251625 if (_importedGlobal->globals .find (name) == _importedGlobal->globals .end () && !isSolidDefined (name)) {
16261626 const auto & global = _importedGlobal->globalList .emplace_back (name);
16271627 _importedGlobal->globals .insert (global);
1628- _importedGlobal->importingScope -> vars ->insert_or_assign (name, VarType::LocalConst);
1628+ _importedGlobal->vars ->insert_or_assign (name, VarType::LocalConst);
16291629 }
16301630 }
16311631
@@ -5333,7 +5333,7 @@ class YueCompilerImpl {
53335333 auto & scope = currentScope ();
53345334 scope.importedGlobal = std::make_unique<ImportedGlobal>();
53355335 _importedGlobal = scope.importedGlobal .get ();
5336- _importedGlobal->importingScope = & scope;
5336+ _importedGlobal->vars = scope. vars . get () ;
53375337 _importedGlobal->indent = indent ();
53385338 _importedGlobal->nl = nl (stmt);
53395339 _importedGlobal->globalCodeLine = &temp.emplace_back ();
0 commit comments