Skip to content

Commit fe8e098

Browse files
committed
Fixed some FxCop warnings.
1 parent cbd5a46 commit fe8e098

49 files changed

Lines changed: 163 additions & 126 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,7 @@ public AstNode Clone ()
471471
}
472472

473473
// Finally, clone the annotation, if necessary
474-
ICloneable copiedAnnotations = copy.annotations as ICloneable; // read from copy (for thread-safety)
475-
if (copiedAnnotations != null)
476-
copy.annotations = copiedAnnotations.Clone();
474+
copy.CloneAnnotations();
477475

478476
return copy;
479477
}

ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,6 @@ public override void VisitConstructorDeclaration (ConstructorDeclaration constru
704704
}
705705
FormatCommas (constructorDeclaration, policy.SpaceBeforeConstructorDeclarationParameterComma, policy.SpaceAfterConstructorDeclarationParameterComma);
706706

707-
object result = null;
708707
if (!constructorDeclaration.Body.IsNull) {
709708
EnforceBraceStyle (policy.ConstructorBraceStyle, constructorDeclaration.Body.LBraceToken, constructorDeclaration.Body.RBraceToken);
710709
if (policy.IndentMethodBody)
@@ -725,7 +724,6 @@ public override void VisitDestructorDeclaration (DestructorDeclaration destructo
725724
int offset = this.document.GetOffset (lParen.StartLocation);
726725
ForceSpaceBefore (offset, policy.SpaceBeforeConstructorDeclarationParentheses);
727726

728-
object result = null;
729727
if (!destructorDeclaration.Body.IsNull) {
730728
EnforceBraceStyle (policy.DestructorBraceStyle, destructorDeclaration.Body.LBraceToken, destructorDeclaration.Body.RBraceToken);
731729
if (policy.IndentMethodBody)

ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpAmbience.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void ConvertEntity(IEntity entity, IOutputFormatter formatter, CSharpForm
5555
EntityDeclaration node = astBuilder.ConvertEntity(entity);
5656
PrintModifiers(node.Modifiers, formatter);
5757

58-
if ((ConversionFlags & ConversionFlags.ShowDefinitionKeyWord) == ConversionFlags.ShowDefinitionKeyWord) {
58+
if ((ConversionFlags & ConversionFlags.ShowDefinitionKeyword) == ConversionFlags.ShowDefinitionKeyword) {
5959
if (node is TypeDeclaration) {
6060
switch (((TypeDeclaration)node).ClassType) {
6161
case ClassType.Class:

ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ CSharpResolver GetPreviouslyScannedContext(AstNode node, out AstNode parent)
473473
while (!resolverBeforeDict.TryGetValue(parent, out storedResolver)) {
474474
parent = parent.Parent;
475475
if (parent == null)
476-
throw new InvalidOperationException("Could not find a resolver state for any parent of the specified node. Did you forget to call 'Scan(compilationUnit);'?");
476+
throw new InvalidOperationException("Could not find a resolver state for any parent of the specified node. Are you trying to resolve a node that is not a descendant of the CSharpAstResolver's root node?");
477477
}
478478
return storedResolver;
479479
}
@@ -1255,7 +1255,7 @@ ResolveResult IAstVisitor<ResolveResult>.VisitIndexerExpression(IndexerExpressio
12551255
ResolveResult rr = resolver.ResolveIndexer(targetResult, arguments, argumentNames);
12561256
ArrayAccessResolveResult aarr = rr as ArrayAccessResolveResult;
12571257
if (aarr != null) {
1258-
ProcessConversionResults(indexerExpression.Arguments, aarr.Indices);
1258+
ProcessConversionResults(indexerExpression.Arguments, aarr.Indexes);
12591259
} else {
12601260
ProcessConversionsInInvocation(target, indexerExpression.Arguments, rr as CSharpInvocationResolveResult);
12611261
}

ICSharpCode.NRefactory.CSharp/TypeSystem/ConstantValues.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ static ResolveResult MapToNewContext(ResolveResult rr, ITypeResolveContext newCo
8989
}
9090
}
9191

92-
static ResolveResult[] MapToNewContext(ResolveResult[] input, ITypeResolveContext newContext)
92+
static ResolveResult[] MapToNewContext(IList<ResolveResult> input, ITypeResolveContext newContext)
9393
{
9494
if (input == null)
9595
return null;
96-
ResolveResult[] output = new ResolveResult[input.Length];
97-
for (int i = 0; i < input.Length; i++) {
96+
ResolveResult[] output = new ResolveResult[input.Count];
97+
for (int i = 0; i < output.Length; i++) {
9898
output[i] = MapToNewContext(input[i], newContext);
9999
}
100100
return output;

ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ ResolveResult GetParamsAttributeArgument(int index)
613613
{
614614
ITypeDefinition type = GetTypeDefinition(typeof(ParamsAttribute));
615615
var arr = (ArrayCreateResolveResult)type.Attributes.Single().PositionalArguments.Single();
616-
Assert.AreEqual(5, arr.InitializerElements.Length);
616+
Assert.AreEqual(5, arr.InitializerElements.Count);
617617
return arr.InitializerElements[index];
618618
}
619619

ICSharpCode.NRefactory.VB/Ast/AstNode.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,7 @@ public AstNode Clone()
413413
}
414414

415415
// Finally, clone the annotation, if necessary
416-
ICloneable annotations = copy.annotations as ICloneable; // read from copy (for thread-safety)
417-
if (annotations != null)
418-
copy.annotations = annotations.Clone();
416+
copy.CloneAnnotations();
419417

420418
return copy;
421419
}

ICSharpCode.NRefactory/Completion/CompletionCategory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// CompletionCategory.cs
33
//
44
// Author:
@@ -33,11 +33,11 @@ public abstract class CompletionCategory : IComparable<CompletionCategory>
3333

3434
public string Icon { get; set; }
3535

36-
public CompletionCategory ()
36+
protected CompletionCategory ()
3737
{
3838
}
3939

40-
public CompletionCategory (string displayText, string icon)
40+
protected CompletionCategory (string displayText, string icon)
4141
{
4242
this.DisplayText = displayText;
4343
this.Icon = icon;

ICSharpCode.NRefactory/Documentation/DocumentationComment.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ public override string ToString ()
8585
return Xml.Text;
8686
}
8787

88-
public static implicit operator string (DocumentationComment cmt)
88+
public static implicit operator string (DocumentationComment documentationComment)
8989
{
90-
if (cmt != null)
91-
return cmt.ToString ();
90+
if (documentationComment != null)
91+
return documentationComment.ToString ();
9292
return null;
9393
}
9494
}

ICSharpCode.NRefactory/Documentation/IdStringProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void AppendTypeParameters(StringBuilder b, IType type, int outerTypeParam
187187
public static IMemberReference ParseMemberIdString(string memberIdString)
188188
{
189189
if (memberIdString == null)
190-
throw new ArgumentNullException("memberIDString");
190+
throw new ArgumentNullException("memberIdString");
191191
if (memberIdString.Length < 2 || memberIdString[1] != ':')
192192
throw new ReflectionNameParseException(0, "Missing type tag");
193193
char typeChar = memberIdString[0];

0 commit comments

Comments
 (0)