diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuescript/yue_compiler.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 446414d..e7fe0c0 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
| @@ -24,7 +24,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI | |||
| 24 | 24 | ||
| 25 | extern "C" { | 25 | extern "C" { |
| 26 | #include "lauxlib.h" | 26 | #include "lauxlib.h" |
| 27 | #include "lparser.h" | ||
| 28 | #include "lua.h" | 27 | #include "lua.h" |
| 29 | #include "lualib.h" | 28 | #include "lualib.h" |
| 30 | } // extern "C" | 29 | } // extern "C" |
| @@ -76,7 +75,7 @@ static std::unordered_set<std::string> Metamethods = { | |||
| 76 | "close"s // Lua 5.4 | 75 | "close"s // Lua 5.4 |
| 77 | }; | 76 | }; |
| 78 | 77 | ||
| 79 | const std::string_view version = "0.26.3"sv; | 78 | const std::string_view version = "0.27.0"sv; |
| 80 | const std::string_view extension = "yue"sv; | 79 | const std::string_view extension = "yue"sv; |
| 81 | 80 | ||
| 82 | class CompileError : public std::logic_error { | 81 | class CompileError : public std::logic_error { |
| @@ -6567,17 +6566,10 @@ private: | |||
| 6567 | if (luaL_loadbuffer(L, codes.c_str(), codes.size(), macroChunk.c_str()) != 0) { | 6566 | if (luaL_loadbuffer(L, codes.c_str(), codes.size(), macroChunk.c_str()) != 0) { |
| 6568 | std::string err = lua_tostring(L, -1); | 6567 | std::string err = lua_tostring(L, -1); |
| 6569 | throw CompileError("lua macro is not expanding to valid block\n"s + err, x); | 6568 | throw CompileError("lua macro is not expanding to valid block\n"s + err, x); |
| 6570 | } else { | ||
| 6571 | Proto* f = ((LClosure*)lua_topointer(L, -1))->p; | ||
| 6572 | for (int i = 0; i < f->sizelocvars; i++) { | ||
| 6573 | localVars.push_back(getstr(f->locvars[i].varname)); | ||
| 6574 | } | ||
| 6575 | } | 6569 | } |
| 6576 | if (!codes.empty()) { | 6570 | if (!codes.empty()) { |
| 6577 | if (_config.reserveLineNumber) { | 6571 | codes.insert(0, indent() + "do"s + nll(chainValue)); |
| 6578 | codes.insert(0, nll(chainValue).substr(1)); | 6572 | codes.append(_newLine + indent() + "end"s + nlr(chainValue)); |
| 6579 | } | ||
| 6580 | codes.append(nlr(chainValue)); | ||
| 6581 | } | 6573 | } |
| 6582 | return {nullptr, nullptr, std::move(codes), std::move(localVars)}; | 6574 | return {nullptr, nullptr, std::move(codes), std::move(localVars)}; |
| 6583 | } else { | 6575 | } else { |
