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 @@ -180,6 +180,8 @@ namespace CSharpBinding.Parser
#region Comments
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))
return; // already handled by previous comment
Comment lastComment = comment;
@ -203,9 +205,6 @@ namespace CSharpBinding.Parser @@ -203,9 +205,6 @@ namespace CSharpBinding.Parser
case CommentType.Documentation:
folding.Name = "/// ...";
break;
case CommentType.InactiveCode:
folding.Name = "inactive code";
break;
case CommentType.MultiLineDocumentation:
folding.Name = "/** ... */";
break;

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

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

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

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

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

@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.Utils @@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.Utils
}
/// <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 not null: returns target.
/// </summary>

Loading…
Cancel
Save