aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/yuescript/yue_ast.cpp18
-rw-r--r--src/yuescript/yue_compiler.cpp2
3 files changed, 17 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 22520de..0279831 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
1cmake_minimum_required(VERSION 3.1) 1cmake_minimum_required(VERSION 3.5)
2project(yue CXX) 2project(yue CXX)
3 3
4set(LUA_LIBDIR ${LUA_INCDIR}/../lib ${LUA_INCDIR}/../../lib) 4set(LUA_LIBDIR ${LUA_INCDIR}/../lib ${LUA_INCDIR}/../../lib)
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
78const std::string_view version = "0.21.3"sv; 78const std::string_view version = "0.21.4"sv;
79const std::string_view extension = "yue"sv; 79const std::string_view extension = "yue"sv;
80 80
81class CompileError : public std::logic_error { 81class CompileError : public std::logic_error {