diff options
-rw-r--r-- | spec/inputs/existential.moon | 2 | ||||
-rw-r--r-- | src/MoonP/moon_compiler.cpp | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/spec/inputs/existential.moon b/spec/inputs/existential.moon index e8e2249..f7d5ebd 100644 --- a/spec/inputs/existential.moon +++ b/spec/inputs/existential.moon | |||
@@ -17,5 +17,5 @@ with abc?!\func?! | |||
17 | if {:x} = a?.if?\then?(123)? @?\function 998 | 17 | if {:x} = a?.if?\then?(123)? @?\function 998 |
18 | print x | 18 | print x |
19 | 19 | ||
20 | res = b.function\do!\while("OK")\if("def",998)\f? | 20 | res = b.function\do!\while?("OK")\if("def",998)\f? |
21 | print res | 21 | print res |
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) { |