diff options
author | Li Jin <dragon-fly@qq.com> | 2023-12-18 10:28:35 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2023-12-18 10:28:35 +0800 |
commit | 1b43ecc9a453e0cc7b0a481690375ca35457d54a (patch) | |
tree | cedc595a1eadc26f6907e2bf04884f92a70ac809 /src | |
parent | 8cff6076041f4204a53a177359783d75698ec19f (diff) | |
download | yuescript-1b43ecc9a453e0cc7b0a481690375ca35457d54a.tar.gz yuescript-1b43ecc9a453e0cc7b0a481690375ca35457d54a.tar.bz2 yuescript-1b43ecc9a453e0cc7b0a481690375ca35457d54a.zip |
fix a format case.
Diffstat (limited to 'src')
-rw-r--r-- | src/yuescript/yue_ast.cpp | 18 | ||||
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/yuescript/yue_ast.cpp b/src/yuescript/yue_ast.cpp index 69695a0..5dfacc7 100644 --- a/src/yuescript/yue_ast.cpp +++ b/src/yuescript/yue_ast.cpp | |||
@@ -844,9 +844,21 @@ static bool isInBlockExp(ast_node* node, bool last = false) { | |||
844 | } | 844 | } |
845 | auto value = static_cast<Value_t*>(unaryExp->expos.back()); | 845 | auto value = static_cast<Value_t*>(unaryExp->expos.back()); |
846 | if (auto simpleValue = value->item.as<SimpleValue_t>()) { | 846 | if (auto simpleValue = value->item.as<SimpleValue_t>()) { |
847 | if (!ast_is<TableLit_t, ConstValue_t, Num_t, VarArg_t, | 847 | switch (simpleValue->value->get_id()) { |
848 | TblComprehension_t, Comprehension_t>(simpleValue->value)) { | 848 | case id<TableLit_t>(): |
849 | return true; | 849 | case id<ConstValue_t>(): |
850 | case id<Num_t>(): | ||
851 | case id<VarArg_t>(): | ||
852 | case id<TblComprehension_t>(): | ||
853 | case id<Comprehension_t>(): | ||
854 | return false; | ||
855 | case id<FunLit_t>(): | ||
856 | if (!last) { | ||
857 | return true; | ||
858 | } | ||
859 | return false; | ||
860 | default: | ||
861 | return true; | ||
850 | } | 862 | } |
851 | } else if (auto chainValue = value->item.as<ChainValue_t>()) { | 863 | } else if (auto chainValue = value->item.as<ChainValue_t>()) { |
852 | if (ast_is<InvokeArgs_t>(chainValue->items.back())) { | 864 | if (ast_is<InvokeArgs_t>(chainValue->items.back())) { |
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 044ee91..2283d85 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
@@ -75,7 +75,7 @@ static std::unordered_set<std::string> Metamethods = { | |||
75 | "close"s // Lua 5.4 | 75 | "close"s // Lua 5.4 |
76 | }; | 76 | }; |
77 | 77 | ||
78 | const std::string_view version = "0.21.3"sv; | 78 | const std::string_view version = "0.21.4"sv; |
79 | const std::string_view extension = "yue"sv; | 79 | const std::string_view extension = "yue"sv; |
80 | 80 | ||
81 | class CompileError : public std::logic_error { | 81 | class CompileError : public std::logic_error { |