@ -42,7 +42,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -42,7 +42,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
public CSharpConversions ( ICompilation compilation )
{
if ( compilation = = null )
throw new ArgumentNullException ( "compilation" ) ;
throw new ArgumentNullException ( nameof ( compilation ) ) ;
this . compilation = compilation ;
}
@ -53,7 +53,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -53,7 +53,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
public static CSharpConversions Get ( ICompilation compilation )
{
if ( compilation = = null )
throw new ArgumentNullException ( "compilation" ) ;
throw new ArgumentNullException ( nameof ( compilation ) ) ;
CacheManager cache = compilation . CacheManager ;
CSharpConversions operators = ( CSharpConversions ) cache . GetShared ( typeof ( CSharpConversions ) ) ;
if ( operators = = null ) {
@ -151,16 +151,16 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -151,16 +151,16 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
public Conversion ImplicitConversion ( ResolveResult resolveResult , IType toType )
{
if ( resolveResult = = null )
throw new ArgumentNullException ( "resolveResult" ) ;
throw new ArgumentNullException ( nameof ( resolveResult ) ) ;
return ImplicitConversion ( resolveResult , toType , allowUserDefined : true , allowTuple : true ) ;
}
public Conversion ImplicitConversion ( IType fromType , IType toType )
{
if ( fromType = = null )
throw new ArgumentNullException ( "fromType" ) ;
throw new ArgumentNullException ( nameof ( fromType ) ) ;
if ( toType = = null )
throw new ArgumentNullException ( "toType" ) ;
throw new ArgumentNullException ( nameof ( toType ) ) ;
TypePair pair = new TypePair ( fromType , toType ) ;
Conversion c ;
@ -176,9 +176,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -176,9 +176,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
public Conversion StandardImplicitConversion ( IType fromType , IType toType )
{
if ( fromType = = null )
throw new ArgumentNullException ( "fromType" ) ;
throw new ArgumentNullException ( nameof ( fromType ) ) ;
if ( toType = = null )
throw new ArgumentNullException ( "toType" ) ;
throw new ArgumentNullException ( nameof ( toType ) ) ;
return StandardImplicitConversion ( fromType , toType , allowTupleConversion : true ) ;
}
@ -220,9 +220,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -220,9 +220,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
public bool IsConstraintConvertible ( IType fromType , IType toType )
{
if ( fromType = = null )
throw new ArgumentNullException ( "fromType" ) ;
throw new ArgumentNullException ( nameof ( fromType ) ) ;
if ( toType = = null )
throw new ArgumentNullException ( "toType" ) ;
throw new ArgumentNullException ( nameof ( toType ) ) ;
if ( IdentityConversion ( fromType , toType ) )
return true ;
@ -247,9 +247,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -247,9 +247,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
public Conversion ExplicitConversion ( ResolveResult resolveResult , IType toType )
{
if ( resolveResult = = null )
throw new ArgumentNullException ( "resolveResult" ) ;
throw new ArgumentNullException ( nameof ( resolveResult ) ) ;
if ( toType = = null )
throw new ArgumentNullException ( "toType" ) ;
throw new ArgumentNullException ( nameof ( toType ) ) ;
if ( resolveResult . Type . Kind = = TypeKind . Dynamic )
return Conversion . ExplicitDynamicConversion ;
@ -270,9 +270,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -270,9 +270,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
public Conversion ExplicitConversion ( IType fromType , IType toType )
{
if ( fromType = = null )
throw new ArgumentNullException ( "fromType" ) ;
throw new ArgumentNullException ( nameof ( fromType ) ) ;
if ( toType = = null )
throw new ArgumentNullException ( "toType" ) ;
throw new ArgumentNullException ( nameof ( toType ) ) ;
Conversion c = ImplicitConversion ( fromType , toType , allowUserDefined : false , allowTuple : false ) ;
if ( c ! = Conversion . None )
@ -861,13 +861,11 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -861,13 +861,11 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
return other ;
}
return selected ;
}
else if ( NullableType . IsNullable ( toType ) )
} else if ( NullableType . IsNullable ( toType ) )
return UserDefinedImplicitConversion ( fromResult , fromType , NullableType . GetUnderlyingType ( toType ) ) ;
else
return Conversion . None ;
}
else {
} else {
return Conversion . None ;
}
}
@ -913,15 +911,13 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -913,15 +911,13 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
return other ;
}
return selected ;
}
else if ( NullableType . IsNullable ( toType ) )
} else if ( NullableType . IsNullable ( toType ) )
return UserDefinedExplicitConversion ( fromResult , fromType , NullableType . GetUnderlyingType ( toType ) ) ;
else if ( NullableType . IsNullable ( fromType ) )
return UserDefinedExplicitConversion ( null , NullableType . GetUnderlyingType ( fromType ) , toType ) ; // A? -> A -> B
else
return Conversion . None ;
}
else {
} else {
return Conversion . None ;
}
}
@ -1106,9 +1102,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -1106,9 +1102,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
public bool IsDelegateCompatible ( IMethod method , IType delegateType )
{
if ( method = = null )
throw new ArgumentNullException ( "method" ) ;
throw new ArgumentNullException ( nameof ( method ) ) ;
if ( delegateType = = null )
throw new ArgumentNullException ( "delegateType" ) ;
throw new ArgumentNullException ( nameof ( delegateType ) ) ;
IMethod invoke = delegateType . GetDelegateInvokeMethod ( ) ;
if ( invoke = = null )
return false ;
@ -1126,9 +1122,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -1126,9 +1122,9 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
bool IsDelegateCompatible ( IMethod m , IMethod invoke , bool isExtensionMethodInvocation )
{
if ( m = = null )
throw new ArgumentNullException ( "m" ) ;
throw new ArgumentNullException ( nameof ( m ) ) ;
if ( invoke = = null )
throw new ArgumentNullException ( "invoke" ) ;
throw new ArgumentNullException ( nameof ( invoke ) ) ;
int firstParameterInM = isExtensionMethodInvocation ? 1 : 0 ;
if ( m . Parameters . Count - firstParameterInM ! = invoke . Parameters . Count )
return false ;