From 6b204d11ad8426bb179ae3be1e71d30f08e3b375 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 3 Apr 2024 16:28:36 +0800 Subject: fix a wrong case that marks for-each loop key variable constant. --- src/yuescript/yue_compiler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 9208d5d..9a632fb 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp @@ -75,7 +75,7 @@ static std::unordered_set Metamethods = { "close"s // Lua 5.4 }; -const std::string_view version = "0.23.2"sv; +const std::string_view version = "0.23.3"sv; const std::string_view extension = "yue"sv; class CompileError : public std::logic_error { @@ -7312,6 +7312,9 @@ private: } switch (loopTarget->get_id()) { case id(): { + if (!varConstAfter.empty()) { + varConstAfter.clear(); + } auto star_exp = static_cast(loopTarget); auto listVar = singleVariableFrom(star_exp->value, AccessType::Read); if (!isLocal(listVar)) listVar.clear(); -- cgit v1.2.3-55-g6feb