From 4827d200604a086e2ad94edb4257c3abc7a3c4fc Mon Sep 17 00:00:00 2001 From: Li Jin Date: Sat, 25 Jan 2020 14:11:25 +0800 Subject: fix more chain value case. --- src/MoonP/moon_compiler.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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: if (ast_is(chainValue->items.back())) { return ChainType::EndWithEOP; } + ChainType type = ChainType::Common; for (auto item : chainValue->items.objects()) { if (auto colonChain = ast_cast(item)) { if (ast_is(colonChain->name)) { - return ChainType::HasKeyword; + type = ChainType::HasKeyword; } - } else if (ast_is(item) && item != chainValue->items.back()) { + } else if (ast_is(item)) { return ChainType::HasEOP; } } - return ChainType::Common; + return type; } std::string singleVariableFrom(ChainValue_t* chainValue) { -- cgit v1.2.3-55-g6feb