-Added missing casts to JToken

-Upgraded to Immutable Collections RC
-Tests
This commit is contained in:
James Newton-King
2013-09-13 20:15:30 +12:00
parent 4922c4eedc
commit 5512e2623c
27 changed files with 4688 additions and 12022 deletions
@@ -63,6 +63,7 @@ namespace Newtonsoft.Json.Serialization
private MethodCall<object, object> _genericWrapperCreator;
private Func<object> _genericTemporaryCollectionCreator;
internal bool IsArray { get; private set; }
internal bool ShouldCreateWrapper { get; private set; }
internal bool CanDeserialize { get; private set; }
internal MethodBase ParametrizedConstructor { get; private set; }
@@ -75,18 +76,19 @@ namespace Newtonsoft.Json.Serialization
: base(underlyingType)
{
ContractType = JsonContractType.Array;
IsArray = CreatedType.IsArray;
bool canDeserialize;
Type tempCollectionType;
if (CreatedType.IsArray)
if (IsArray)
{
CollectionItemType = ReflectionUtils.GetCollectionItemType(UnderlyingType);
IsReadOnlyOrFixedSize = true;
_genericCollectionDefinitionType = typeof(List<>).MakeGenericType(CollectionItemType);
canDeserialize = true;
IsMultidimensionalArray = (UnderlyingType.IsArray && UnderlyingType.GetArrayRank() > 1);
IsMultidimensionalArray = (IsArray && UnderlyingType.GetArrayRank() > 1);
}
else if (typeof(IList).IsAssignableFrom(underlyingType))
{
@@ -179,7 +181,7 @@ namespace Newtonsoft.Json.Serialization
// wrapper will handle calling Add(T) instead
if (_isCollectionItemTypeNullableType
&& (ReflectionUtils.InheritsGenericDefinition(CreatedType, typeof(List<>), out tempCollectionType)
|| (CreatedType.IsArray && !IsMultidimensionalArray)))
|| (IsArray && !IsMultidimensionalArray)))
{
ShouldCreateWrapper = true;
}