summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-01-13 14:19:33 +0800
committerLi Jin <dragon-fly@qq.com>2020-01-13 14:19:33 +0800
commit4c830cdbd5993883f671e17228afc39c3a21e5cc (patch)
treed4e28491006dfe5747b7cc6bd0eb77a5df999e00
parentccb3381cdfc84a4dd37f5b7aea9ff21d6558c14b (diff)
downloadyuescript-4c830cdbd5993883f671e17228afc39c3a21e5cc.tar.gz
yuescript-4c830cdbd5993883f671e17228afc39c3a21e5cc.tar.bz2
yuescript-4c830cdbd5993883f671e17228afc39c3a21e5cc.zip
forbid exprlist appears in the left part of update statement.
-rw-r--r--src/MoonP/moon_compiler.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/MoonP/moon_compiler.cpp b/src/MoonP/moon_compiler.cpp
index e015939..0a5babe 100644
--- a/src/MoonP/moon_compiler.cpp
+++ b/src/MoonP/moon_compiler.cpp
@@ -1239,6 +1239,7 @@ private:
1239 auto action = assignment->action.get(); 1239 auto action = assignment->action.get();
1240 switch (action->getId()) { 1240 switch (action->getId()) {
1241 case "Update"_id: { 1241 case "Update"_id: {
1242 if (expList->exprs.size() > 1) throw std::logic_error(debugInfo("Can not apply update to multiple values."sv, expList));
1242 auto update = static_cast<Update_t*>(action); 1243 auto update = static_cast<Update_t*>(action);
1243 auto leftExp = static_cast<Exp_t*>(expList->exprs.objects().front()); 1244 auto leftExp = static_cast<Exp_t*>(expList->exprs.objects().front());
1244 auto leftValue = singleValueFrom(leftExp); 1245 auto leftValue = singleValueFrom(leftExp);