diff options
author | Li Jin <dragon-fly@qq.com> | 2021-04-28 15:53:54 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-04-28 15:53:54 +0800 |
commit | a82254df5f9907cd79c087c7b8e2f230076d1a16 (patch) | |
tree | 3186f8e4cf333c9f001bbf3077f9dee075fef9c8 /src | |
parent | 81a3e818f4f0ca7bf8e39ed0b5875355ddb27b46 (diff) | |
download | yuescript-a82254df5f9907cd79c087c7b8e2f230076d1a16.tar.gz yuescript-a82254df5f9907cd79c087c7b8e2f230076d1a16.tar.bz2 yuescript-a82254df5f9907cd79c087c7b8e2f230076d1a16.zip |
report a destructuring nil item error.
Diffstat (limited to 'src')
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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) { | |||
59 | return std::string(sv); | 59 | return std::string(sv); |
60 | } | 60 | } |
61 | 61 | ||
62 | const std::string_view version = "0.7.10"sv; | 62 | const std::string_view version = "0.7.11"sv; |
63 | const std::string_view extension = "yue"sv; | 63 | const std::string_view extension = "yue"sv; |
64 | 64 | ||
65 | class YueCompilerImpl { | 65 | class YueCompilerImpl { |
@@ -1573,9 +1573,11 @@ private: | |||
1573 | if (*j != nullNode) { | 1573 | if (*j != nullNode) { |
1574 | if (auto ssVal = simpleSingleValueFrom(*j)) { | 1574 | if (auto ssVal = simpleSingleValueFrom(*j)) { |
1575 | if (ssVal->value.is<const_value_t>()) { | 1575 | if (ssVal->value.is<const_value_t>()) { |
1576 | throw std::logic_error(_info.errorMessage("can not destruct a const value"sv, ssVal->value)); | 1576 | throw std::logic_error(_info.errorMessage("can not destructure a const value"sv, ssVal->value)); |
1577 | } | 1577 | } |
1578 | } | 1578 | } |
1579 | } else { | ||
1580 | throw std::logic_error(_info.errorMessage("can not destructure a nil value"sv, destructNode)); | ||
1579 | } | 1581 | } |
1580 | destructPairs.push_back({i,j}); | 1582 | destructPairs.push_back({i,j}); |
1581 | auto subDestruct = destructNode->new_ptr<TableLit_t>(); | 1583 | auto subDestruct = destructNode->new_ptr<TableLit_t>(); |