diff options
author | Li Jin <dragon-fly@qq.com> | 2023-04-23 09:37:38 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2023-04-23 09:37:38 +0800 |
commit | 45c66c4b8ad0d34742ec7e7ea038cda8ddc0235e (patch) | |
tree | 692a75756709275fc7e10fc7bfd53f58a9c729c3 | |
parent | 07d0de56b6536561ea348352107b1337ad129009 (diff) | |
download | yuescript-45c66c4b8ad0d34742ec7e7ea038cda8ddc0235e.tar.gz yuescript-45c66c4b8ad0d34742ec7e7ea038cda8ddc0235e.tar.bz2 yuescript-45c66c4b8ad0d34742ec7e7ea038cda8ddc0235e.zip |
fix.
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index f4b4330..a566fae 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
@@ -72,7 +72,7 @@ static std::unordered_set<std::string> Metamethods = { | |||
72 | "close"s // Lua 5.4 | 72 | "close"s // Lua 5.4 |
73 | }; | 73 | }; |
74 | 74 | ||
75 | const std::string_view version = "0.16.1"sv; | 75 | const std::string_view version = "0.16.2"sv; |
76 | const std::string_view extension = "yue"sv; | 76 | const std::string_view extension = "yue"sv; |
77 | 77 | ||
78 | class CompileError : public std::logic_error { | 78 | class CompileError : public std::logic_error { |
@@ -2523,6 +2523,9 @@ private: | |||
2523 | for (auto i = exprs.begin(), j = values.begin(); i != exprs.end(); ++i, ++j) { | 2523 | for (auto i = exprs.begin(), j = values.begin(); i != exprs.end(); ++i, ++j) { |
2524 | auto expr = *i; | 2524 | auto expr = *i; |
2525 | auto value = singleValueFrom(expr); | 2525 | auto value = singleValueFrom(expr); |
2526 | if (!value) { | ||
2527 | throw CompileError("invalid destructure"sv, expr); | ||
2528 | } | ||
2526 | ast_node* destructNode = value->getByPath<SimpleValue_t, TableLit_t>(); | 2529 | ast_node* destructNode = value->getByPath<SimpleValue_t, TableLit_t>(); |
2527 | if (destructNode || (destructNode = value->item.as<SimpleTable_t>())) { | 2530 | if (destructNode || (destructNode = value->item.as<SimpleTable_t>())) { |
2528 | if (*j != nil) { | 2531 | if (*j != nil) { |