diff options
author | Li Jin <dragon-fly@qq.com> | 2022-05-15 17:26:33 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-05-15 17:26:33 +0800 |
commit | e9926f70a53639c09a5605f71a34ec370395f5a9 (patch) | |
tree | 3852b05f7ae76f1f41fcc4bada25f8b43a4969eb /src/yuescript/yue_compiler.cpp | |
parent | 06db7a65e7fe8e67116fba71dc41d78ec4da93b9 (diff) | |
download | yuescript-e9926f70a53639c09a5605f71a34ec370395f5a9.tar.gz yuescript-e9926f70a53639c09a5605f71a34ec370395f5a9.tar.bz2 yuescript-e9926f70a53639c09a5605f71a34ec370395f5a9.zip |
fix issue #100.
Diffstat (limited to '')
-rwxr-xr-x | src/yuescript/yue_compiler.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index bc046af..469dfea 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.18"sv; | 63 | const std::string_view version = "0.10.19"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 { |
@@ -2005,6 +2005,9 @@ private: | |||
2005 | auto value = tab->new_ptr<Value_t>(); | 2005 | auto value = tab->new_ptr<Value_t>(); |
2006 | value->item.set(simpleValue); | 2006 | value->item.set(simpleValue); |
2007 | auto pairs = destructFromExp(newExp(value, expr)); | 2007 | auto pairs = destructFromExp(newExp(value, expr)); |
2008 | if (pairs.empty()) { | ||
2009 | throw std::logic_error(_info.errorMessage("expect items to be destructured"sv, tab)); | ||
2010 | } | ||
2008 | destruct.items = std::move(pairs); | 2011 | destruct.items = std::move(pairs); |
2009 | if (!varDefOnly) { | 2012 | if (!varDefOnly) { |
2010 | if (*j == nullNode) { | 2013 | if (*j == nullNode) { |
@@ -6589,12 +6592,13 @@ private: | |||
6589 | } | 6592 | } |
6590 | 6593 | ||
6591 | void transformImportAs(ImportAs_t* import, str_list& out) { | 6594 | void transformImportAs(ImportAs_t* import, str_list& out) { |
6592 | auto x = import; | 6595 | ast_node* x = import; |
6593 | if (!import->target) { | 6596 | if (!import->target) { |
6594 | auto name = moduleNameFrom(import->literal); | 6597 | auto name = moduleNameFrom(import->literal); |
6595 | import->target.set(toAst<Variable_t>(name, x)); | 6598 | import->target.set(toAst<Variable_t>(name, x)); |
6596 | } | 6599 | } |
6597 | if (ast_is<import_all_macro_t, ImportTabLit_t>(import->target)) { | 6600 | if (ast_is<import_all_macro_t, ImportTabLit_t>(import->target)) { |
6601 | x = import->target.get(); | ||
6598 | bool importAllMacro = import->target.is<import_all_macro_t>(); | 6602 | bool importAllMacro = import->target.is<import_all_macro_t>(); |
6599 | std::list<std::pair<std::string,std::string>> macroPairs; | 6603 | std::list<std::pair<std::string,std::string>> macroPairs; |
6600 | auto newTab = x->new_ptr<ImportTabLit_t>(); | 6604 | auto newTab = x->new_ptr<ImportTabLit_t>(); |