diff options
| author | Li Jin <dragon-fly@qq.com> | 2022-11-09 11:30:17 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2022-11-09 11:30:17 +0800 |
| commit | 6db82a69096a48c8b348217b0db6e06b297218ca (patch) | |
| tree | 58dda2d771e508c417017d649707e8198f481a55 /src/yuescript/yue_compiler.cpp | |
| parent | b041d365b88b76418def86d13a8f946dd8a6db73 (diff) | |
| download | yuescript-6db82a69096a48c8b348217b0db6e06b297218ca.tar.gz yuescript-6db82a69096a48c8b348217b0db6e06b297218ca.tar.bz2 yuescript-6db82a69096a48c8b348217b0db6e06b297218ca.zip | |
refactor and update readme and changelog.
Diffstat (limited to '')
| -rw-r--r-- | src/yuescript/yue_compiler.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 4072974..f5436d1 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
| @@ -59,7 +59,7 @@ namespace yue { | |||
| 59 | 59 | ||
| 60 | typedef std::list<std::string> str_list; | 60 | typedef std::list<std::string> str_list; |
| 61 | 61 | ||
| 62 | const std::string_view version = "0.15.11"sv; | 62 | const std::string_view version = "0.15.12"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 { |
| @@ -3769,7 +3769,7 @@ private: | |||
| 3769 | if (!_enableReturn.top()) { | 3769 | if (!_enableReturn.top()) { |
| 3770 | ast_node* target = returnNode->valueList.get(); | 3770 | ast_node* target = returnNode->valueList.get(); |
| 3771 | if (!target) target = returnNode; | 3771 | if (!target) target = returnNode; |
| 3772 | throw std::logic_error(_info.errorMessage("illegal return statement here"sv, target)); | 3772 | throw std::logic_error(_info.errorMessage("can not mix use of return and export statements in module scope"sv, target)); |
| 3773 | } | 3773 | } |
| 3774 | if (auto valueList = returnNode->valueList.as<ExpListLow_t>()) { | 3774 | if (auto valueList = returnNode->valueList.as<ExpListLow_t>()) { |
| 3775 | if (valueList->exprs.size() == 1) { | 3775 | if (valueList->exprs.size() == 1) { |
| @@ -8008,8 +8008,11 @@ private: | |||
| 8008 | 8008 | ||
| 8009 | void transformChainAssign(ChainAssign_t* chainAssign, str_list& out) { | 8009 | void transformChainAssign(ChainAssign_t* chainAssign, str_list& out) { |
| 8010 | auto x = chainAssign; | 8010 | auto x = chainAssign; |
| 8011 | str_list temp; | ||
| 8012 | auto value = chainAssign->assign->values.front(); | 8011 | auto value = chainAssign->assign->values.front(); |
| 8012 | if (chainAssign->assign->values.size() != 1) { | ||
| 8013 | throw std::logic_error(_info.errorMessage("only one right value expected"sv, value)); | ||
| 8014 | } | ||
| 8015 | str_list temp; | ||
| 8013 | bool constVal = false; | 8016 | bool constVal = false; |
| 8014 | if (auto simpleVal = simpleSingleValueFrom(value)) { | 8017 | if (auto simpleVal = simpleSingleValueFrom(value)) { |
| 8015 | constVal = ast_is<const_value_t, Num_t>(simpleVal->value); | 8018 | constVal = ast_is<const_value_t, Num_t>(simpleVal->value); |
