aboutsummaryrefslogtreecommitdiff
path: root/src/yuescript/yue_compiler.cpp
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-04-01 17:47:27 +0800
committerLi Jin <dragon-fly@qq.com>2022-04-01 17:47:27 +0800
commitca1ed557769352c0ac0ca7804dd25e18c1fdf2e1 (patch)
treebf86d3990b90054f8d82aaf87cb9efae444a08ce /src/yuescript/yue_compiler.cpp
parent7be6c300256bfe411942a7ccc66f6bc3afa7390d (diff)
downloadyuescript-ca1ed557769352c0ac0ca7804dd25e18c1fdf2e1.tar.gz
yuescript-ca1ed557769352c0ac0ca7804dd25e18c1fdf2e1.tar.bz2
yuescript-ca1ed557769352c0ac0ca7804dd25e18c1fdf2e1.zip
fix some ambiguous syntax caused by arg table block.
Diffstat (limited to '')
-rwxr-xr-xsrc/yuescript/yue_compiler.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index 4e01c24..26a8c5a 100755
--- a/src/yuescript/yue_compiler.cpp
+++ b/src/yuescript/yue_compiler.cpp
@@ -60,7 +60,7 @@ using namespace parserlib;
60 60
61typedef std::list<std::string> str_list; 61typedef std::list<std::string> str_list;
62 62
63const std::string_view version = "0.10.7"sv; 63const std::string_view version = "0.10.8"sv;
64const std::string_view extension = "yue"sv; 64const std::string_view extension = "yue"sv;
65 65
66class YueCompilerImpl { 66class YueCompilerImpl {
@@ -1876,8 +1876,16 @@ private:
1876 if (destructNode || (destructNode = value->item.as<simple_table_t>())) { 1876 if (destructNode || (destructNode = value->item.as<simple_table_t>())) {
1877 if (*j != nullNode) { 1877 if (*j != nullNode) {
1878 if (auto ssVal = simpleSingleValueFrom(*j)) { 1878 if (auto ssVal = simpleSingleValueFrom(*j)) {
1879 if (ssVal->value.is<const_value_t>()) { 1879 switch (ssVal->value->getId()) {
1880 throw std::logic_error(_info.errorMessage("can not destructure a const value"sv, ssVal->value)); 1880 case id<const_value_t>():
1881 throw std::logic_error(_info.errorMessage("can not destructure a const value"sv, ssVal->value));
1882 break;
1883 case id<Num_t>():
1884 throw std::logic_error(_info.errorMessage("can not destructure a number"sv, ssVal->value));
1885 break;
1886 case id<FunLit_t>():
1887 throw std::logic_error(_info.errorMessage("can not destructure a function"sv, ssVal->value));
1888 break;
1881 } 1889 }
1882 } 1890 }
1883 } else { 1891 } else {