Model: Move parameter string generation to ParameterInfo
This commit is contained in:
@@ -159,10 +159,7 @@ namespace Il2CppInspector.Reflection
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get C# syntax-friendly list of parameters
|
// Get C# syntax-friendly list of parameters
|
||||||
public string GetParametersString() =>
|
public string GetParametersString() => string.Join(", ", DeclaredParameters.Select(p => p.GetParameterString()));
|
||||||
string.Join(", ", DeclaredParameters.Select(p => $"{p.CustomAttributes.ToString(inline: true).Replace("[ParamArray]", "params")}"
|
|
||||||
+ $"{p.GetModifierString()}{p.ParameterType.CSharpName} {p.Name}"
|
|
||||||
+ (p.HasDefaultValue? " = " + p.DefaultValue.ToCSharpValue() : "")));
|
|
||||||
|
|
||||||
public string GetTypeParametersString() => GenericTypeParameters == null? "" :
|
public string GetTypeParametersString() => GenericTypeParameters == null? "" :
|
||||||
"<" + string.Join(", ", GenericTypeParameters.Select(p => p.CSharpName)) + ">";
|
"<" + string.Join(", ", GenericTypeParameters.Select(p => p.CSharpName)) + ">";
|
||||||
|
|||||||
@@ -91,5 +91,13 @@ namespace Il2CppInspector.Reflection
|
|||||||
(IsIn ? "in " : "")
|
(IsIn ? "in " : "")
|
||||||
+ (IsByRef? "ref " : "")
|
+ (IsByRef? "ref " : "")
|
||||||
+ (IsOut? "out " : "");
|
+ (IsOut? "out " : "");
|
||||||
|
|
||||||
|
public string GetParameterString() => IsRetval? null :
|
||||||
|
$"{CustomAttributes.ToString(inline: true).Replace("[ParamArray]", "params")}"
|
||||||
|
+ $"{GetModifierString()}{ParameterType.CSharpName} {Name}"
|
||||||
|
+ (HasDefaultValue ? " = " + DefaultValue.ToCSharpValue() : "");
|
||||||
|
|
||||||
|
public string GetReturnParameterString() => !IsRetval? null :
|
||||||
|
$"{GetModifierString()}{ParameterType.CSharpName}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user