Browse Source

CodeDomConvertVisitor: choose between CodeIndexerExpression and CodeArrayIndexerExpression.

DefaultParameter: fixed bug in interning - two parameters with different names were considered equal for interning.
newNRvisualizers
Daniel Grunwald 14 years ago
parent
commit
d0e9ce023b
  1. 5
      ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs
  2. 6
      ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultParameter.cs

5
ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs

@ -395,7 +395,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -395,7 +395,10 @@ namespace ICSharpCode.NRefactory.CSharp
CodeObject IAstVisitor<object, CodeObject>.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<object, CodeObject>.VisitInvocationExpression(InvocationExpression invocationExpression, object data)

6
ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultParameter.cs

@ -155,13 +155,15 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -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;
}

Loading…
Cancel
Save