aboutsummaryrefslogtreecommitdiff
path: root/src/MoonP/moon_compiler.cpp
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-03-26 16:21:30 +0800
committerLi Jin <dragon-fly@qq.com>2020-03-26 16:21:30 +0800
commit69091011685db34e5dc4012e9d2cf24a0ac77715 (patch)
treeb948a213f4044c105c9baf674e077d210ae60024 /src/MoonP/moon_compiler.cpp
parenta97ca224f23b4101e44c099dbe29d1cc4a72c758 (diff)
downloadyuescript-69091011685db34e5dc4012e9d2cf24a0ac77715.tar.gz
yuescript-69091011685db34e5dc4012e9d2cf24a0ac77715.tar.bz2
yuescript-69091011685db34e5dc4012e9d2cf24a0ac77715.zip
remove else branch support for appendix syntax.
Diffstat (limited to 'src/MoonP/moon_compiler.cpp')
-rw-r--r--src/MoonP/moon_compiler.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/MoonP/moon_compiler.cpp b/src/MoonP/moon_compiler.cpp
index b89f6d1..e961a92 100644
--- a/src/MoonP/moon_compiler.cpp
+++ b/src/MoonP/moon_compiler.cpp
@@ -43,7 +43,7 @@ inline std::string s(std::string_view sv) {
43} 43}
44 44
45const char* moonScriptVersion() { 45const char* moonScriptVersion() {
46 return "0.5.0-r0.3.5"; 46 return "0.5.0-r0.3.6";
47} 47}
48 48
49// name of table stored in lua registry 49// name of table stored in lua registry
@@ -641,13 +641,13 @@ private:
641 } 641 }
642 auto appendix = statement->appendix.get(); 642 auto appendix = statement->appendix.get();
643 switch (appendix->item->getId()) { 643 switch (appendix->item->getId()) {
644 case id<if_else_line_t>(): { 644 case id<if_line_t>(): {
645 auto if_else_line = appendix->item.to<if_else_line_t>(); 645 auto if_line = appendix->item.to<if_line_t>();
646 auto ifNode = x->new_ptr<If_t>(); 646 auto ifNode = x->new_ptr<If_t>();
647 647
648 auto ifCond = x->new_ptr<IfCond_t>(); 648 auto ifCond = x->new_ptr<IfCond_t>();
649 ifCond->condition.set(if_else_line->condition); 649 ifCond->condition.set(if_line->condition);
650 ifCond->assign.set(if_else_line->assign); 650 ifCond->assign.set(if_line->assign);
651 ifNode->nodes.push_back(ifCond); 651 ifNode->nodes.push_back(ifCond);
652 652
653 auto stmt = x->new_ptr<Statement_t>(); 653 auto stmt = x->new_ptr<Statement_t>();
@@ -656,18 +656,6 @@ private:
656 body->content.set(stmt); 656 body->content.set(stmt);
657 ifNode->nodes.push_back(body); 657 ifNode->nodes.push_back(body);
658 658
659 if (!ast_is<default_value_t>(if_else_line->elseExpr)) {
660 auto expList = x->new_ptr<ExpList_t>();
661 expList->exprs.push_back(if_else_line->elseExpr);
662 auto expListAssign = x->new_ptr<ExpListAssign_t>();
663 expListAssign->expList.set(expList);
664 auto stmt = x->new_ptr<Statement_t>();
665 stmt->content.set(expListAssign);
666 auto body = x->new_ptr<Body_t>();
667 body->content.set(stmt);
668 ifNode->nodes.push_back(body);
669 }
670
671 statement->appendix.set(nullptr); 659 statement->appendix.set(nullptr);
672 auto simpleValue = x->new_ptr<SimpleValue_t>(); 660 auto simpleValue = x->new_ptr<SimpleValue_t>();
673 simpleValue->value.set(ifNode); 661 simpleValue->value.set(ifNode);