aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-01-25 14:11:25 +0800
committerLi Jin <dragon-fly@qq.com>2020-01-25 14:11:25 +0800
commit4827d200604a086e2ad94edb4257c3abc7a3c4fc (patch)
treecf2508586aeea39a3556a9395db4f1ddc4244f0b /src
parent96e0f5d1d7b3d0b3cf278b82ef6819dbfac96219 (diff)
downloadyuescript-4827d200604a086e2ad94edb4257c3abc7a3c4fc.tar.gz
yuescript-4827d200604a086e2ad94edb4257c3abc7a3c4fc.tar.bz2
yuescript-4827d200604a086e2ad94edb4257c3abc7a3c4fc.zip
fix more chain value case.
Diffstat (limited to 'src')
-rw-r--r--src/MoonP/moon_compiler.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/MoonP/moon_compiler.cpp b/src/MoonP/moon_compiler.cpp
index 020e561..b1770fb 100644
--- a/src/MoonP/moon_compiler.cpp
+++ b/src/MoonP/moon_compiler.cpp
@@ -441,16 +441,17 @@ private:
441 if (ast_is<existential_op_t>(chainValue->items.back())) { 441 if (ast_is<existential_op_t>(chainValue->items.back())) {
442 return ChainType::EndWithEOP; 442 return ChainType::EndWithEOP;
443 } 443 }
444 ChainType type = ChainType::Common;
444 for (auto item : chainValue->items.objects()) { 445 for (auto item : chainValue->items.objects()) {
445 if (auto colonChain = ast_cast<ColonChainItem_t>(item)) { 446 if (auto colonChain = ast_cast<ColonChainItem_t>(item)) {
446 if (ast_is<LuaKeyword_t>(colonChain->name)) { 447 if (ast_is<LuaKeyword_t>(colonChain->name)) {
447 return ChainType::HasKeyword; 448 type = ChainType::HasKeyword;
448 } 449 }
449 } else if (ast_is<existential_op_t>(item) && item != chainValue->items.back()) { 450 } else if (ast_is<existential_op_t>(item)) {
450 return ChainType::HasEOP; 451 return ChainType::HasEOP;
451 } 452 }
452 } 453 }
453 return ChainType::Common; 454 return type;
454 } 455 }
455 456
456 std::string singleVariableFrom(ChainValue_t* chainValue) { 457 std::string singleVariableFrom(ChainValue_t* chainValue) {