diff options
| author | Li Jin <dragon-fly@qq.com> | 2023-07-13 09:09:47 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2023-07-13 09:09:47 +0800 |
| commit | 1d2423bff4ecc4396d65c387982d6667b33bd796 (patch) | |
| tree | 8826b1e95cc6feb9c3a2cd62e9c2848d64e9fd03 | |
| parent | 7775f4c5b97dcc0d7e71a2cd8fb132f2b5bc1bd6 (diff) | |
| download | yuescript-1d2423bff4ecc4396d65c387982d6667b33bd796.tar.gz yuescript-1d2423bff4ecc4396d65c387982d6667b33bd796.tar.bz2 yuescript-1d2423bff4ecc4396d65c387982d6667b33bd796.zip | |
fix a missing case for in expression.v0.17.6
Diffstat (limited to '')
| -rw-r--r-- | spec/inputs/in_expression.yue | 2 | ||||
| -rw-r--r-- | spec/outputs/in_expression.lua | 2 | ||||
| -rw-r--r-- | src/yuescript/yue_compiler.cpp | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/spec/inputs/in_expression.yue b/spec/inputs/in_expression.yue index 66a8215..4080016 100644 --- a/spec/inputs/in_expression.yue +++ b/spec/inputs/in_expression.yue | |||
| @@ -36,7 +36,7 @@ do | |||
| 36 | do | 36 | do |
| 37 | item = get! | 37 | item = get! |
| 38 | list = {1, 2, 3} | 38 | list = {1, 2, 3} |
| 39 | exist = item in list | 39 | not_exist = item not in list |
| 40 | check item in list | 40 | check item in list |
| 41 | check item in {1, 2, 3} | 41 | check item in {1, 2, 3} |
| 42 | check item in {[1]: 1, [2]: 2, [3]: 3} | 42 | check item in {[1]: 1, [2]: 2, [3]: 3} |
diff --git a/spec/outputs/in_expression.lua b/spec/outputs/in_expression.lua index 41ae87e..ccc5fd0 100644 --- a/spec/outputs/in_expression.lua +++ b/spec/outputs/in_expression.lua | |||
| @@ -92,7 +92,7 @@ do | |||
| 92 | 2, | 92 | 2, |
| 93 | 3 | 93 | 3 |
| 94 | } | 94 | } |
| 95 | local exist = (#list > 0 and (function() | 95 | local not_exist = not (#list > 0 and (function() |
| 96 | for _index_0 = 1, #list do | 96 | for _index_0 = 1, #list do |
| 97 | if list[_index_0] == item then | 97 | if list[_index_0] == item then |
| 98 | return true | 98 | return true |
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 3353a2a..c6cc4ba 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.17.5"sv; | 75 | const std::string_view version = "0.17.6"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 { |
| @@ -5483,6 +5483,9 @@ private: | |||
| 5483 | } | 5483 | } |
| 5484 | popAnonVarArg(); | 5484 | popAnonVarArg(); |
| 5485 | popFunctionScope(); | 5485 | popFunctionScope(); |
| 5486 | if (unary_exp->inExp->not_) { | ||
| 5487 | temp.front().insert(0, "not "s); | ||
| 5488 | } | ||
| 5486 | out.push_back(join(temp)); | 5489 | out.push_back(join(temp)); |
| 5487 | return; | 5490 | return; |
| 5488 | } | 5491 | } |
