From 35cf4c9b57f1e1d1c07629cf16725b5487d60a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Tue, 26 Feb 2013 11:32:32 +0100 Subject: [PATCH] Cleaned up code. --- .../CodeActions/CreateClassDeclarationAction.cs | 11 +++++------ .../Refactoring/CodeActions/CreateFieldAction.cs | 2 -- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateClassDeclarationAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateClassDeclarationAction.cs index f63e0ee212..8f98e54ee3 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateClassDeclarationAction.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateClassDeclarationAction.cs @@ -61,7 +61,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring if (service != null && !service.IsValidName(resolveResult.Identifier, AffectedEntity.Class)) { yield break; } - ClassType classType = GuessClassTypeByName(context, node); + ClassType classType = GuessClassTypeByName(service, node); ModifyClassTypeBasedOnTypeGuessing(context, node, ref classType); string message; @@ -103,9 +103,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring } } - static ClassType GuessClassTypeByName(RefactoringContext context, string identifier) + static ClassType GuessClassTypeByName(NamingConventionService service, string identifier) { - var service = (NamingConventionService)context.GetService (typeof (NamingConventionService)); if (service == null) return ClassType.Class; if (service.IsValidName (identifier, AffectedEntity.Interface, Modifiers.Public)) @@ -116,12 +115,12 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return ClassType.Class; } - static ClassType GuessClassTypeByName(RefactoringContext context, AstNode node) + static ClassType GuessClassTypeByName(NamingConventionService service, AstNode node) { if (node is SimpleType) - return GuessClassTypeByName (context, ((SimpleType)node).Identifier); + return GuessClassTypeByName (service, ((SimpleType)node).Identifier); if (node is IdentifierExpression) - return GuessClassTypeByName (context, ((IdentifierExpression)node).Identifier); + return GuessClassTypeByName (service, ((IdentifierExpression)node).Identifier); return ClassType.Class; } diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateFieldAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateFieldAction.cs index 6152953e6f..332cbc5b8d 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateFieldAction.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateFieldAction.cs @@ -297,8 +297,6 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring var argumentNumber = expr.Parent.GetChildrenByRole (Roles.TypeArgument).TakeWhile (c => c != expr).Count (); var mgrr = rr as MethodGroupResolveResult; - Console.WriteLine (argumentNumber); - Console.WriteLine (mgrr.Methods.First ().TypeArguments.Count); if (mgrr != null && mgrr.Methods.Any () && mgrr.Methods.First ().TypeArguments.Count > argumentNumber) { return mgrr.Methods.First ().TypeParameters[argumentNumber]; }