-Clean up
This commit is contained in:
@@ -209,7 +209,6 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
User user = JsonConvert.DeserializeObject<User>("{'company':{'company_name':'Company name!'}}", new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = resolver
|
||||
|
||||
});
|
||||
|
||||
Assert.AreEqual("Company name!", user.Company.CompanyName);
|
||||
|
||||
@@ -433,7 +433,7 @@ namespace Newtonsoft.Json.Linq.JsonPath
|
||||
|
||||
if (_expression[_currentIndex] == '$')
|
||||
{
|
||||
expressionPath.Add(new RootFilter());
|
||||
expressionPath.Add(RootFilter.Instance);
|
||||
}
|
||||
else if (_expression[_currentIndex] != '@')
|
||||
{
|
||||
|
||||
@@ -4,6 +4,12 @@ namespace Newtonsoft.Json.Linq.JsonPath
|
||||
{
|
||||
internal class RootFilter : PathFilter
|
||||
{
|
||||
public static readonly RootFilter Instance = new RootFilter();
|
||||
|
||||
private RootFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch)
|
||||
{
|
||||
return root;
|
||||
|
||||
@@ -1065,7 +1065,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
|
||||
// perform scaling
|
||||
var index = scale & 15;
|
||||
int index = scale & 15;
|
||||
if (index != 0)
|
||||
{
|
||||
exp -= MultExp64Power10[index - 1] - 1;
|
||||
@@ -1089,7 +1089,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
|
||||
// perform scaling
|
||||
var index = scale & 15;
|
||||
int index = scale & 15;
|
||||
if (index != 0)
|
||||
{
|
||||
exp += MultExp64Power10[index - 1];
|
||||
@@ -1171,7 +1171,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
ulong b_hi = (b >> 32);
|
||||
uint b_lo = (uint)b;
|
||||
|
||||
var result = a_hi * b_hi;
|
||||
ulong result = a_hi * b_hi;
|
||||
|
||||
// save some multiplications if lo-parts aren't big enough to produce carry
|
||||
// (hi-parts will be always big enough, since a and b are normalized)
|
||||
@@ -1294,7 +1294,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return ParseResult.Invalid;
|
||||
}
|
||||
|
||||
var newExponent = (10 * exponent) + (c - '0');
|
||||
int newExponent = (10 * exponent) + (c - '0');
|
||||
// stops updating exponent when overflowing
|
||||
if (exponent < newExponent)
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
case DateTimeKind.Utc:
|
||||
return XmlDateTimeSerializationMode.Utc;
|
||||
default:
|
||||
throw MiscellaneousUtils.CreateArgumentOutOfRangeException("kind", kind, "Unexpected DateTimeKind value.");
|
||||
throw MiscellaneousUtils.CreateArgumentOutOfRangeException(nameof(kind), kind, "Unexpected DateTimeKind value.");
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -85,7 +85,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
case DateTimeKind.Utc:
|
||||
return "yyyy-MM-ddTHH:mm:ss.FFFFFFFZ";
|
||||
default:
|
||||
throw new Exception("Unexpected DateTimeKind value.");
|
||||
throw MiscellaneousUtils.CreateArgumentOutOfRangeException(nameof(kind), kind, "Unexpected DateTimeKind value.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -170,7 +170,8 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
if (binder != null)
|
||||
{
|
||||
string assemblyName, typeName;
|
||||
string assemblyName;
|
||||
string typeName;
|
||||
binder.BindToName(t, out assemblyName, out typeName);
|
||||
#if (NET20 || NET35)
|
||||
// for older SerializationBinder implementations that didn't have BindToName
|
||||
|
||||
Reference in New Issue
Block a user