CS: Fix enumeration scoping on default field values (CS0103)
This commit is contained in:
@@ -390,7 +390,7 @@ namespace Il2CppInspector.Outputs
|
||||
else
|
||||
sb.Append($"{field.FieldType.GetScopedCSharpName(scope)} {field.CSharpSafeName}");
|
||||
if (field.HasDefaultValue)
|
||||
sb.Append($" = {field.DefaultValueString}");
|
||||
sb.Append($" = {field.GetDefaultValueString(scope)}");
|
||||
sb.Append(";");
|
||||
// Don't output field indices for const fields (they don't have any storage)
|
||||
// or open generic types (they aren't known until runtime)
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Il2CppInspector.Reflection {
|
||||
public bool HasDefaultValue => (Attributes & FieldAttributes.HasDefault) != 0;
|
||||
public object DefaultValue { get; }
|
||||
|
||||
public string DefaultValueString => HasDefaultValue ? DefaultValue.ToCSharpValue(FieldType) : "";
|
||||
public string GetDefaultValueString(Scope usingScope = null) => HasDefaultValue ? DefaultValue.ToCSharpValue(FieldType, usingScope) : "";
|
||||
|
||||
// Information/flags about the field
|
||||
public FieldAttributes Attributes { get; }
|
||||
|
||||
Reference in New Issue
Block a user