@ -244,7 +244,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -244,7 +244,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
return false ;
if ( ! ( kind = = SlotKind . Getter | | kind = = SlotKind . Setter ) )
return false ;
bool isAutoProperty = accessor . Body . IsN ull
bool isAutoProperty = accessor . Body is n ull
& & ! accessor . Attributes . Any ( )
& & policy . AutoPropertyFormatting = = PropertyFormatting . SingleLine ;
return isAutoProperty ;
@ -531,7 +531,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -531,7 +531,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
protected virtual void WriteMethodBody ( BlockStatement body , BraceStyle style , bool newLine = true )
{
if ( body . IsNull )
if ( body is null | | body . IsNull )
{
Semicolon ( ) ;
}
@ -552,7 +552,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -552,7 +552,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
protected virtual void WritePrivateImplementationType ( AstType privateImplementationType )
{
if ( ! privateImplementationType . IsNull )
if ( privateImplementationType is not null & & ! privateImplementationType . IsNull )
{
privateImplementationType . AcceptVisitor ( this ) ;
WriteToken ( Roles . Dot ) ;
@ -620,7 +620,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -620,7 +620,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
specifier . AcceptVisitor ( this ) ;
}
arrayCreateExpression . Initializer . AcceptVisitor ( this ) ;
arrayCreateExpression . Initializer ? . AcceptVisitor ( this ) ;
EndNode ( arrayCreateExpression ) ;
}
@ -925,7 +925,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -925,7 +925,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
StartNode ( recursivePatternExpression ) ;
recursivePatternExpression . Type . AcceptVisitor ( this ) ;
recursivePatternExpression . Type ? . AcceptVisitor ( this ) ;
Space ( ) ;
if ( recursivePatternExpression . IsPositional )
{
@ -946,7 +946,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -946,7 +946,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
WriteToken ( Roles . RBrace ) ;
}
if ( ! recursivePatternExpression . Designation . IsN ull)
if ( recursivePatternExpression . Designation is not n ull )
{
Space ( ) ;
recursivePatternExpression . Designation . AcceptVisitor ( this ) ;
@ -979,7 +979,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -979,7 +979,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
public virtual void VisitIndexerExpression ( IndexerExpression indexerExpression )
{
StartNode ( indexerExpression ) ;
indexerExpression . Target . AcceptVisitor ( this ) ;
indexerExpression . Target ? . AcceptVisitor ( this ) ;
Space ( policy . SpaceBeforeMethodCallParentheses ) ;
WriteCommaSeparatedListInBrackets ( indexerExpression . Arguments ) ;
EndNode ( indexerExpression ) ;
@ -1050,7 +1050,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -1050,7 +1050,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
return true ;
}
var p = lambdaExpression . Parameters . Single ( ) ;
return ! ( p . Type . IsN ull & & p . ParameterModifier = = ReferenceKind . None & & ! p . IsParams ) ;
return ! ( p . Type is n ull & & p . ParameterModifier = = ReferenceKind . None & & ! p . IsParams ) ;
}
public virtual void VisitMemberReferenceExpression ( MemberReferenceExpression memberReferenceExpression )
@ -1102,13 +1102,13 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -1102,13 +1102,13 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
StartNode ( objectCreateExpression ) ;
WriteKeyword ( ObjectCreateExpression . NewKeywordRole ) ;
objectCreateExpression . Type . AcceptVisitor ( this ) ;
bool useParenthesis = objectCreateExpression . Arguments . Any ( ) | | objectCreateExpression . Initializer . IsN ull;
bool useParenthesis = objectCreateExpression . Arguments . Any ( ) | | objectCreateExpression . Initializer is n ull ;
if ( useParenthesis )
{
Space ( policy . SpaceBeforeMethodCallParentheses ) ;
WriteCommaSeparatedListInParenthesis ( objectCreateExpression . Arguments , policy . SpaceWithinMethodCallParentheses ) ;
}
objectCreateExpression . Initializer . AcceptVisitor ( this ) ;
objectCreateExpression . Initializer ? . AcceptVisitor ( this ) ;
EndNode ( objectCreateExpression ) ;
}
@ -1212,9 +1212,9 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -1212,9 +1212,9 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
StartNode ( stackAllocExpression ) ;
WriteKeyword ( StackAllocExpression . StackallocKeywordRole ) ;
stackAllocExpression . Type . AcceptVisitor ( this ) ;
WriteCommaSeparatedListInBrackets ( new [ ] { stackAllocExpression . CountExpression } ) ;
stackAllocExpression . Initializer . AcceptVisitor ( this ) ;
stackAllocExpression . Type ? . AcceptVisitor ( this ) ;
WriteCommaSeparatedListInBrackets ( stackAllocExpression . CountExpression is { } stackAllocCount ? new [ ] { stackAllocCount } : Array . Empty < Expression > ( ) ) ;
stackAllocExpression . Initializer ? . AcceptVisitor ( this ) ;
EndNode ( stackAllocExpression ) ;
}
@ -1831,7 +1831,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -1831,7 +1831,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
WriteToken ( Roles . Semicolon ) ;
Space ( policy . SpaceAfterForSemicolon ) ;
forStatement . Condition . AcceptVisitor ( this ) ;
forStatement . Condition ? . AcceptVisitor ( this ) ;
Space ( policy . SpaceBeforeForSemicolon ) ;
WriteToken ( Roles . Semicolon ) ;
if ( forStatement . Iterators . Any ( ) )
@ -1886,7 +1886,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -1886,7 +1886,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
Space ( policy . SpacesWithinIfParentheses ) ;
RPar ( ) ;
if ( ifElseStatement . FalseStatement . IsN ull)
if ( ifElseStatement . FalseStatement is n ull )
{
WriteEmbeddedStatement ( ifElseStatement . TrueStatement ) ;
}
@ -1947,7 +1947,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -1947,7 +1947,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
StartNode ( returnStatement ) ;
WriteKeyword ( ReturnStatement . ReturnKeywordRole ) ;
if ( ! returnStatement . Expression . IsN ull)
if ( returnStatement . Expression is not n ull )
{
Space ( ) ;
returnStatement . Expression . AcceptVisitor ( this ) ;
@ -2024,7 +2024,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2024,7 +2024,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
public virtual void VisitCaseLabel ( CaseLabel caseLabel )
{
StartNode ( caseLabel ) ;
if ( caseLabel . Expression . IsN ull)
if ( caseLabel . Expression is n ull )
{
WriteKeyword ( CaseLabel . DefaultKeywordRole ) ;
}
@ -2070,7 +2070,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2070,7 +2070,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
StartNode ( throwStatement ) ;
WriteKeyword ( ThrowStatement . ThrowKeywordRole ) ;
if ( ! throwStatement . Expression . IsN ull)
if ( throwStatement . Expression is not n ull )
{
Space ( ) ;
throwStatement . Expression . AcceptVisitor ( this ) ;
@ -2092,7 +2092,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2092,7 +2092,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
NewLine ( ) ;
catchClause . AcceptVisitor ( this ) ;
}
if ( ! tryCatchStatement . FinallyBlock . IsN ull)
if ( tryCatchStatement . FinallyBlock is not n ull )
{
if ( policy . FinallyNewLinePlacement = = NewLinePlacement . SameLine )
Space ( ) ;
@ -2109,7 +2109,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2109,7 +2109,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
StartNode ( catchClause ) ;
WriteKeyword ( CatchClause . CatchKeywordRole ) ;
if ( ! catchClause . Type . IsN ull)
if ( catchClause . Type is not n ull )
{
Space ( policy . SpaceBeforeCatchParentheses ) ;
LPar ( ) ;
@ -2123,7 +2123,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2123,7 +2123,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
Space ( policy . SpacesWithinCatchParentheses ) ;
RPar ( ) ;
}
if ( ! catchClause . Condition . IsN ull)
if ( catchClause . Condition is not n ull )
{
Space ( ) ;
WriteKeyword ( CatchClause . WhenKeywordRole ) ;
@ -2313,7 +2313,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2313,7 +2313,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
WriteIdentifier ( constructorDeclaration . NameToken ) ;
Space ( policy . SpaceBeforeConstructorDeclarationParentheses ) ;
WriteCommaSeparatedListInParenthesis ( constructorDeclaration . Parameters , policy . SpaceWithinMethodDeclarationParentheses ) ;
if ( ! constructorDeclaration . Initializer . IsN ull)
if ( constructorDeclaration . Initializer is not n ull )
{
NewLine ( ) ;
writer . Indent ( ) ;
@ -2370,7 +2370,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2370,7 +2370,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
WriteAttributes ( enumMemberDeclaration . Attributes ) ;
WriteModifiers ( enumMemberDeclaration . Modifiers ) ;
WriteIdentifier ( enumMemberDeclaration . NameToken ) ;
if ( ! enumMemberDeclaration . Initializer . IsN ull)
if ( enumMemberDeclaration . Initializer is not n ull )
{
Space ( policy . SpaceAroundAssignment ) ;
WriteToken ( Roles . Assign ) ;
@ -2500,14 +2500,14 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2500,14 +2500,14 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
Space ( policy . SpaceBeforeMethodDeclarationParentheses ) ;
WriteCommaSeparatedListInBrackets ( indexerDeclaration . Parameters , policy . SpaceWithinMethodDeclarationParentheses ) ;
if ( indexerDeclaration . ExpressionBody . IsN ull)
if ( indexerDeclaration . ExpressionBody is n ull )
{
bool isSingleLine =
( policy . AutoPropertyFormatting = = PropertyFormatting . SingleLine )
& & ( indexerDeclaration . Getter . IsN ull | | indexerDeclaration . Getter . Body . IsN ull)
& & ( indexerDeclaration . Setter . IsN ull | | indexerDeclaration . Setter . Body . IsN ull)
& & ! indexerDeclaration . Getter . Attributes . Any ( )
& & ! indexerDeclaration . Setter . Attributes . Any ( ) ;
& & ( indexerDeclaration . Getter is n ull | | indexerDeclaration . Getter . Body is n ull )
& & ( indexerDeclaration . Setter is n ull | | indexerDeclaration . Setter . Body is n ull )
& & ( indexerDeclaration . Getter is null | | ! indexerDeclaration . Getter . Attributes . Any ( ) )
& & ( indexerDeclaration . Setter is null | | ! indexerDeclaration . Setter . Attributes . Any ( ) ) ;
OpenBrace ( isSingleLine ? BraceStyle . EndOfLine : policy . PropertyBraceStyle , newLine : ! isSingleLine ) ;
if ( isSingleLine )
Space ( ) ;
@ -2634,8 +2634,8 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2634,8 +2634,8 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
Space ( ) ;
break ;
}
parameterDeclaration . Type . AcceptVisitor ( this ) ;
if ( ! parameterDeclaration . Type . IsN ull & & ! string . IsNullOrEmpty ( parameterDeclaration . Name ) )
parameterDeclaration . Type ? . AcceptVisitor ( this ) ;
if ( parameterDeclaration . Type is not n ull & & ! string . IsNullOrEmpty ( parameterDeclaration . Name ) )
{
Space ( ) ;
}
@ -2643,7 +2643,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2643,7 +2643,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
WriteIdentifier ( parameterDeclaration . NameToken ) ;
}
if ( ! parameterDeclaration . DefaultExpression . IsN ull)
if ( parameterDeclaration . DefaultExpression is not n ull )
{
Space ( policy . SpaceAroundAssignment ) ;
WriteToken ( Roles . Assign ) ;
@ -2662,14 +2662,14 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2662,14 +2662,14 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
Space ( ) ;
WritePrivateImplementationType ( propertyDeclaration . PrivateImplementationType ) ;
WriteIdentifier ( propertyDeclaration . NameToken ) ;
if ( propertyDeclaration . ExpressionBody . IsN ull)
if ( propertyDeclaration . ExpressionBody is n ull )
{
bool isSingleLine =
( policy . AutoPropertyFormatting = = PropertyFormatting . SingleLine )
& & ( propertyDeclaration . Getter . IsN ull | | propertyDeclaration . Getter . Body . IsN ull)
& & ( propertyDeclaration . Setter . IsN ull | | propertyDeclaration . Setter . Body . IsN ull)
& & ! propertyDeclaration . Getter . Attributes . Any ( )
& & ! propertyDeclaration . Setter . Attributes . Any ( ) ;
& & ( propertyDeclaration . Getter is n ull | | propertyDeclaration . Getter . Body is n ull )
& & ( propertyDeclaration . Setter is n ull | | propertyDeclaration . Setter . Body is n ull )
& & ( propertyDeclaration . Getter is null | | ! propertyDeclaration . Getter . Attributes . Any ( ) )
& & ( propertyDeclaration . Setter is null | | ! propertyDeclaration . Setter . Attributes . Any ( ) ) ;
OpenBrace ( isSingleLine ? BraceStyle . EndOfLine : policy . PropertyBraceStyle , newLine : ! isSingleLine ) ;
if ( isSingleLine )
Space ( ) ;
@ -2714,7 +2714,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2714,7 +2714,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
StartNode ( variableInitializer ) ;
WriteIdentifier ( variableInitializer . NameToken ) ;
if ( ! variableInitializer . Initializer . IsN ull)
if ( variableInitializer . Initializer is not n ull )
{
Space ( policy . SpaceAroundAssignment ) ;
WriteToken ( Roles . Assign ) ;
@ -2788,7 +2788,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -2788,7 +2788,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
StartNode ( tupleTypeElement ) ;
tupleTypeElement . Type . AcceptVisitor ( this ) ;
if ( ! tupleTypeElement . NameToken . IsN ull)
if ( tupleTypeElement . NameToken is not n ull )
{
Space ( ) ;
tupleTypeElement . NameToken . AcceptVisitor ( this ) ;
@ -3098,7 +3098,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
@@ -3098,7 +3098,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
public virtual void VisitDocumentationReference ( DocumentationReference documentationReference )
{
StartNode ( documentationReference ) ;
if ( ! documentationReference . DeclaringType . IsN ull)
if ( documentationReference . DeclaringType is not n ull )
{
documentationReference . DeclaringType . AcceptVisitor ( this ) ;
if ( documentationReference . SymbolKind ! = SymbolKind . TypeDefinition )