From f19ba3e5ba71adf8092252bac21381ba75870792 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 17 Feb 2021 12:17:44 +0800 Subject: fix macro issue. --- src/yuescript/yue_compiler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 22311f4..4917e4e 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp @@ -58,7 +58,7 @@ inline std::string s(std::string_view sv) { return std::string(sv); } -const std::string_view version = "0.6.5"sv; +const std::string_view version = "0.6.6"sv; const std::string_view extension = "yue"sv; class YueCompilerImpl { @@ -593,6 +593,7 @@ private: case id(): return static_cast(exportNode->target.to()->exprs.back()); } } + return nullptr; } case id(): { if (auto localValues = static_cast(stmt->content.get())->item.as()) { @@ -600,6 +601,7 @@ private: return static_cast(expList->exprs.back()); } } + return nullptr; } case id(): { if (auto globalValues = static_cast(stmt->content.get())->item.as()) { @@ -607,6 +609,7 @@ private: return static_cast(expList->exprs.back()); } } + return nullptr; } } return nullptr; @@ -3318,7 +3321,7 @@ private: throw std::logic_error(_info.errorMessage(s("failed to expand macro: "sv) + err, x)); } // cur success res if (lua_toboolean(L, -2) == 0) { - std::string err = lua_tostring(L, -2); + std::string err = lua_tostring(L, -1); throw std::logic_error(_info.errorMessage(s("failed to expand macro: "sv) + err, x)); } lua_remove(L, -2); // cur res -- cgit v1.2.3-55-g6feb