diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-03-02 18:21:40 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-03-02 18:21:40 +0800 |
| commit | 6c3f69309a9b4b24c1af8d43a28e2c53a0e7d560 (patch) | |
| tree | 5e3baa329799944c361c3a559ad5a225d269191c /src | |
| parent | 29db60797bd74656b57a0f20778c76adc78095ac (diff) | |
| download | yuescript-6c3f69309a9b4b24c1af8d43a28e2c53a0e7d560.tar.gz yuescript-6c3f69309a9b4b24c1af8d43a28e2c53a0e7d560.tar.bz2 yuescript-6c3f69309a9b4b24c1af8d43a28e2c53a0e7d560.zip | |
Fixed `yue.check` missed the module options issue.v0.33.8
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 | ||||
| -rw-r--r-- | src/yuescript/yuescript.cpp | 24 |
2 files changed, 13 insertions, 13 deletions
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<std::string> Metamethods = { | |||
| 78 | "close"s // Lua 5.4 | 78 | "close"s // Lua 5.4 |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | const std::string_view version = "0.33.7"sv; | 81 | const std::string_view version = "0.33.8"sv; |
| 82 | const std::string_view extension = "yue"sv; | 82 | const std::string_view extension = "yue"sv; |
| 83 | 83 | ||
| 84 | class CompileError : public std::logic_error { | 84 | 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) { | |||
| 99 | config.lax = lua_toboolean(L, -1) != 0; | 99 | config.lax = lua_toboolean(L, -1) != 0; |
| 100 | } | 100 | } |
| 101 | lua_pop(L, 1); | 101 | 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); | ||
| 102 | lua_pushliteral(L, "options"); | 114 | lua_pushliteral(L, "options"); |
| 103 | lua_gettable(L, -2); | 115 | lua_gettable(L, -2); |
| 104 | if (lua_istable(L, -1) != 0) { | 116 | if (lua_istable(L, -1) != 0) { |
| @@ -132,18 +144,6 @@ static int yuetolua(lua_State* L) { | |||
| 132 | if (lua_isboolean(L, -1) != 0) { | 144 | if (lua_isboolean(L, -1) != 0) { |
| 133 | sameModule = lua_toboolean(L, -1) != 0; | 145 | sameModule = lua_toboolean(L, -1) != 0; |
| 134 | } | 146 | } |
| 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 | } | ||
| 147 | lua_pop(L, 2); | 147 | lua_pop(L, 2); |
| 148 | } | 148 | } |
| 149 | auto result = yue::YueCompiler(L, nullptr, sameModule).compile(codes, config); | 149 | auto result = yue::YueCompiler(L, nullptr, sameModule).compile(codes, config); |
