From 51faef5288a64a84b8f8e5cea8631c7518b94411 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Mon, 26 Jun 2023 09:23:37 +0800 Subject: fix gcc build. --- src/yuescript/yue_compiler.cpp | 5 ++++- src/yuescript/yuescript.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 8574e6c..477815d 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp @@ -202,6 +202,7 @@ public: } else if (auto exportNode = stmt->content.as()) { if (exportNode->target.is()) break; } + [[fallthrough]]; default: throw CompileError("macro exporting module only accepts macro definition, macro importing and macro expansion in place"sv, stmt); break; @@ -1951,6 +1952,7 @@ private: out.back().insert(0, preDefine); return; } + break; } case id(): { auto tableBlock = static_cast(value); @@ -1961,6 +1963,7 @@ private: out.back().insert(0, preDefine); return; } + break; } } auto exp = ast_cast(value); @@ -3776,7 +3779,7 @@ private: str_list temp; for (auto node : nodes) { transformStatement(static_cast(node), temp); - if (_parser.startWith(temp.back())) { + if (!temp.empty() && _parser.startWith(temp.back())) { auto rit = ++temp.rbegin(); if (rit != temp.rend() && !rit->empty()) { auto index = std::string::npos; diff --git a/src/yuescript/yuescript.cpp b/src/yuescript/yuescript.cpp index 933c77d..22ba2a1 100644 --- a/src/yuescript/yuescript.cpp +++ b/src/yuescript/yuescript.cpp @@ -328,6 +328,7 @@ static int yuetoast(lua_State* L) { lua_pop(L, 1); break; } + [[fallthrough]]; } default: { auto len = lua_objlen(L, tableIndex); -- cgit v1.2.3-55-g6feb