Skip to content

Commit 6b6a2b3

Browse files
authored
Filter the use of pointers that are not supported. (Tencent#892)
1 parent 2c1c80f commit 6b6a2b3

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Assets/XLua/Src/Editor/Generator.cs

+2
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,8 @@ static void GenDelegateBridge(IEnumerable<Type> types, string save_path, IEnumer
940940
.Where(method => !ignoreCompilerGenerated || !isDefined(method, typeof(CompilerGeneratedAttribute)))
941941
.Where(method => !ignoreNotPublic || method.IsPublic)
942942
.Where(method => !ignoreProperty || !method.IsSpecialName || (!method.Name.StartsWith("get_") && !method.Name.StartsWith("set_")))
943+
.Where(method => !method.GetParameters().Any(pInfo => pInfo.ParameterType.IsPointer))
944+
.Where(method => !method.ReturnType.IsPointer)
943945
.Cast<MethodBase>()
944946
.Concat(kv.Key.GetConstructors(bindingAttrOfConstructor).Cast<MethodBase>())
945947
.Where(method => !injectByGeneric(method, kv.Value))

Assets/XLua/Src/Editor/Hotfix.cs

+8
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,10 @@ public bool InjectType(TypeReference hotfixAttributeType, TypeDefinition type)
737737
{
738738
continue;
739739
}
740+
if (method.Parameters.Any(pd => pd.ParameterType.IsPointer) || method.ReturnType.IsPointer)
741+
{
742+
continue;
743+
}
740744
if (method.Name != ".cctor" && !method.IsAbstract && !method.IsPInvokeImpl && method.Body != null && !method.Name.Contains("<"))
741745
{
742746
//Debug.Log(method);
@@ -766,6 +770,10 @@ public bool InjectType(TypeReference hotfixAttributeType, TypeDefinition type)
766770
{
767771
continue;
768772
}
773+
if (method.Parameters.Any(pd => pd.ParameterType.IsPointer) || method.ReturnType.IsPointer)
774+
{
775+
continue;
776+
}
769777
if (method.Name != ".cctor" && !method.IsAbstract && !method.IsPInvokeImpl && method.Body != null && !method.Name.Contains("<"))
770778
{
771779
var proxyMethod = tryAddBaseProxy(type, method);

0 commit comments

Comments
 (0)