diff options
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 2a3cb8c..f4e1102 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
@@ -4035,7 +4035,7 @@ private: | |||
4035 | } | 4035 | } |
4036 | #else | 4036 | #else |
4037 | void transformMacro(Macro_t* macro, str_list&, bool) { | 4037 | void transformMacro(Macro_t* macro, str_list&, bool) { |
4038 | throw CompileError("macro feature not supported"sv, macro)); | 4038 | throw CompileError("macro feature not supported"sv, macro); |
4039 | } | 4039 | } |
4040 | #endif // YUE_NO_MACRO | 4040 | #endif // YUE_NO_MACRO |
4041 | 4041 | ||
@@ -4949,7 +4949,7 @@ private: | |||
4949 | 4949 | ||
4950 | void transformMacroInPlace(MacroInPlace_t* macroInPlace) { | 4950 | void transformMacroInPlace(MacroInPlace_t* macroInPlace) { |
4951 | #ifdef YUE_NO_MACRO | 4951 | #ifdef YUE_NO_MACRO |
4952 | throw CompileError("macro feature not supported"sv, macroInPlace)); | 4952 | throw CompileError("macro feature not supported"sv, macroInPlace); |
4953 | #else // YUE_NO_MACRO | 4953 | #else // YUE_NO_MACRO |
4954 | auto x = macroInPlace; | 4954 | auto x = macroInPlace; |
4955 | pushCurrentModule(); // cur | 4955 | pushCurrentModule(); // cur |
@@ -5304,7 +5304,7 @@ private: | |||
5304 | return; | 5304 | return; |
5305 | #else | 5305 | #else |
5306 | (void)allowBlockMacroReturn; | 5306 | (void)allowBlockMacroReturn; |
5307 | throw CompileError("macro feature not supported"sv, chainValue)); | 5307 | throw CompileError("macro feature not supported"sv, chainValue); |
5308 | #endif // YUE_NO_MACRO | 5308 | #endif // YUE_NO_MACRO |
5309 | } | 5309 | } |
5310 | const auto& chainList = chainValue->items.objects(); | 5310 | const auto& chainList = chainValue->items.objects(); |
@@ -8139,7 +8139,7 @@ private: | |||
8139 | case id<MacroName_t>(): | 8139 | case id<MacroName_t>(): |
8140 | case id<MacroNamePair_t>(): | 8140 | case id<MacroNamePair_t>(): |
8141 | case id<ImportAllMacro_t>(): { | 8141 | case id<ImportAllMacro_t>(): { |
8142 | throw CompileError("macro feature not supported"sv, item)); | 8142 | throw CompileError("macro feature not supported"sv, item); |
8143 | break; | 8143 | break; |
8144 | } | 8144 | } |
8145 | #else // YUE_NO_MACRO | 8145 | #else // YUE_NO_MACRO |
@@ -8241,7 +8241,7 @@ private: | |||
8241 | } | 8241 | } |
8242 | #else // YUE_NO_MACRO | 8242 | #else // YUE_NO_MACRO |
8243 | if (importAllMacro) { | 8243 | if (importAllMacro) { |
8244 | throw CompileError("macro feature not supported"sv, import->target)); | 8244 | throw CompileError("macro feature not supported"sv, import->target); |
8245 | } | 8245 | } |
8246 | #endif // YUE_NO_MACRO | 8246 | #endif // YUE_NO_MACRO |
8247 | if (newTab->items.empty()) { | 8247 | if (newTab->items.empty()) { |
@@ -8891,10 +8891,14 @@ CompileInfo YueCompiler::compile(std::string_view codes, const YueConfig& config | |||
8891 | } | 8891 | } |
8892 | 8892 | ||
8893 | void YueCompiler::clear(void* luaState) { | 8893 | void YueCompiler::clear(void* luaState) { |
8894 | #ifndef YUE_NO_MACRO | ||
8894 | auto L = static_cast<lua_State*>(luaState); | 8895 | auto L = static_cast<lua_State*>(luaState); |
8895 | lua_pushliteral(L, YUE_MODULE); // YUE_MODULE | 8896 | lua_pushliteral(L, YUE_MODULE); // YUE_MODULE |
8896 | lua_pushnil(L); | 8897 | lua_pushnil(L); |
8897 | lua_rawset(L, LUA_REGISTRYINDEX); // reg[YUE_MODULE] = nil | 8898 | lua_rawset(L, LUA_REGISTRYINDEX); // reg[YUE_MODULE] = nil |
8899 | #else | ||
8900 | (void)(luaState); | ||
8901 | #endif // YUE_NO_MACRO | ||
8898 | } | 8902 | } |
8899 | 8903 | ||
8900 | } // namespace yue | 8904 | } // namespace yue |