Skip to content

Commit

Permalink
Merge pull request dotnet#37751 from steveharter/PropertyPolicy
Browse files Browse the repository at this point in the history
Change additional PropertyPolicy terminology
  • Loading branch information
steveharter authored Jun 12, 2020
2 parents 3228c46 + de009f5 commit 2f6457a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,17 @@ internal static JsonPropertyInfo CreatePropertyInfoForClassInfo(
JsonConverter converter,
JsonSerializerOptions options)
{
return CreateProperty(
JsonPropertyInfo jsonPropertyInfo = CreateProperty(
declaredPropertyType: declaredPropertyType,
runtimePropertyType: runtimePropertyType,
propertyInfo: null, // Not a real property so this is null.
parentClassType: typeof(object), // a dummy value (not used)
converter: converter,
options);

Debug.Assert(jsonPropertyInfo.IsForClassInfo);

return jsonPropertyInfo;
}

// AggressiveInlining used although a large method it is only called from one location and is on a hot path.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ internal abstract class JsonPropertyInfo
public static JsonPropertyInfo GetPropertyPlaceholder()
{
JsonPropertyInfo info = new JsonPropertyInfo<object>();
info.IsPropertyPolicy = false;
info.ShouldDeserialize = false;
info.ShouldSerialize = false;
Debug.Assert(!info.IsForClassInfo);
Debug.Assert(!info.ShouldDeserialize);
Debug.Assert(!info.ShouldSerialize);
return info;
}

Expand Down Expand Up @@ -195,7 +195,10 @@ public virtual void Initialize(
public bool IgnoreDefaultValuesOnRead { get; private set; }
public bool IgnoreDefaultValuesOnWrite { get; private set; }

public bool IsPropertyPolicy { get; protected set; }
/// <summary>
/// True if the corresponding cref="JsonClassInfo.PropertyInfoForClassInfo"/> is this instance.
/// </summary>
public bool IsForClassInfo { get; protected set; }

// There are 3 copies of the property name:
// 1) NameAsString. The unescaped property name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public override void Initialize(
}
else
{
IsPropertyPolicy = true;
IsForClassInfo = true;
HasGetter = true;
HasSetter = true;
}
Expand All @@ -86,7 +86,7 @@ public override JsonConverter ConverterBase

public override object? GetValueAsObject(object obj)
{
if (IsPropertyPolicy)
if (IsForClassInfo)
{
return obj;
}
Expand Down

0 comments on commit 2f6457a

Please sign in to comment.