Skip to content

Commit 6c3f693

Browse files
committed
Fixed yue.check missed the module options issue.
1 parent 29db607 commit 6c3f693

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/yuescript/yue_compiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static std::unordered_set<std::string> Metamethods = {
7878
"close"s // Lua 5.4
7979
};
8080

81-
const std::string_view version = "0.33.7"sv;
81+
const std::string_view version = "0.33.8"sv;
8282
const std::string_view extension = "yue"sv;
8383

8484
class CompileError : public std::logic_error {

src/yuescript/yuescript.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ static void get_config(lua_State* L, yue::YueConfig& config) {
9999
config.lax = lua_toboolean(L, -1) != 0;
100100
}
101101
lua_pop(L, 1);
102+
lua_pushliteral(L, "line_offset");
103+
lua_gettable(L, -2);
104+
if (lua_isnumber(L, -1) != 0) {
105+
config.lineOffset = static_cast<int>(lua_tonumber(L, -1));
106+
}
107+
lua_pop(L, 1);
108+
lua_pushliteral(L, "module");
109+
lua_gettable(L, -2);
110+
if (lua_isstring(L, -1) != 0) {
111+
config.module = lua_tostring(L, -1);
112+
}
113+
lua_pop(L, 1);
102114
lua_pushliteral(L, "options");
103115
lua_gettable(L, -2);
104116
if (lua_istable(L, -1) != 0) {
@@ -132,18 +144,6 @@ static int yuetolua(lua_State* L) {
132144
if (lua_isboolean(L, -1) != 0) {
133145
sameModule = lua_toboolean(L, -1) != 0;
134146
}
135-
lua_pop(L, 1);
136-
lua_pushliteral(L, "line_offset");
137-
lua_gettable(L, -2);
138-
if (lua_isnumber(L, -1) != 0) {
139-
config.lineOffset = static_cast<int>(lua_tonumber(L, -1));
140-
}
141-
lua_pop(L, 1);
142-
lua_pushliteral(L, "module");
143-
lua_gettable(L, -2);
144-
if (lua_isstring(L, -1) != 0) {
145-
config.module = lua_tostring(L, -1);
146-
}
147147
lua_pop(L, 2);
148148
}
149149
auto result = yue::YueCompiler(L, nullptr, sameModule).compile(codes, config);

0 commit comments

Comments
 (0)