From d0e9ce023ba1e5667b3177521fa37c4b735473d2 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Fri, 16 Sep 2011 20:28:29 +0200 Subject: [PATCH] CodeDomConvertVisitor: choose between CodeIndexerExpression and CodeArrayIndexerExpression. DefaultParameter: fixed bug in interning - two parameters with different names were considered equal for interning. --- .../OutputVisitor/CodeDomConvertVisitor.cs | 5 ++++- .../TypeSystem/Implementation/DefaultParameter.cs | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs b/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs index 9cba2eb955..eb82b1981c 100644 --- a/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs @@ -395,7 +395,10 @@ namespace ICSharpCode.NRefactory.CSharp CodeObject IAstVisitor.VisitIndexerExpression(IndexerExpression indexerExpression, object data) { - return new CodeArrayIndexerExpression(Convert(indexerExpression.Target), Convert(indexerExpression.Arguments)); + if (Resolve(indexerExpression) is ArrayAccessResolveResult) + return new CodeArrayIndexerExpression(Convert(indexerExpression.Target), Convert(indexerExpression.Arguments)); + else + return new CodeIndexerExpression(Convert(indexerExpression.Target), Convert(indexerExpression.Arguments)); } CodeObject IAstVisitor.VisitInvocationExpression(InvocationExpression invocationExpression, object data) diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultParameter.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultParameter.cs index 1c41fa577a..97818b4a64 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultParameter.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultParameter.cs @@ -155,13 +155,15 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation int ISupportsInterning.GetHashCodeForInterning() { - return type.GetHashCode() ^ (attributes != null ? attributes.GetHashCode() : 0) ^ (defaultValue != null ? defaultValue.GetHashCode() : 0); + return type.GetHashCode() ^ name.GetHashCode() + ^ (attributes != null ? attributes.GetHashCode() : 0) + ^ (defaultValue != null ? defaultValue.GetHashCode() : 0); } bool ISupportsInterning.EqualsForInterning(ISupportsInterning other) { DefaultParameter p = other as DefaultParameter; - return p != null && type == p.type && attributes == p.attributes + return p != null && type == p.type && attributes == p.attributes && name == p.name && defaultValue == p.defaultValue && region == p.region && flags == p.flags; }