|
|
|
@ -28,6 +28,7 @@ using System.Linq;
@@ -28,6 +28,7 @@ using System.Linq;
|
|
|
|
|
using ICSharpCode.NRefactory.PatternMatching; |
|
|
|
|
using System.Threading; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using ICSharpCode.NRefactory.TypeSystem; |
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.NRefactory.CSharp.Refactoring |
|
|
|
|
{ |
|
|
|
@ -65,10 +66,12 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
@@ -65,10 +66,12 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
|
|
|
|
|
{ |
|
|
|
|
var result = context.GetNode<VariableDeclarationStatement> (); |
|
|
|
|
if (result != null && result.Variables.Count == 1 && !result.Variables.First ().Initializer.IsNull && result.Variables.First ().NameToken.Contains (context.Location.Line, context.Location.Column)) { |
|
|
|
|
resolvedType = result.Type.Clone (); |
|
|
|
|
// resolvedType = context.Resolve (result.Variables.First ().Initializer).Type.ConvertToAstType ();
|
|
|
|
|
// if (resolvedType == null)
|
|
|
|
|
// return null;
|
|
|
|
|
var type = context.Resolve(result.Variables.First ().Initializer).Type; |
|
|
|
|
if (type.Equals(SpecialType.NullType) || type.Equals(SpecialType.UnknownType)) { |
|
|
|
|
resolvedType = new PrimitiveType ("object"); |
|
|
|
|
} else { |
|
|
|
|
resolvedType = context.CreateShortType (type); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
resolvedType = null; |
|
|
|
|