From 6c3f69309a9b4b24c1af8d43a28e2c53a0e7d560 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Mon, 2 Mar 2026 18:21:40 +0800 Subject: Fixed `yue.check` missed the module options issue. --- src/yuescript/yue_compiler.cpp | 2 +- src/yuescript/yuescript.cpp | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 514b6f2..cca0179 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp @@ -78,7 +78,7 @@ static std::unordered_set Metamethods = { "close"s // Lua 5.4 }; -const std::string_view version = "0.33.7"sv; +const std::string_view version = "0.33.8"sv; const std::string_view extension = "yue"sv; class CompileError : public std::logic_error { diff --git a/src/yuescript/yuescript.cpp b/src/yuescript/yuescript.cpp index fd2bf62..0dbfe2f 100644 --- a/src/yuescript/yuescript.cpp +++ b/src/yuescript/yuescript.cpp @@ -99,6 +99,18 @@ static void get_config(lua_State* L, yue::YueConfig& config) { config.lax = lua_toboolean(L, -1) != 0; } lua_pop(L, 1); + lua_pushliteral(L, "line_offset"); + lua_gettable(L, -2); + if (lua_isnumber(L, -1) != 0) { + config.lineOffset = static_cast(lua_tonumber(L, -1)); + } + lua_pop(L, 1); + lua_pushliteral(L, "module"); + lua_gettable(L, -2); + if (lua_isstring(L, -1) != 0) { + config.module = lua_tostring(L, -1); + } + lua_pop(L, 1); lua_pushliteral(L, "options"); lua_gettable(L, -2); if (lua_istable(L, -1) != 0) { @@ -132,18 +144,6 @@ static int yuetolua(lua_State* L) { if (lua_isboolean(L, -1) != 0) { sameModule = lua_toboolean(L, -1) != 0; } - lua_pop(L, 1); - lua_pushliteral(L, "line_offset"); - lua_gettable(L, -2); - if (lua_isnumber(L, -1) != 0) { - config.lineOffset = static_cast(lua_tonumber(L, -1)); - } - lua_pop(L, 1); - lua_pushliteral(L, "module"); - lua_gettable(L, -2); - if (lua_isstring(L, -1) != 0) { - config.module = lua_tostring(L, -1); - } lua_pop(L, 2); } auto result = yue::YueCompiler(L, nullptr, sameModule).compile(codes, config); -- cgit v1.2.3-55-g6feb