|
|
@ -25,6 +25,8 @@ |
|
|
|
// THE SOFTWARE.
|
|
|
|
// THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
|
|
|
|
using ICSharpCode.NRefactory.CSharp.Resolver; |
|
|
|
|
|
|
|
using ICSharpCode.NRefactory.Semantics; |
|
|
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.NRefactory.CSharp.Refactoring |
|
|
|
namespace ICSharpCode.NRefactory.CSharp.Refactoring |
|
|
|
{ |
|
|
|
{ |
|
|
@ -42,9 +44,11 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring |
|
|
|
|
|
|
|
|
|
|
|
class GatherVisitor : GatherVisitorBase |
|
|
|
class GatherVisitor : GatherVisitorBase |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
static CSharpConversions conversion; |
|
|
|
public GatherVisitor (BaseRefactoringContext ctx) |
|
|
|
public GatherVisitor (BaseRefactoringContext ctx) |
|
|
|
: base (ctx) |
|
|
|
: base (ctx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
conversion = new CSharpConversions(ctx.Compilation); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override void VisitIsExpression (IsExpression isExpression) |
|
|
|
public override void VisitIsExpression (IsExpression isExpression) |
|
|
@ -54,8 +58,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring |
|
|
|
var type = ctx.Resolve (isExpression.Expression).Type; |
|
|
|
var type = ctx.Resolve (isExpression.Expression).Type; |
|
|
|
var providedType = ctx.ResolveType (isExpression.Type); |
|
|
|
var providedType = ctx.ResolveType (isExpression.Type); |
|
|
|
|
|
|
|
|
|
|
|
if (TypeCompatibilityHelper.CheckTypeCompatibility (type, providedType) != |
|
|
|
var foundConversion = conversion.ImplicitConversion(type, providedType); |
|
|
|
TypeCompatibilityHelper.TypeCompatiblity.AlwaysOfProvidedType) |
|
|
|
if (foundConversion == Conversion.None) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
var action = new CodeAction (ctx.TranslateString ("Compare with 'null'"), |
|
|
|
var action = new CodeAction (ctx.TranslateString ("Compare with 'null'"), |
|
|
|