From 537011df328c4f8899c3b4af409e5a5f0f682ba9 Mon Sep 17 00:00:00 2001 From: PuqiAR Date: Sun, 8 Feb 2026 13:27:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9LvObject=20set=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E5=85=88=E6=A3=80=E6=9F=A5=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=8F=AF=E5=8F=98=E5=86=8D=E6=A3=80=E6=9F=A5=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E3=80=82=E6=9B=B4=E7=AC=A6=E5=90=88=E7=9B=B4?= =?UTF-8?q?=E8=A7=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Evaluator/Value/LvObject.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Evaluator/Value/LvObject.hpp b/src/Evaluator/Value/LvObject.hpp index 002a4e6..4890089 100644 --- a/src/Evaluator/Value/LvObject.hpp +++ b/src/Evaluator/Value/LvObject.hpp @@ -80,6 +80,10 @@ namespace Fig if (kind == Kind::Variable) { auto s = resolve(slot); + if (isAccessConst(s->am)) + { + throw RuntimeError(FString(std::format("Variable `{}` is immutable", s->name.toBasicString()))); + } if (!isTypeMatch(s->declaredType, v, ctx)) { throw RuntimeError( @@ -89,11 +93,6 @@ namespace Fig s->declaredType.toString().toBasicString(), prettyType(v).toBasicString()))); } - if (isAccessConst(s->am)) - { - throw RuntimeError(FString( - std::format("Variable `{}` is immutable", s->name.toBasicString()))); - } s->value = v; } else if (kind == Kind::ListElement)