Browse Source

Fix NullReferenceException in ParameterCanBeDemotedIssue

newNRvisualizers
Daniel Grunwald 13 years ago
parent
commit
804ea361d0
  1. 5
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/FoldingVisitor.cs
  2. 2
      src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ParameterCanBeDemotedIssue/ParameterCanBeDemotedIssue.cs
  3. 6
      src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ReadOnlyDocument.cs
  4. 2
      src/Libraries/NRefactory/ICSharpCode.NRefactory/Utils/LazyInit.cs

5
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/FoldingVisitor.cs

@ -180,6 +180,8 @@ namespace CSharpBinding.Parser
#region Comments #region Comments
public override void VisitComment(Comment comment) public override void VisitComment(Comment comment)
{ {
if (comment.CommentType == CommentType.InactiveCode)
return; // don't fold the inactive code comment; instead fold the preprocessor directives
if (AreTwoSinglelineCommentsInConsecutiveLines(comment.PrevSibling as Comment, comment)) if (AreTwoSinglelineCommentsInConsecutiveLines(comment.PrevSibling as Comment, comment))
return; // already handled by previous comment return; // already handled by previous comment
Comment lastComment = comment; Comment lastComment = comment;
@ -203,9 +205,6 @@ namespace CSharpBinding.Parser
case CommentType.Documentation: case CommentType.Documentation:
folding.Name = "/// ..."; folding.Name = "/// ...";
break; break;
case CommentType.InactiveCode:
folding.Name = "inactive code";
break;
case CommentType.MultiLineDocumentation: case CommentType.MultiLineDocumentation:
folding.Name = "/** ... */"; folding.Name = "/** ... */";
break; break;

2
src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ParameterCanBeDemotedIssue/ParameterCanBeDemotedIssue.cs

@ -119,6 +119,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
void ProcessParameter(ParameterDeclaration parameter, AstNode rootResolutionNode, TypeCriteriaCollector collector) void ProcessParameter(ParameterDeclaration parameter, AstNode rootResolutionNode, TypeCriteriaCollector collector)
{ {
var localResolveResult = ctx.Resolve(parameter) as LocalResolveResult; var localResolveResult = ctx.Resolve(parameter) as LocalResolveResult;
if (localResolveResult == null)
return;
var variable = localResolveResult.Variable; var variable = localResolveResult.Variable;
var typeKind = variable.Type.Kind; var typeKind = variable.Type.Kind;
if (!(typeKind == TypeKind.Class || if (!(typeKind == TypeKind.Class ||

6
src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ReadOnlyDocument.cs

@ -270,17 +270,17 @@ namespace ICSharpCode.NRefactory.Editor
void IDocument.Insert(int offset, ITextSource text) void IDocument.Insert(int offset, ITextSource text)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
void IDocument.Insert(int offset, ITextSource text, AnchorMovementType defaultAnchorMovementType) void IDocument.Insert(int offset, ITextSource text, AnchorMovementType defaultAnchorMovementType)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
void IDocument.Replace(int offset, int length, ITextSource newText) void IDocument.Replace(int offset, int length, ITextSource newText)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
void IDocument.StartUndoableAction() void IDocument.StartUndoableAction()

2
src/Libraries/NRefactory/ICSharpCode.NRefactory/Utils/LazyInit.cs

@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.Utils
} }
/// <summary> /// <summary>
/// Atomatically performs the following operation: /// Atomically performs the following operation:
/// - If target is null: stores newValue in target and returns newValue. /// - If target is null: stores newValue in target and returns newValue.
/// - If target is not null: returns target. /// - If target is not null: returns target.
/// </summary> /// </summary>

Loading…
Cancel
Save