diff options
author | Li Jin <dragon-fly@qq.com> | 2022-04-01 17:47:27 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-04-01 17:47:27 +0800 |
commit | ca1ed557769352c0ac0ca7804dd25e18c1fdf2e1 (patch) | |
tree | bf86d3990b90054f8d82aaf87cb9efae444a08ce /src/yuescript/yue_compiler.cpp | |
parent | 7be6c300256bfe411942a7ccc66f6bc3afa7390d (diff) | |
download | yuescript-ca1ed557769352c0ac0ca7804dd25e18c1fdf2e1.tar.gz yuescript-ca1ed557769352c0ac0ca7804dd25e18c1fdf2e1.tar.bz2 yuescript-ca1ed557769352c0ac0ca7804dd25e18c1fdf2e1.zip |
fix some ambiguous syntax caused by arg table block.
Diffstat (limited to '')
-rwxr-xr-x | src/yuescript/yue_compiler.cpp | 14 |
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 | ||
61 | typedef std::list<std::string> str_list; | 61 | typedef std::list<std::string> str_list; |
62 | 62 | ||
63 | const std::string_view version = "0.10.7"sv; | 63 | const std::string_view version = "0.10.8"sv; |
64 | const std::string_view extension = "yue"sv; | 64 | const std::string_view extension = "yue"sv; |
65 | 65 | ||
66 | class YueCompilerImpl { | 66 | class 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 { |