Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ds5678 committed Jul 12, 2024
1 parent 5f2ecd1 commit 81c665a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
12 changes: 6 additions & 6 deletions Il2CppInterop.Generator/Passes/Pass40GenerateFieldAccessors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public static void DoPass(RewriteGlobalContext context)
!fieldContext.OriginalField.IsStatic) continue;

var field = fieldContext.OriginalField;
var unmangleFieldName = fieldContext.UnmangledName;

var propertyType = assemblyContext.RewriteTypeRef(fieldContext.OriginalField.Signature!.FieldType);
var signature = field.IsStatic
? PropertySignature.CreateStatic(propertyType)
: PropertySignature.CreateInstance(propertyType);
var unmangleFieldName = fieldContext.UnmangledName;

var propertyType = assemblyContext.RewriteTypeRef(fieldContext.OriginalField.Signature!.FieldType);
var signature = field.IsStatic
? PropertySignature.CreateStatic(propertyType)
: PropertySignature.CreateInstance(propertyType);
var property = new PropertyDefinition(unmangleFieldName, PropertyAttributes.None, signature);
typeContext.NewType.Properties.Add(property);

Expand Down
62 changes: 31 additions & 31 deletions Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,37 +96,37 @@ private static string UnmanglePropertyName(AssemblyRewriteContext assemblyContex
return unmanglePropertyName;
}

private static void FixPropertyDefinitionParameters(PropertyDefinition property)
private static void FixPropertyDefinitionParameters(PropertyDefinition property)
{
// See: https://github.com/SamboyCoding/Cpp2IL/issues/249

if (property.Signature is null or { ParameterTypes.Count: > 0 })
return;

var getMethod = property.GetMethod;
if (getMethod?.Signature is not null)
{
if (getMethod.Signature.ParameterTypes.Count > 0)
{
foreach (var parameter in getMethod.Signature.ParameterTypes)
{
property.Signature.ParameterTypes.Add(parameter);
}
}

return;
}

var setMethod = property.SetMethod;
if (setMethod?.Signature is not null)
{
if (setMethod.Signature.ParameterTypes.Count > 1)
{
foreach (var parameter in setMethod.Signature.ParameterTypes.Take(setMethod.Signature.ParameterTypes.Count - 1))
{
property.Signature.ParameterTypes.Add(parameter);
}
}
}
// See: https://github.com/SamboyCoding/Cpp2IL/issues/249

if (property.Signature is null or { ParameterTypes.Count: > 0 })
return;

var getMethod = property.GetMethod;
if (getMethod?.Signature is not null)
{
if (getMethod.Signature.ParameterTypes.Count > 0)
{
foreach (var parameter in getMethod.Signature.ParameterTypes)
{
property.Signature.ParameterTypes.Add(parameter);
}
}

return;
}

var setMethod = property.SetMethod;
if (setMethod?.Signature is not null)
{
if (setMethod.Signature.ParameterTypes.Count > 1)
{
foreach (var parameter in setMethod.Signature.ParameterTypes.Take(setMethod.Signature.ParameterTypes.Count - 1))
{
property.Signature.ParameterTypes.Add(parameter);
}
}
}
}
}

0 comments on commit 81c665a

Please sign in to comment.