aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-05-24 10:30:26 +0800
committerLi Jin <dragon-fly@qq.com>2022-05-24 10:30:26 +0800
commit241f0c0d76c18419b9e99447773786147973a296 (patch)
tree6a1a15e4e968c4bfdad32758cbbd8c495f9b2b00
parent30a11b0023ad1bc59662d1ead279ba92f6f57cdc (diff)
downloadyuescript-241f0c0d76c18419b9e99447773786147973a296.tar.gz
yuescript-241f0c0d76c18419b9e99447773786147973a296.tar.bz2
yuescript-241f0c0d76c18419b9e99447773786147973a296.zip
mark variables with both attributes "const" and "close" to be constant in compiler.
-rwxr-xr-xsrc/yuescript/yue_compiler.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index d87ee3f..706d5ce 100755
--- a/src/yuescript/yue_compiler.cpp
+++ b/src/yuescript/yue_compiler.cpp
@@ -60,7 +60,7 @@ using namespace parserlib;
60 60
61typedef std::list<std::string> str_list; 61typedef std::list<std::string> str_list;
62 62
63const std::string_view version = "0.10.23"sv; 63const std::string_view version = "0.10.24"sv;
64const std::string_view extension = "yue"sv; 64const std::string_view extension = "yue"sv;
65 65
66class YueCompilerImpl { 66class YueCompilerImpl {
@@ -7158,15 +7158,9 @@ private:
7158 } 7158 }
7159#else // YUE_NO_ATTRIB 7159#else // YUE_NO_ATTRIB
7160 attrib = " <"s + attrib + '>'; 7160 attrib = " <"s + attrib + '>';
7161 if (attrib == "<const>"sv) { 7161 for (auto& var : vars) {
7162 for (auto& var : vars) { 7162 markVarConst(var);
7163 markVarConst(var); 7163 var.append(attrib);
7164 var.append(attrib);
7165 }
7166 } else {
7167 for (auto& var : vars) {
7168 var.append(attrib);
7169 }
7170 } 7164 }
7171#endif // YUE_NO_ATTRIB 7165#endif // YUE_NO_ATTRIB
7172 str_list temp; 7166 str_list temp;