Tencent / xLua

xLua is a lua programming solution for C# ( Unity, .Net, Mono) , it supports android, ios, windows, linux, osx, etc.
Other
9.43k stars 2.46k forks source link

"Using indexers" of C# does not work #1165

Open waytoeden opened 2 months ago

waytoeden commented 2 months ago
var setter = prop.GetSetMethod();
if (setter != null && setter.IsPublic)
{
    if (prop.GetIndexParameters().Length > 0)
    {
        if (!prop.GetIndexParameters()[0].ParameterType.IsAssignableFrom(typeof(string)))
        {
            itemSetter.Add(setter);
        }
    }
    else
    {
        emitRegisterFunc(il, emitPropertyWrap(wrapTypeBuilder, prop, setter, false), Utils.SETTER_IDX, prop.Name);
    }
}

Request for modification as below , also getter

var setter = prop.GetSetMethod();
if (setter != null && setter.IsPublic)
{
    if (prop.GetIndexParameters().Length > 0)
    {
        if (prop.GetIndexParameters()[0].ParameterType.IsAssignableFrom(typeof(string)))
        {
            itemSetter.Add(setter);
        }
    }
    else
    {
        emitRegisterFunc(il, emitPropertyWrap(wrapTypeBuilder, prop, setter, false), Utils.SETTER_IDX, prop.Name);
    }
}