xLua icon indicating copy to clipboard operation
xLua copied to clipboard

Generator 对于 System.Reflection 中的匿名委托生成了错误代码

Open jezzychao opened this issue 3 years ago • 1 comments

问题出现版本:Tag:v2.1.16 操作:将 ExampleConfig 中的注释全部打开,然后点击生成代码按钮,错误如下。

public <>f__AnonymousType1<System.Type, System.Reflection.MethodInfo> __Gen_Delegate_Imp52(System.Type p0, System.Reflection.MethodInfo p1)
{
#if THREAD_SAFE || HOTFIX_ENABLE
            lock (luaEnv.luaEnvLock)
            {
#endif
                RealStatePtr L = luaEnv.rawL;
                int errFunc = LuaAPI.pcall_prepare(L, errorFuncRef, luaReference);
                ObjectTranslator translator = luaEnv.translator;
                translator.Push(L, p0);
                translator.Push(L, p1);
                
                PCall(L, 2, 1, errFunc);
                
                
                <>f__AnonymousType1<System.Type, System.Reflection.MethodInfo> __gen_ret = (<>f__AnonymousType1<System.Type, System.Reflection.MethodInfo>)translator.GetObject(L, errFunc + 1, typeof(<>f__AnonymousType1<System.Type, System.Reflection.MethodInfo>));
                LuaAPI.lua_settop(L, errFunc - 1);
                return  __gen_ret;
#if THREAD_SAFE || HOTFIX_ENABLE
            }
#endif
}

jezzychao avatar Nov 05 '22 16:11 jezzychao

ExampleConfig是个配置示例,里头可以加上版本特定的过滤规则

chexiongsheng avatar Nov 07 '22 07:11 chexiongsheng