From a82254df5f9907cd79c087c7b8e2f230076d1a16 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 28 Apr 2021 15:53:54 +0800 Subject: report a destructuring nil item error. --- src/yuescript/yue_compiler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index edab7f4..7cd39af 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp @@ -59,7 +59,7 @@ inline std::string s(std::string_view sv) { return std::string(sv); } -const std::string_view version = "0.7.10"sv; +const std::string_view version = "0.7.11"sv; const std::string_view extension = "yue"sv; class YueCompilerImpl { @@ -1573,9 +1573,11 @@ private: if (*j != nullNode) { if (auto ssVal = simpleSingleValueFrom(*j)) { if (ssVal->value.is()) { - throw std::logic_error(_info.errorMessage("can not destruct a const value"sv, ssVal->value)); + throw std::logic_error(_info.errorMessage("can not destructure a const value"sv, ssVal->value)); } } + } else { + throw std::logic_error(_info.errorMessage("can not destructure a nil value"sv, destructNode)); } destructPairs.push_back({i,j}); auto subDestruct = destructNode->new_ptr(); -- cgit v1.2.3-55-g6feb