summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2026-01-15 18:58:08 +0800
committerLi Jin <dragon-fly@qq.com>2026-01-15 18:58:08 +0800
commit8a01e9c4ec201ad7079f6863c9236851d162b864 (patch)
treef60fa49ebe192bfee5e94db6740a062c13af343a /src
parentd812fcd0853f52afa61ce8c1c028c94d0794ebe6 (diff)
downloadyuescript-0.31.1.tar.gz
yuescript-0.31.1.tar.bz2
yuescript-0.31.1.zip
Fixed a crash issue.HEADv0.31.1main
Diffstat (limited to 'src')
-rw-r--r--src/yuescript/yue_compiler.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index 09d0bd1..a2d49af 100644
--- a/src/yuescript/yue_compiler.cpp
+++ b/src/yuescript/yue_compiler.cpp
@@ -78,7 +78,7 @@ static std::unordered_set<std::string> Metamethods = {
78 "close"s // Lua 5.4 78 "close"s // Lua 5.4
79}; 79};
80 80
81const std::string_view version = "0.31.0"sv; 81const std::string_view version = "0.31.1"sv;
82const std::string_view extension = "yue"sv; 82const std::string_view extension = "yue"sv;
83 83
84class CompileError : public std::logic_error { 84class CompileError : public std::logic_error {
@@ -437,7 +437,7 @@ private:
437 struct Scope; 437 struct Scope;
438 struct ImportedGlobal { 438 struct ImportedGlobal {
439 std::string* globalCodeLine = nullptr; 439 std::string* globalCodeLine = nullptr;
440 Scope* importingScope = nullptr; 440 std::unordered_map<std::string, VarType>* vars = nullptr;
441 std::string indent; 441 std::string indent;
442 std::string nl; 442 std::string nl;
443 std::unordered_set<std::string_view> globals; 443 std::unordered_set<std::string_view> globals;
@@ -1625,7 +1625,7 @@ private:
1625 if (_importedGlobal->globals.find(name) == _importedGlobal->globals.end() && !isSolidDefined(name)) { 1625 if (_importedGlobal->globals.find(name) == _importedGlobal->globals.end() && !isSolidDefined(name)) {
1626 const auto& global = _importedGlobal->globalList.emplace_back(name); 1626 const auto& global = _importedGlobal->globalList.emplace_back(name);
1627 _importedGlobal->globals.insert(global); 1627 _importedGlobal->globals.insert(global);
1628 _importedGlobal->importingScope->vars->insert_or_assign(name, VarType::LocalConst); 1628 _importedGlobal->vars->insert_or_assign(name, VarType::LocalConst);
1629 } 1629 }
1630 } 1630 }
1631 1631
@@ -5333,7 +5333,7 @@ private:
5333 auto& scope = currentScope(); 5333 auto& scope = currentScope();
5334 scope.importedGlobal = std::make_unique<ImportedGlobal>(); 5334 scope.importedGlobal = std::make_unique<ImportedGlobal>();
5335 _importedGlobal = scope.importedGlobal.get(); 5335 _importedGlobal = scope.importedGlobal.get();
5336 _importedGlobal->importingScope = &scope; 5336 _importedGlobal->vars = scope.vars.get();
5337 _importedGlobal->indent = indent(); 5337 _importedGlobal->indent = indent();
5338 _importedGlobal->nl = nl(stmt); 5338 _importedGlobal->nl = nl(stmt);
5339 _importedGlobal->globalCodeLine = &temp.emplace_back(); 5339 _importedGlobal->globalCodeLine = &temp.emplace_back();