aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2026-01-15 17:54:59 +0800
committerLi Jin <dragon-fly@qq.com>2026-01-15 17:54:59 +0800
commitafb046316a15a2c3702b1f056456b58e9356e693 (patch)
treec4820522be5c92948553673dad42c1734d30689f /src
parent873aced12cf65e633c95358f89a1d5ec37b81d00 (diff)
downloadyuescript-afb046316a15a2c3702b1f056456b58e9356e693.tar.gz
yuescript-afb046316a15a2c3702b1f056456b58e9356e693.tar.bz2
yuescript-afb046316a15a2c3702b1f056456b58e9356e693.zip
Added const attributes.
Diffstat (limited to 'src')
-rw-r--r--src/yuescript/yue_compiler.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index e79b857..09d0bd1 100644
--- a/src/yuescript/yue_compiler.cpp
+++ b/src/yuescript/yue_compiler.cpp
@@ -5380,9 +5380,11 @@ private:
5380 } 5380 }
5381 } 5381 }
5382 if (auto importedGlobal = currentScope().importedGlobal.get()) { 5382 if (auto importedGlobal = currentScope().importedGlobal.get()) {
5383 int target = getLuaTarget(block);
5384 auto attrib = target >= 504 ? " <const>"s : Empty;
5383 str_list globalCodes; 5385 str_list globalCodes;
5384 for (const auto& global : importedGlobal->globalList) { 5386 for (const auto& global : importedGlobal->globalList) {
5385 globalCodes.emplace_back(importedGlobal->indent + "local "s + global + " = "s + global + importedGlobal->nl); 5387 globalCodes.emplace_back(importedGlobal->indent + "local "s + global + attrib + " = "s + global + importedGlobal->nl);
5386 } 5388 }
5387 *importedGlobal->globalCodeLine = join(globalCodes); 5389 *importedGlobal->globalCodeLine = join(globalCodes);
5388 _importedGlobal = nullptr; 5390 _importedGlobal = nullptr;