/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Syntax.Generated.vb
38 053 строки
2 MB
Sam Harwell
Add documentation remarks for syntax kinds (#43646)
16 сен 2020, 02:59
Не верифицирован
16 сен 2020, 02:59
5f0b751
Код
Авторство
О чём код?
' Definition of syntax model. ' DO NOT HAND EDIT Imports System.Collections.Generic Imports System.Collections.Immutable Imports System.Runtime.CompilerServices Imports Microsoft.CodeAnalysis.Syntax.InternalSyntax Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Roslyn.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax ''' <summary> ''' Represents one of the type characters or literal suffixes of VB. Used to ''' describe a) the type character suffixes that can be placed on identifiers, and ''' b) the suffixes that can be placed on integer literals. ''' </summary> Public Enum TypeCharacter None ''' <summary> ''' The "%" type character." ''' </summary> [Integer] ''' <summary> ''' The "&" type character." ''' </summary> [Long] ''' <summary> ''' The "@" type character." ''' </summary> [Decimal] ''' <summary> ''' The "!" type character." ''' </summary> [Single] ''' <summary> ''' The "#" type character." ''' </summary> [Double] ''' <summary> ''' The "$" type character." ''' </summary> [String] ''' <summary> ''' The "S" literal suffix denoting "Short" ''' </summary> ShortLiteral ''' <summary> ''' The "US" literal suffix denoting "UShort" ''' </summary> UShortLiteral ''' <summary> ''' The "I" literal suffix denoting "Integer" ''' </summary> IntegerLiteral ''' <summary> ''' The "UI" literal suffix denoting "UInteger" ''' </summary> UIntegerLiteral ''' <summary> ''' The "L" literal suffix denoting "Long" ''' </summary> LongLiteral ''' <summary> ''' The "UL" literal suffix denoting "ULong" ''' </summary> ULongLiteral ''' <summary> ''' The "F" literal suffix denoting "Single" ''' </summary> SingleLiteral ''' <summary> ''' The "R" literal suffix denoting "Double" ''' </summary> DoubleLiteral ''' <summary> ''' The "D" literal suffix denoting "Decimal" ''' </summary> DecimalLiteral End Enum ''' <summary> ''' The four possible number bases that a literal can be written in. ''' </summary> Public Enum LiteralBase [Decimal] Hexadecimal Octal Binary End Enum ''' <summary> ''' The base class for all nodes that represent statements. This includes both ''' declaration statements, such as class declarations as well as executable ''' statements. ''' </summary> Public MustInherit Class StatementSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' The base class for all nodes that represent executable statements. ''' </summary> Public MustInherit Class ExecutableStatementSyntax Inherits StatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' The base class for all nodes that represent statements that declare options, ''' imports, members, etc. ''' </summary> Public MustInherit Class DeclarationStatementSyntax Inherits StatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' A class to represent an empty statement. This can occur when a colon is on a ''' line without anything else. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EmptyStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EmptyStatementSyntax Inherits StatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), empty As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EmptyStatementSyntax(kind, errors, annotations, empty), Nothing, 0) End Sub ''' <summary> ''' An empty token because all non terminals must have a token. ''' </summary> Public ReadOnly Property Empty As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EmptyStatementSyntax)._empty, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Empty property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithEmpty(empty as SyntaxToken) As EmptyStatementSyntax return Update(empty) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEmptyStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEmptyStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="empty"> ''' The value for the Empty property. ''' </param> Public Function Update(empty As SyntaxToken) As EmptyStatementSyntax If empty <> Me.Empty Then Dim newNode = SyntaxFactory.EmptyStatement(empty) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an "End XXX" statement, where XXX is a single keyword. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EndIfStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndUsingStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndWithStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndSelectStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndStructureStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndEnumStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndInterfaceStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndClassStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndModuleStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndNamespaceStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndSubStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndFunctionStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndGetStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndSetStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndPropertyStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndOperatorStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndEventStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndAddHandlerStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndRemoveHandlerStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndRaiseEventStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndWhileStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndTryStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndSyncLockStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EndBlockStatementSyntax Inherits DeclarationStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), endKeyword As InternalSyntax.KeywordSyntax, blockKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax(kind, errors, annotations, endKeyword, blockKeyword), Nothing, 0) End Sub ''' <summary> ''' The "End" keyword ''' </summary> Public ReadOnly Property EndKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)._endKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the EndKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEndKeyword(endKeyword as SyntaxToken) As EndBlockStatementSyntax return Update(Me.Kind, endKeyword, Me.BlockKeyword) End Function ''' <summary> ''' The keyword that ends the block. Must be one of: "If", "Using", "With", ''' "Select", "Structure", "Enum", "Interface", "Class", "Module", "Namespace", ''' "Sub", "Function", "Get, "Set", "Property", "Operator", "Event", "AddHandler", ''' "RemoveHandler", "RaiseEvent", "While", "Try" or "SyncLock". ''' </summary> Public ReadOnly Property BlockKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)._blockKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the BlockKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithBlockKeyword(blockKeyword as SyntaxToken) As EndBlockStatementSyntax return Update(Me.Kind, Me.EndKeyword, blockKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEndBlockStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEndBlockStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="endKeyword"> ''' The value for the EndKeyword property. ''' </param> ''' <param name="blockKeyword"> ''' The value for the BlockKeyword property. ''' </param> Public Function Update(kind As SyntaxKind, endKeyword As SyntaxToken, blockKeyword As SyntaxToken) As EndBlockStatementSyntax If kind <> Me.Kind OrElse endKeyword <> Me.EndKeyword OrElse blockKeyword <> Me.BlockKeyword Then Dim newNode = SyntaxFactory.EndBlockStatement(kind, endKeyword, blockKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an entire source file of VB code. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CompilationUnit"/></description></item> ''' </list> ''' </remarks> Partial Public NotInheritable Class CompilationUnitSyntax Inherits VisualBasicSyntaxNode Friend _options as SyntaxNode Friend _imports as SyntaxNode Friend _attributes as SyntaxNode Friend _members as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), options As SyntaxNode, [imports] As SyntaxNode, attributes As SyntaxNode, members As SyntaxNode, endOfFileToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CompilationUnitSyntax(kind, errors, annotations, if(options IsNot Nothing, options.Green, Nothing), if([imports] IsNot Nothing, [imports].Green, Nothing), if(attributes IsNot Nothing, attributes.Green, Nothing), if(members IsNot Nothing, members.Green, Nothing), endOfFileToken), Nothing, 0) End Sub ''' <summary> ''' Represents the list of Option statements at the beginning of a source file. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Options As SyntaxList(Of OptionStatementSyntax) Get Dim listNode = GetRedAtZero(_options) Return new SyntaxList(Of OptionStatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Options property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOptions(options as SyntaxList(Of OptionStatementSyntax)) As CompilationUnitSyntax return Update(options, Me.Imports, Me.Attributes, Me.Members, Me.EndOfFileToken) End Function Public Shadows Function AddOptions(ParamArray items As OptionStatementSyntax()) As CompilationUnitSyntax Return Me.WithOptions(Me.Options.AddRange(items)) End Function ''' <summary> ''' Represents the list of Imports statements at the beginning of a source file. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property [Imports] As SyntaxList(Of ImportsStatementSyntax) Get Dim listNode = GetRed(_imports, 1) Return new SyntaxList(Of ImportsStatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the [Imports] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithImports([imports] as SyntaxList(Of ImportsStatementSyntax)) As CompilationUnitSyntax return Update(Me.Options, [imports], Me.Attributes, Me.Members, Me.EndOfFileToken) End Function Public Shadows Function AddImports(ParamArray items As ImportsStatementSyntax()) As CompilationUnitSyntax Return Me.WithImports(Me.Imports.AddRange(items)) End Function ''' <summary> ''' Represents the list of AttributeStatements at the beginning of a source file ''' that contain the Assembly and Module attributes. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Attributes As SyntaxList(Of AttributesStatementSyntax) Get Dim listNode = GetRed(_attributes, 2) Return new SyntaxList(Of AttributesStatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Attributes property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAttributes(attributes as SyntaxList(Of AttributesStatementSyntax)) As CompilationUnitSyntax return Update(Me.Options, Me.Imports, attributes, Me.Members, Me.EndOfFileToken) End Function Public Shadows Function AddAttributes(ParamArray items As AttributesStatementSyntax()) As CompilationUnitSyntax Return Me.WithAttributes(Me.Attributes.AddRange(items)) End Function ''' <summary> ''' Represents the members of the default namespace for this source file: all the ''' top-level type and namespace declarations in the file. May also contain ''' Statements that are not valid ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Members As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_members, 3) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Members property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithMembers(members as SyntaxList(Of StatementSyntax)) As CompilationUnitSyntax return Update(Me.Options, Me.Imports, Me.Attributes, members, Me.EndOfFileToken) End Function Public Shadows Function AddMembers(ParamArray items As StatementSyntax()) As CompilationUnitSyntax Return Me.WithMembers(Me.Members.AddRange(items)) End Function ''' <summary> ''' Represents the end of the source file. This token may have trivia (whitespace, ''' comments, ...) attached to it. ''' </summary> Public ReadOnly Property EndOfFileToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CompilationUnitSyntax)._endOfFileToken, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property ''' <summary> ''' Returns a copy of this with the EndOfFileToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndOfFileToken(endOfFileToken as SyntaxToken) As CompilationUnitSyntax return Update(Me.Options, Me.Imports, Me.Attributes, Me.Members, endOfFileToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._options Case 1 Return Me._imports Case 2 Return Me._attributes Case 3 Return Me._members Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_options) Case 1 Return GetRed(_imports, 1) Case 2 Return GetRed(_attributes, 2) Case 3 Return GetRed(_members, 3) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCompilationUnit(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCompilationUnit(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="options"> ''' The value for the Options property. ''' </param> ''' <param name="imports"> ''' The value for the Imports property. ''' </param> ''' <param name="attributes"> ''' The value for the Attributes property. ''' </param> ''' <param name="members"> ''' The value for the Members property. ''' </param> ''' <param name="endOfFileToken"> ''' The value for the EndOfFileToken property. ''' </param> Public Function Update(options As SyntaxList(of OptionStatementSyntax), [imports] As SyntaxList(of ImportsStatementSyntax), attributes As SyntaxList(of AttributesStatementSyntax), members As SyntaxList(of StatementSyntax), endOfFileToken As SyntaxToken) As CompilationUnitSyntax If options <> Me.Options OrElse [imports] <> Me.[Imports] OrElse attributes <> Me.Attributes OrElse members <> Me.Members OrElse endOfFileToken <> Me.EndOfFileToken Then Dim newNode = SyntaxFactory.CompilationUnit(options, [imports], attributes, members, endOfFileToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an Option statement, such as "Option Strict On". ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.OptionStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class OptionStatementSyntax Inherits DeclarationStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), optionKeyword As InternalSyntax.KeywordSyntax, nameKeyword As InternalSyntax.KeywordSyntax, valueKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OptionStatementSyntax(kind, errors, annotations, optionKeyword, nameKeyword, valueKeyword), Nothing, 0) End Sub ''' <summary> ''' The "Option" keyword. ''' </summary> Public ReadOnly Property OptionKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OptionStatementSyntax)._optionKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OptionKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOptionKeyword(optionKeyword as SyntaxToken) As OptionStatementSyntax return Update(optionKeyword, Me.NameKeyword, Me.ValueKeyword) End Function ''' <summary> ''' The keyword that identifies the option being set: Explicit, Strict, Compare or ''' Infer. ''' </summary> Public ReadOnly Property NameKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OptionStatementSyntax)._nameKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the NameKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNameKeyword(nameKeyword as SyntaxToken) As OptionStatementSyntax return Update(Me.OptionKeyword, nameKeyword, Me.ValueKeyword) End Function ''' <summary> ''' The keyword that identifiers the value being set for the option: On, Off, Text ''' or Binary. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ValueKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OptionStatementSyntax)._valueKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(2), Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the ValueKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithValueKeyword(valueKeyword as SyntaxToken) As OptionStatementSyntax return Update(Me.OptionKeyword, Me.NameKeyword, valueKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitOptionStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitOptionStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="optionKeyword"> ''' The value for the OptionKeyword property. ''' </param> ''' <param name="nameKeyword"> ''' The value for the NameKeyword property. ''' </param> ''' <param name="valueKeyword"> ''' The value for the ValueKeyword property. ''' </param> Public Function Update(optionKeyword As SyntaxToken, nameKeyword As SyntaxToken, valueKeyword As SyntaxToken) As OptionStatementSyntax If optionKeyword <> Me.OptionKeyword OrElse nameKeyword <> Me.NameKeyword OrElse valueKeyword <> Me.ValueKeyword Then Dim newNode = SyntaxFactory.OptionStatement(optionKeyword, nameKeyword, valueKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an Imports statement, which has one or more imports clauses. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ImportsStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ImportsStatementSyntax Inherits DeclarationStatementSyntax Friend _importsClauses as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), importsKeyword As InternalSyntax.KeywordSyntax, importsClauses As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImportsStatementSyntax(kind, errors, annotations, importsKeyword, if(importsClauses IsNot Nothing, importsClauses.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Imports" keyword. ''' </summary> Public ReadOnly Property ImportsKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImportsStatementSyntax)._importsKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ImportsKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithImportsKeyword(importsKeyword as SyntaxToken) As ImportsStatementSyntax return Update(importsKeyword, Me.ImportsClauses) End Function ''' <summary> ''' A list of one or more import clauses. Each clause is either an alias, namespace ''' or XML namespace import. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property ImportsClauses As SeparatedSyntaxList(Of ImportsClauseSyntax) Get Dim listNode = GetRed(_importsClauses, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ImportsClauseSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the ImportsClauses property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithImportsClauses(importsClauses as SeparatedSyntaxList(Of ImportsClauseSyntax)) As ImportsStatementSyntax return Update(Me.ImportsKeyword, importsClauses) End Function Public Shadows Function AddImportsClauses(ParamArray items As ImportsClauseSyntax()) As ImportsStatementSyntax Return Me.WithImportsClauses(Me.ImportsClauses.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._importsClauses Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_importsClauses, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitImportsStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitImportsStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="importsKeyword"> ''' The value for the ImportsKeyword property. ''' </param> ''' <param name="importsClauses"> ''' The value for the ImportsClauses property. ''' </param> Public Function Update(importsKeyword As SyntaxToken, importsClauses As SeparatedSyntaxList(Of ImportsClauseSyntax)) As ImportsStatementSyntax If importsKeyword <> Me.ImportsKeyword OrElse importsClauses <> Me.ImportsClauses Then Dim newNode = SyntaxFactory.ImportsStatement(importsKeyword, importsClauses) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' The base class for the possible clauses of an Imports statement. ''' </summary> Public MustInherit Class ImportsClauseSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents the clause of an Imports statement that imports all members of a ''' type or namespace or aliases a type or namespace. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SimpleImportsClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SimpleImportsClauseSyntax Inherits ImportsClauseSyntax Friend _alias as ImportAliasClauseSyntax Friend _name as NameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), [alias] As ImportAliasClauseSyntax, name As NameSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleImportsClauseSyntax(kind, errors, annotations, if([alias] IsNot Nothing, DirectCast([alias].Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImportAliasClauseSyntax), Nothing), DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NameSyntax)), Nothing, 0) End Sub ''' <summary> ''' An optional alias for the namespace or type being imported. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property [Alias] As ImportAliasClauseSyntax Get Return GetRedAtZero(_alias) End Get End Property ''' <summary> ''' Returns a copy of this with the [Alias] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAlias([alias] as ImportAliasClauseSyntax) As SimpleImportsClauseSyntax return Update([alias], Me.Name) End Function ''' <summary> ''' The namespace or type being imported. ''' </summary> Public ReadOnly Property Name As NameSyntax Get Return GetRed(_name, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as NameSyntax) As SimpleImportsClauseSyntax return Update(Me.Alias, name) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._alias Case 1 Return Me._name Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.[Alias] Case 1 Return Me.Name Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSimpleImportsClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSimpleImportsClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="alias"> ''' The value for the Alias property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> Public Function Update([alias] As ImportAliasClauseSyntax, name As NameSyntax) As SimpleImportsClauseSyntax If [alias] IsNot Me.[Alias] OrElse name IsNot Me.Name Then Dim newNode = SyntaxFactory.SimpleImportsClause([alias], name) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an alias identifier followed by an "=" token in an Imports clause. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ImportAliasClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ImportAliasClauseSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), identifier As InternalSyntax.IdentifierTokenSyntax, equalsToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImportAliasClauseSyntax(kind, errors, annotations, identifier, equalsToken), Nothing, 0) End Sub ''' <summary> ''' The identifier being introduced. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImportAliasClauseSyntax)._identifier, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As ImportAliasClauseSyntax return Update(identifier, Me.EqualsToken) End Function ''' <summary> ''' The "=" token. ''' </summary> Public ReadOnly Property EqualsToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImportAliasClauseSyntax)._equalsToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the EqualsToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEqualsToken(equalsToken as SyntaxToken) As ImportAliasClauseSyntax return Update(Me.Identifier, equalsToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitImportAliasClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitImportAliasClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="equalsToken"> ''' The value for the EqualsToken property. ''' </param> Public Function Update(identifier As SyntaxToken, equalsToken As SyntaxToken) As ImportAliasClauseSyntax If identifier <> Me.Identifier OrElse equalsToken <> Me.EqualsToken Then Dim newNode = SyntaxFactory.ImportAliasClause(identifier, equalsToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Defines a XML namespace for XML expressions. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlNamespaceImportsClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlNamespaceImportsClauseSyntax Inherits ImportsClauseSyntax Friend _xmlNamespace as XmlAttributeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lessThanToken As InternalSyntax.PunctuationSyntax, xmlNamespace As XmlAttributeSyntax, greaterThanToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNamespaceImportsClauseSyntax(kind, errors, annotations, lessThanToken, DirectCast(xmlNamespace.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlAttributeSyntax), greaterThanToken), Nothing, 0) End Sub Public ReadOnly Property LessThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNamespaceImportsClauseSyntax)._lessThanToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LessThanToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLessThanToken(lessThanToken as SyntaxToken) As XmlNamespaceImportsClauseSyntax return Update(lessThanToken, Me.XmlNamespace, Me.GreaterThanToken) End Function ''' <summary> ''' Identifies the XML namespace alias and URI. ''' </summary> Public ReadOnly Property XmlNamespace As XmlAttributeSyntax Get Return GetRed(_xmlNamespace, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the XmlNamespace property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithXmlNamespace(xmlNamespace as XmlAttributeSyntax) As XmlNamespaceImportsClauseSyntax return Update(Me.LessThanToken, xmlNamespace, Me.GreaterThanToken) End Function Public ReadOnly Property GreaterThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNamespaceImportsClauseSyntax)._greaterThanToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the GreaterThanToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithGreaterThanToken(greaterThanToken as SyntaxToken) As XmlNamespaceImportsClauseSyntax return Update(Me.LessThanToken, Me.XmlNamespace, greaterThanToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._xmlNamespace Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.XmlNamespace Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlNamespaceImportsClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlNamespaceImportsClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lessThanToken"> ''' The value for the LessThanToken property. ''' </param> ''' <param name="xmlNamespace"> ''' The value for the XmlNamespace property. ''' </param> ''' <param name="greaterThanToken"> ''' The value for the GreaterThanToken property. ''' </param> Public Function Update(lessThanToken As SyntaxToken, xmlNamespace As XmlAttributeSyntax, greaterThanToken As SyntaxToken) As XmlNamespaceImportsClauseSyntax If lessThanToken <> Me.LessThanToken OrElse xmlNamespace IsNot Me.XmlNamespace OrElse greaterThanToken <> Me.GreaterThanToken Then Dim newNode = SyntaxFactory.XmlNamespaceImportsClause(lessThanToken, xmlNamespace, greaterThanToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a Namespace statement, its contents and the End Namespace statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.NamespaceBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class NamespaceBlockSyntax Inherits DeclarationStatementSyntax Friend _namespaceStatement as NamespaceStatementSyntax Friend _members as SyntaxNode Friend _endNamespaceStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), namespaceStatement As NamespaceStatementSyntax, members As SyntaxNode, endNamespaceStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NamespaceBlockSyntax(kind, errors, annotations, DirectCast(namespaceStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NamespaceStatementSyntax), if(members IsNot Nothing, members.Green, Nothing), DirectCast(endNamespaceStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The statement that begins the NamespaceBlock. ''' </summary> Public ReadOnly Property NamespaceStatement As NamespaceStatementSyntax Get Return GetRedAtZero(_namespaceStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the NamespaceStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithNamespaceStatement(namespaceStatement as NamespaceStatementSyntax) As NamespaceBlockSyntax return Update(namespaceStatement, Me.Members, Me.EndNamespaceStatement) End Function ''' <summary> ''' The declarations contained in the namespace statement. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Members As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_members, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Members property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithMembers(members as SyntaxList(Of StatementSyntax)) As NamespaceBlockSyntax return Update(Me.NamespaceStatement, members, Me.EndNamespaceStatement) End Function Public Shadows Function AddMembers(ParamArray items As StatementSyntax()) As NamespaceBlockSyntax Return Me.WithMembers(Me.Members.AddRange(items)) End Function ''' <summary> ''' The End Namespace statement that ends the block. ''' </summary> Public ReadOnly Property EndNamespaceStatement As EndBlockStatementSyntax Get Return GetRed(_endNamespaceStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndNamespaceStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndNamespaceStatement(endNamespaceStatement as EndBlockStatementSyntax) As NamespaceBlockSyntax return Update(Me.NamespaceStatement, Me.Members, endNamespaceStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._namespaceStatement Case 1 Return Me._members Case 2 Return Me._endNamespaceStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.NamespaceStatement Case 1 Return GetRed(_members, 1) Case 2 Return Me.EndNamespaceStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitNamespaceBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitNamespaceBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="namespaceStatement"> ''' The value for the NamespaceStatement property. ''' </param> ''' <param name="members"> ''' The value for the Members property. ''' </param> ''' <param name="endNamespaceStatement"> ''' The value for the EndNamespaceStatement property. ''' </param> Public Function Update(namespaceStatement As NamespaceStatementSyntax, members As SyntaxList(of StatementSyntax), endNamespaceStatement As EndBlockStatementSyntax) As NamespaceBlockSyntax If namespaceStatement IsNot Me.NamespaceStatement OrElse members <> Me.Members OrElse endNamespaceStatement IsNot Me.EndNamespaceStatement Then Dim newNode = SyntaxFactory.NamespaceBlock(namespaceStatement, members, endNamespaceStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the beginning statement of a namespace declaration. This node always ''' appears as the Begin of a BlockStatement with Kind=NamespaceBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.NamespaceStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class NamespaceStatementSyntax Inherits DeclarationStatementSyntax Friend _name as NameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), namespaceKeyword As InternalSyntax.KeywordSyntax, name As NameSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NamespaceStatementSyntax(kind, errors, annotations, namespaceKeyword, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NameSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Namespace" keyword. ''' </summary> Public ReadOnly Property NamespaceKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NamespaceStatementSyntax)._namespaceKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the NamespaceKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithNamespaceKeyword(namespaceKeyword as SyntaxToken) As NamespaceStatementSyntax return Update(namespaceKeyword, Me.Name) End Function ''' <summary> ''' A (possibly dotted) name denoting the namespace being declared. ''' </summary> Public ReadOnly Property Name As NameSyntax Get Return GetRed(_name, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as NameSyntax) As NamespaceStatementSyntax return Update(Me.NamespaceKeyword, name) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._name Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Name Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitNamespaceStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitNamespaceStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="namespaceKeyword"> ''' The value for the NamespaceKeyword property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> Public Function Update(namespaceKeyword As SyntaxToken, name As NameSyntax) As NamespaceStatementSyntax If namespaceKeyword <> Me.NamespaceKeyword OrElse name IsNot Me.Name Then Dim newNode = SyntaxFactory.NamespaceStatement(namespaceKeyword, name) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a declaration of a Class, Interface, Structure, Module, its contents ''' and the End statement that ends it. ''' </summary> Public MustInherit Class TypeBlockSyntax Inherits DeclarationStatementSyntax Friend _inherits as SyntaxNode Friend _implements as SyntaxNode Friend _members as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' A list of the Inherits declarations for the type. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property [Inherits] As SyntaxList(Of InheritsStatementSyntax) Get Return Me.GetInheritsCore() End Get End Property Friend Overridable Function GetInheritsCore() As SyntaxList(Of InheritsStatementSyntax) Dim listNode = GetRedAtZero(_inherits) Return new SyntaxList(Of InheritsStatementSyntax)(listNode) End Function ''' <summary> ''' Returns a copy of this with the [Inherits] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithInherits([inherits] As SyntaxList(Of InheritsStatementSyntax)) As TypeBlockSyntax Return WithInheritsCore([inherits]) End Function Friend MustOverride Function WithInheritsCore([inherits] As SyntaxList(Of InheritsStatementSyntax)) As TypeBlockSyntax Public Shadows Function AddInherits(ParamArray items As InheritsStatementSyntax()) As TypeBlockSyntax Return AddInheritsCore(items) End Function Friend MustOverride Function AddInheritsCore(ParamArray items As InheritsStatementSyntax()) As TypeBlockSyntax ''' <summary> ''' A list of the Implements declarations for the type. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property [Implements] As SyntaxList(Of ImplementsStatementSyntax) Get Return Me.GetImplementsCore() End Get End Property Friend Overridable Function GetImplementsCore() As SyntaxList(Of ImplementsStatementSyntax) Dim listNode = GetRed(_implements, 1) Return new SyntaxList(Of ImplementsStatementSyntax)(listNode) End Function ''' <summary> ''' Returns a copy of this with the [Implements] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithImplements([implements] As SyntaxList(Of ImplementsStatementSyntax)) As TypeBlockSyntax Return WithImplementsCore([implements]) End Function Friend MustOverride Function WithImplementsCore([implements] As SyntaxList(Of ImplementsStatementSyntax)) As TypeBlockSyntax Public Shadows Function AddImplements(ParamArray items As ImplementsStatementSyntax()) As TypeBlockSyntax Return AddImplementsCore(items) End Function Friend MustOverride Function AddImplementsCore(ParamArray items As ImplementsStatementSyntax()) As TypeBlockSyntax ''' <summary> ''' The declarations contained in the type or module. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Members As SyntaxList(Of StatementSyntax) Get Return Me.GetMembersCore() End Get End Property Friend Overridable Function GetMembersCore() As SyntaxList(Of StatementSyntax) Dim listNode = GetRed(_members, 2) Return new SyntaxList(Of StatementSyntax)(listNode) End Function ''' <summary> ''' Returns a copy of this with the Members property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithMembers(members As SyntaxList(Of StatementSyntax)) As TypeBlockSyntax Return WithMembersCore(members) End Function Friend MustOverride Function WithMembersCore(members As SyntaxList(Of StatementSyntax)) As TypeBlockSyntax Public Shadows Function AddMembers(ParamArray items As StatementSyntax()) As TypeBlockSyntax Return AddMembersCore(items) End Function Friend MustOverride Function AddMembersCore(ParamArray items As StatementSyntax()) As TypeBlockSyntax End Class ''' <summary> ''' Represents a declaration of Module, its contents and the End statement that ''' ends it. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ModuleBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ModuleBlockSyntax Inherits TypeBlockSyntax Friend _moduleStatement as ModuleStatementSyntax Friend _endModuleStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), moduleStatement As ModuleStatementSyntax, [inherits] As SyntaxNode, [implements] As SyntaxNode, members As SyntaxNode, endModuleStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModuleBlockSyntax(kind, errors, annotations, DirectCast(moduleStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModuleStatementSyntax), if([inherits] IsNot Nothing, [inherits].Green, Nothing), if([implements] IsNot Nothing, [implements].Green, Nothing), if(members IsNot Nothing, members.Green, Nothing), DirectCast(endModuleStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Module" statement that begins the block. ''' </summary> Public ReadOnly Property ModuleStatement As ModuleStatementSyntax Get Return GetRedAtZero(_moduleStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the ModuleStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithModuleStatement(moduleStatement as ModuleStatementSyntax) As ModuleBlockSyntax return Update(moduleStatement, Me.Inherits, Me.Implements, Me.Members, Me.EndModuleStatement) End Function ''' <summary> ''' A list of the Inherits declarations for the type. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property [Inherits] As SyntaxList(Of InheritsStatementSyntax) Get Dim listNode = GetRed(_inherits, 1) Return new SyntaxList(Of InheritsStatementSyntax)(listNode) End Get End Property Friend Overrides Function GetInheritsCore() As SyntaxList(Of InheritsStatementSyntax) Return Me.[Inherits] End Function Friend Overrides Function WithInheritsCore([inherits] As SyntaxList(Of InheritsStatementSyntax)) As TypeBlockSyntax Return WithInherits([inherits]) End Function ''' <summary> ''' Returns a copy of this with the [Inherits] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInherits([inherits] as SyntaxList(Of InheritsStatementSyntax)) As ModuleBlockSyntax return Update(Me.ModuleStatement, [inherits], Me.Implements, Me.Members, Me.EndModuleStatement) End Function Public Shadows Function AddInherits(ParamArray items As InheritsStatementSyntax()) As ModuleBlockSyntax Return Me.WithInherits(Me.Inherits.AddRange(items)) End Function Friend Overrides Function AddInheritsCore(ParamArray items As InheritsStatementSyntax()) As TypeBlockSyntax Return AddInherits(items) End Function ''' <summary> ''' A list of the Implements declarations for the type. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property [Implements] As SyntaxList(Of ImplementsStatementSyntax) Get Dim listNode = GetRed(_implements, 2) Return new SyntaxList(Of ImplementsStatementSyntax)(listNode) End Get End Property Friend Overrides Function GetImplementsCore() As SyntaxList(Of ImplementsStatementSyntax) Return Me.[Implements] End Function Friend Overrides Function WithImplementsCore([implements] As SyntaxList(Of ImplementsStatementSyntax)) As TypeBlockSyntax Return WithImplements([implements]) End Function ''' <summary> ''' Returns a copy of this with the [Implements] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithImplements([implements] as SyntaxList(Of ImplementsStatementSyntax)) As ModuleBlockSyntax return Update(Me.ModuleStatement, Me.Inherits, [implements], Me.Members, Me.EndModuleStatement) End Function Public Shadows Function AddImplements(ParamArray items As ImplementsStatementSyntax()) As ModuleBlockSyntax Return Me.WithImplements(Me.Implements.AddRange(items)) End Function Friend Overrides Function AddImplementsCore(ParamArray items As ImplementsStatementSyntax()) As TypeBlockSyntax Return AddImplements(items) End Function ''' <summary> ''' The declarations contained in the type or module. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Members As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_members, 3) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property Friend Overrides Function GetMembersCore() As SyntaxList(Of StatementSyntax) Return Me.Members End Function Friend Overrides Function WithMembersCore(members As SyntaxList(Of StatementSyntax)) As TypeBlockSyntax Return WithMembers(members) End Function ''' <summary> ''' Returns a copy of this with the Members property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithMembers(members as SyntaxList(Of StatementSyntax)) As ModuleBlockSyntax return Update(Me.ModuleStatement, Me.Inherits, Me.Implements, members, Me.EndModuleStatement) End Function Public Shadows Function AddMembers(ParamArray items As StatementSyntax()) As ModuleBlockSyntax Return Me.WithMembers(Me.Members.AddRange(items)) End Function Friend Overrides Function AddMembersCore(ParamArray items As StatementSyntax()) As TypeBlockSyntax Return AddMembers(items) End Function ''' <summary> ''' The "End Module" statement that ends the block. ''' </summary> Public ReadOnly Property EndModuleStatement As EndBlockStatementSyntax Get Return GetRed(_endModuleStatement, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the EndModuleStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndModuleStatement(endModuleStatement as EndBlockStatementSyntax) As ModuleBlockSyntax return Update(Me.ModuleStatement, Me.Inherits, Me.Implements, Me.Members, endModuleStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._moduleStatement Case 1 Return Me._inherits Case 2 Return Me._implements Case 3 Return Me._members Case 4 Return Me._endModuleStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.ModuleStatement Case 1 Return GetRed(_inherits, 1) Case 2 Return GetRed(_implements, 2) Case 3 Return GetRed(_members, 3) Case 4 Return Me.EndModuleStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitModuleBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitModuleBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="moduleStatement"> ''' The value for the ModuleStatement property. ''' </param> ''' <param name="inherits"> ''' The value for the Inherits property. ''' </param> ''' <param name="implements"> ''' The value for the Implements property. ''' </param> ''' <param name="members"> ''' The value for the Members property. ''' </param> ''' <param name="endModuleStatement"> ''' The value for the EndModuleStatement property. ''' </param> Public Function Update(moduleStatement As ModuleStatementSyntax, [inherits] As SyntaxList(of InheritsStatementSyntax), [implements] As SyntaxList(of ImplementsStatementSyntax), members As SyntaxList(of StatementSyntax), endModuleStatement As EndBlockStatementSyntax) As ModuleBlockSyntax If moduleStatement IsNot Me.ModuleStatement OrElse [inherits] <> Me.[Inherits] OrElse [implements] <> Me.[Implements] OrElse members <> Me.Members OrElse endModuleStatement IsNot Me.EndModuleStatement Then Dim newNode = SyntaxFactory.ModuleBlock(moduleStatement, [inherits], [implements], members, endModuleStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a declaration of a Structure, its contents and the End statement ''' that ends it. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.StructureBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class StructureBlockSyntax Inherits TypeBlockSyntax Friend _structureStatement as StructureStatementSyntax Friend _endStructureStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), structureStatement As StructureStatementSyntax, [inherits] As SyntaxNode, [implements] As SyntaxNode, members As SyntaxNode, endStructureStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.StructureBlockSyntax(kind, errors, annotations, DirectCast(structureStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.StructureStatementSyntax), if([inherits] IsNot Nothing, [inherits].Green, Nothing), if([implements] IsNot Nothing, [implements].Green, Nothing), if(members IsNot Nothing, members.Green, Nothing), DirectCast(endStructureStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Structure" statement that begins the block. ''' </summary> Public ReadOnly Property StructureStatement As StructureStatementSyntax Get Return GetRedAtZero(_structureStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the StructureStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithStructureStatement(structureStatement as StructureStatementSyntax) As StructureBlockSyntax return Update(structureStatement, Me.Inherits, Me.Implements, Me.Members, Me.EndStructureStatement) End Function ''' <summary> ''' A list of the Inherits declarations for the type. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property [Inherits] As SyntaxList(Of InheritsStatementSyntax) Get Dim listNode = GetRed(_inherits, 1) Return new SyntaxList(Of InheritsStatementSyntax)(listNode) End Get End Property Friend Overrides Function GetInheritsCore() As SyntaxList(Of InheritsStatementSyntax) Return Me.[Inherits] End Function Friend Overrides Function WithInheritsCore([inherits] As SyntaxList(Of InheritsStatementSyntax)) As TypeBlockSyntax Return WithInherits([inherits]) End Function ''' <summary> ''' Returns a copy of this with the [Inherits] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInherits([inherits] as SyntaxList(Of InheritsStatementSyntax)) As StructureBlockSyntax return Update(Me.StructureStatement, [inherits], Me.Implements, Me.Members, Me.EndStructureStatement) End Function Public Shadows Function AddInherits(ParamArray items As InheritsStatementSyntax()) As StructureBlockSyntax Return Me.WithInherits(Me.Inherits.AddRange(items)) End Function Friend Overrides Function AddInheritsCore(ParamArray items As InheritsStatementSyntax()) As TypeBlockSyntax Return AddInherits(items) End Function ''' <summary> ''' A list of the Implements declarations for the type. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property [Implements] As SyntaxList(Of ImplementsStatementSyntax) Get Dim listNode = GetRed(_implements, 2) Return new SyntaxList(Of ImplementsStatementSyntax)(listNode) End Get End Property Friend Overrides Function GetImplementsCore() As SyntaxList(Of ImplementsStatementSyntax) Return Me.[Implements] End Function Friend Overrides Function WithImplementsCore([implements] As SyntaxList(Of ImplementsStatementSyntax)) As TypeBlockSyntax Return WithImplements([implements]) End Function ''' <summary> ''' Returns a copy of this with the [Implements] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithImplements([implements] as SyntaxList(Of ImplementsStatementSyntax)) As StructureBlockSyntax return Update(Me.StructureStatement, Me.Inherits, [implements], Me.Members, Me.EndStructureStatement) End Function Public Shadows Function AddImplements(ParamArray items As ImplementsStatementSyntax()) As StructureBlockSyntax Return Me.WithImplements(Me.Implements.AddRange(items)) End Function Friend Overrides Function AddImplementsCore(ParamArray items As ImplementsStatementSyntax()) As TypeBlockSyntax Return AddImplements(items) End Function ''' <summary> ''' The declarations contained in the type or module. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Members As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_members, 3) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property Friend Overrides Function GetMembersCore() As SyntaxList(Of StatementSyntax) Return Me.Members End Function Friend Overrides Function WithMembersCore(members As SyntaxList(Of StatementSyntax)) As TypeBlockSyntax Return WithMembers(members) End Function ''' <summary> ''' Returns a copy of this with the Members property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithMembers(members as SyntaxList(Of StatementSyntax)) As StructureBlockSyntax return Update(Me.StructureStatement, Me.Inherits, Me.Implements, members, Me.EndStructureStatement) End Function Public Shadows Function AddMembers(ParamArray items As StatementSyntax()) As StructureBlockSyntax Return Me.WithMembers(Me.Members.AddRange(items)) End Function Friend Overrides Function AddMembersCore(ParamArray items As StatementSyntax()) As TypeBlockSyntax Return AddMembers(items) End Function ''' <summary> ''' The "End Structure" statement that ends the block. ''' </summary> Public ReadOnly Property EndStructureStatement As EndBlockStatementSyntax Get Return GetRed(_endStructureStatement, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the EndStructureStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndStructureStatement(endStructureStatement as EndBlockStatementSyntax) As StructureBlockSyntax return Update(Me.StructureStatement, Me.Inherits, Me.Implements, Me.Members, endStructureStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._structureStatement Case 1 Return Me._inherits Case 2 Return Me._implements Case 3 Return Me._members Case 4 Return Me._endStructureStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.StructureStatement Case 1 Return GetRed(_inherits, 1) Case 2 Return GetRed(_implements, 2) Case 3 Return GetRed(_members, 3) Case 4 Return Me.EndStructureStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitStructureBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitStructureBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="structureStatement"> ''' The value for the StructureStatement property. ''' </param> ''' <param name="inherits"> ''' The value for the Inherits property. ''' </param> ''' <param name="implements"> ''' The value for the Implements property. ''' </param> ''' <param name="members"> ''' The value for the Members property. ''' </param> ''' <param name="endStructureStatement"> ''' The value for the EndStructureStatement property. ''' </param> Public Function Update(structureStatement As StructureStatementSyntax, [inherits] As SyntaxList(of InheritsStatementSyntax), [implements] As SyntaxList(of ImplementsStatementSyntax), members As SyntaxList(of StatementSyntax), endStructureStatement As EndBlockStatementSyntax) As StructureBlockSyntax If structureStatement IsNot Me.StructureStatement OrElse [inherits] <> Me.[Inherits] OrElse [implements] <> Me.[Implements] OrElse members <> Me.Members OrElse endStructureStatement IsNot Me.EndStructureStatement Then Dim newNode = SyntaxFactory.StructureBlock(structureStatement, [inherits], [implements], members, endStructureStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a declaration of a Interface, its contents and the End statement ''' that ends it. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.InterfaceBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class InterfaceBlockSyntax Inherits TypeBlockSyntax Friend _interfaceStatement as InterfaceStatementSyntax Friend _endInterfaceStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), interfaceStatement As InterfaceStatementSyntax, [inherits] As SyntaxNode, [implements] As SyntaxNode, members As SyntaxNode, endInterfaceStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterfaceBlockSyntax(kind, errors, annotations, DirectCast(interfaceStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterfaceStatementSyntax), if([inherits] IsNot Nothing, [inherits].Green, Nothing), if([implements] IsNot Nothing, [implements].Green, Nothing), if(members IsNot Nothing, members.Green, Nothing), DirectCast(endInterfaceStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Interface" statement that begins the block. ''' </summary> Public ReadOnly Property InterfaceStatement As InterfaceStatementSyntax Get Return GetRedAtZero(_interfaceStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the InterfaceStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithInterfaceStatement(interfaceStatement as InterfaceStatementSyntax) As InterfaceBlockSyntax return Update(interfaceStatement, Me.Inherits, Me.Implements, Me.Members, Me.EndInterfaceStatement) End Function ''' <summary> ''' A list of the Inherits declarations for the type. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property [Inherits] As SyntaxList(Of InheritsStatementSyntax) Get Dim listNode = GetRed(_inherits, 1) Return new SyntaxList(Of InheritsStatementSyntax)(listNode) End Get End Property Friend Overrides Function GetInheritsCore() As SyntaxList(Of InheritsStatementSyntax) Return Me.[Inherits] End Function Friend Overrides Function WithInheritsCore([inherits] As SyntaxList(Of InheritsStatementSyntax)) As TypeBlockSyntax Return WithInherits([inherits]) End Function ''' <summary> ''' Returns a copy of this with the [Inherits] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInherits([inherits] as SyntaxList(Of InheritsStatementSyntax)) As InterfaceBlockSyntax return Update(Me.InterfaceStatement, [inherits], Me.Implements, Me.Members, Me.EndInterfaceStatement) End Function Public Shadows Function AddInherits(ParamArray items As InheritsStatementSyntax()) As InterfaceBlockSyntax Return Me.WithInherits(Me.Inherits.AddRange(items)) End Function Friend Overrides Function AddInheritsCore(ParamArray items As InheritsStatementSyntax()) As TypeBlockSyntax Return AddInherits(items) End Function ''' <summary> ''' A list of the Implements declarations for the type. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property [Implements] As SyntaxList(Of ImplementsStatementSyntax) Get Dim listNode = GetRed(_implements, 2) Return new SyntaxList(Of ImplementsStatementSyntax)(listNode) End Get End Property Friend Overrides Function GetImplementsCore() As SyntaxList(Of ImplementsStatementSyntax) Return Me.[Implements] End Function Friend Overrides Function WithImplementsCore([implements] As SyntaxList(Of ImplementsStatementSyntax)) As TypeBlockSyntax Return WithImplements([implements]) End Function ''' <summary> ''' Returns a copy of this with the [Implements] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithImplements([implements] as SyntaxList(Of ImplementsStatementSyntax)) As InterfaceBlockSyntax return Update(Me.InterfaceStatement, Me.Inherits, [implements], Me.Members, Me.EndInterfaceStatement) End Function Public Shadows Function AddImplements(ParamArray items As ImplementsStatementSyntax()) As InterfaceBlockSyntax Return Me.WithImplements(Me.Implements.AddRange(items)) End Function Friend Overrides Function AddImplementsCore(ParamArray items As ImplementsStatementSyntax()) As TypeBlockSyntax Return AddImplements(items) End Function ''' <summary> ''' The declarations contained in the type or module. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Members As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_members, 3) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property Friend Overrides Function GetMembersCore() As SyntaxList(Of StatementSyntax) Return Me.Members End Function Friend Overrides Function WithMembersCore(members As SyntaxList(Of StatementSyntax)) As TypeBlockSyntax Return WithMembers(members) End Function ''' <summary> ''' Returns a copy of this with the Members property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithMembers(members as SyntaxList(Of StatementSyntax)) As InterfaceBlockSyntax return Update(Me.InterfaceStatement, Me.Inherits, Me.Implements, members, Me.EndInterfaceStatement) End Function Public Shadows Function AddMembers(ParamArray items As StatementSyntax()) As InterfaceBlockSyntax Return Me.WithMembers(Me.Members.AddRange(items)) End Function Friend Overrides Function AddMembersCore(ParamArray items As StatementSyntax()) As TypeBlockSyntax Return AddMembers(items) End Function ''' <summary> ''' The "End Interface" statement that ends the block. ''' </summary> Public ReadOnly Property EndInterfaceStatement As EndBlockStatementSyntax Get Return GetRed(_endInterfaceStatement, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the EndInterfaceStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndInterfaceStatement(endInterfaceStatement as EndBlockStatementSyntax) As InterfaceBlockSyntax return Update(Me.InterfaceStatement, Me.Inherits, Me.Implements, Me.Members, endInterfaceStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._interfaceStatement Case 1 Return Me._inherits Case 2 Return Me._implements Case 3 Return Me._members Case 4 Return Me._endInterfaceStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.InterfaceStatement Case 1 Return GetRed(_inherits, 1) Case 2 Return GetRed(_implements, 2) Case 3 Return GetRed(_members, 3) Case 4 Return Me.EndInterfaceStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitInterfaceBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitInterfaceBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="interfaceStatement"> ''' The value for the InterfaceStatement property. ''' </param> ''' <param name="inherits"> ''' The value for the Inherits property. ''' </param> ''' <param name="implements"> ''' The value for the Implements property. ''' </param> ''' <param name="members"> ''' The value for the Members property. ''' </param> ''' <param name="endInterfaceStatement"> ''' The value for the EndInterfaceStatement property. ''' </param> Public Function Update(interfaceStatement As InterfaceStatementSyntax, [inherits] As SyntaxList(of InheritsStatementSyntax), [implements] As SyntaxList(of ImplementsStatementSyntax), members As SyntaxList(of StatementSyntax), endInterfaceStatement As EndBlockStatementSyntax) As InterfaceBlockSyntax If interfaceStatement IsNot Me.InterfaceStatement OrElse [inherits] <> Me.[Inherits] OrElse [implements] <> Me.[Implements] OrElse members <> Me.Members OrElse endInterfaceStatement IsNot Me.EndInterfaceStatement Then Dim newNode = SyntaxFactory.InterfaceBlock(interfaceStatement, [inherits], [implements], members, endInterfaceStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a declaration of a Class its contents and the End statement that ''' ends it. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ClassBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ClassBlockSyntax Inherits TypeBlockSyntax Friend _classStatement as ClassStatementSyntax Friend _endClassStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), classStatement As ClassStatementSyntax, [inherits] As SyntaxNode, [implements] As SyntaxNode, members As SyntaxNode, endClassStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ClassBlockSyntax(kind, errors, annotations, DirectCast(classStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ClassStatementSyntax), if([inherits] IsNot Nothing, [inherits].Green, Nothing), if([implements] IsNot Nothing, [implements].Green, Nothing), if(members IsNot Nothing, members.Green, Nothing), DirectCast(endClassStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Class" statement that begins the block. ''' </summary> Public ReadOnly Property ClassStatement As ClassStatementSyntax Get Return GetRedAtZero(_classStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the ClassStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithClassStatement(classStatement as ClassStatementSyntax) As ClassBlockSyntax return Update(classStatement, Me.Inherits, Me.Implements, Me.Members, Me.EndClassStatement) End Function ''' <summary> ''' A list of the Inherits declarations for the type. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property [Inherits] As SyntaxList(Of InheritsStatementSyntax) Get Dim listNode = GetRed(_inherits, 1) Return new SyntaxList(Of InheritsStatementSyntax)(listNode) End Get End Property Friend Overrides Function GetInheritsCore() As SyntaxList(Of InheritsStatementSyntax) Return Me.[Inherits] End Function Friend Overrides Function WithInheritsCore([inherits] As SyntaxList(Of InheritsStatementSyntax)) As TypeBlockSyntax Return WithInherits([inherits]) End Function ''' <summary> ''' Returns a copy of this with the [Inherits] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInherits([inherits] as SyntaxList(Of InheritsStatementSyntax)) As ClassBlockSyntax return Update(Me.ClassStatement, [inherits], Me.Implements, Me.Members, Me.EndClassStatement) End Function Public Shadows Function AddInherits(ParamArray items As InheritsStatementSyntax()) As ClassBlockSyntax Return Me.WithInherits(Me.Inherits.AddRange(items)) End Function Friend Overrides Function AddInheritsCore(ParamArray items As InheritsStatementSyntax()) As TypeBlockSyntax Return AddInherits(items) End Function ''' <summary> ''' A list of the Implements declarations for the type. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property [Implements] As SyntaxList(Of ImplementsStatementSyntax) Get Dim listNode = GetRed(_implements, 2) Return new SyntaxList(Of ImplementsStatementSyntax)(listNode) End Get End Property Friend Overrides Function GetImplementsCore() As SyntaxList(Of ImplementsStatementSyntax) Return Me.[Implements] End Function Friend Overrides Function WithImplementsCore([implements] As SyntaxList(Of ImplementsStatementSyntax)) As TypeBlockSyntax Return WithImplements([implements]) End Function ''' <summary> ''' Returns a copy of this with the [Implements] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithImplements([implements] as SyntaxList(Of ImplementsStatementSyntax)) As ClassBlockSyntax return Update(Me.ClassStatement, Me.Inherits, [implements], Me.Members, Me.EndClassStatement) End Function Public Shadows Function AddImplements(ParamArray items As ImplementsStatementSyntax()) As ClassBlockSyntax Return Me.WithImplements(Me.Implements.AddRange(items)) End Function Friend Overrides Function AddImplementsCore(ParamArray items As ImplementsStatementSyntax()) As TypeBlockSyntax Return AddImplements(items) End Function ''' <summary> ''' The declarations contained in the type or module. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Members As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_members, 3) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property Friend Overrides Function GetMembersCore() As SyntaxList(Of StatementSyntax) Return Me.Members End Function Friend Overrides Function WithMembersCore(members As SyntaxList(Of StatementSyntax)) As TypeBlockSyntax Return WithMembers(members) End Function ''' <summary> ''' Returns a copy of this with the Members property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithMembers(members as SyntaxList(Of StatementSyntax)) As ClassBlockSyntax return Update(Me.ClassStatement, Me.Inherits, Me.Implements, members, Me.EndClassStatement) End Function Public Shadows Function AddMembers(ParamArray items As StatementSyntax()) As ClassBlockSyntax Return Me.WithMembers(Me.Members.AddRange(items)) End Function Friend Overrides Function AddMembersCore(ParamArray items As StatementSyntax()) As TypeBlockSyntax Return AddMembers(items) End Function ''' <summary> ''' The "End Class" statement that ends the block. ''' </summary> Public ReadOnly Property EndClassStatement As EndBlockStatementSyntax Get Return GetRed(_endClassStatement, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the EndClassStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndClassStatement(endClassStatement as EndBlockStatementSyntax) As ClassBlockSyntax return Update(Me.ClassStatement, Me.Inherits, Me.Implements, Me.Members, endClassStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._classStatement Case 1 Return Me._inherits Case 2 Return Me._implements Case 3 Return Me._members Case 4 Return Me._endClassStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.ClassStatement Case 1 Return GetRed(_inherits, 1) Case 2 Return GetRed(_implements, 2) Case 3 Return GetRed(_members, 3) Case 4 Return Me.EndClassStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitClassBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitClassBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="classStatement"> ''' The value for the ClassStatement property. ''' </param> ''' <param name="inherits"> ''' The value for the Inherits property. ''' </param> ''' <param name="implements"> ''' The value for the Implements property. ''' </param> ''' <param name="members"> ''' The value for the Members property. ''' </param> ''' <param name="endClassStatement"> ''' The value for the EndClassStatement property. ''' </param> Public Function Update(classStatement As ClassStatementSyntax, [inherits] As SyntaxList(of InheritsStatementSyntax), [implements] As SyntaxList(of ImplementsStatementSyntax), members As SyntaxList(of StatementSyntax), endClassStatement As EndBlockStatementSyntax) As ClassBlockSyntax If classStatement IsNot Me.ClassStatement OrElse [inherits] <> Me.[Inherits] OrElse [implements] <> Me.[Implements] OrElse members <> Me.Members OrElse endClassStatement IsNot Me.EndClassStatement Then Dim newNode = SyntaxFactory.ClassBlock(classStatement, [inherits], [implements], members, endClassStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a declaration of an Enum, its contents and the End Enum statement ''' that ends it. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EnumBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EnumBlockSyntax Inherits DeclarationStatementSyntax Friend _enumStatement as EnumStatementSyntax Friend _members as SyntaxNode Friend _endEnumStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), enumStatement As EnumStatementSyntax, members As SyntaxNode, endEnumStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnumBlockSyntax(kind, errors, annotations, DirectCast(enumStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnumStatementSyntax), if(members IsNot Nothing, members.Green, Nothing), DirectCast(endEnumStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The statement that begins the type or module. ''' </summary> Public ReadOnly Property EnumStatement As EnumStatementSyntax Get Return GetRedAtZero(_enumStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the EnumStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEnumStatement(enumStatement as EnumStatementSyntax) As EnumBlockSyntax return Update(enumStatement, Me.Members, Me.EndEnumStatement) End Function ''' <summary> ''' The declarations contained in the enumeration. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Members As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_members, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Members property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithMembers(members as SyntaxList(Of StatementSyntax)) As EnumBlockSyntax return Update(Me.EnumStatement, members, Me.EndEnumStatement) End Function Public Shadows Function AddMembers(ParamArray items As StatementSyntax()) As EnumBlockSyntax Return Me.WithMembers(Me.Members.AddRange(items)) End Function ''' <summary> ''' The End XXX statement that ends the block. ''' </summary> Public ReadOnly Property EndEnumStatement As EndBlockStatementSyntax Get Return GetRed(_endEnumStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndEnumStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndEnumStatement(endEnumStatement as EndBlockStatementSyntax) As EnumBlockSyntax return Update(Me.EnumStatement, Me.Members, endEnumStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._enumStatement Case 1 Return Me._members Case 2 Return Me._endEnumStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.EnumStatement Case 1 Return GetRed(_members, 1) Case 2 Return Me.EndEnumStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEnumBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEnumBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="enumStatement"> ''' The value for the EnumStatement property. ''' </param> ''' <param name="members"> ''' The value for the Members property. ''' </param> ''' <param name="endEnumStatement"> ''' The value for the EndEnumStatement property. ''' </param> Public Function Update(enumStatement As EnumStatementSyntax, members As SyntaxList(of StatementSyntax), endEnumStatement As EndBlockStatementSyntax) As EnumBlockSyntax If enumStatement IsNot Me.EnumStatement OrElse members <> Me.Members OrElse endEnumStatement IsNot Me.EndEnumStatement Then Dim newNode = SyntaxFactory.EnumBlock(enumStatement, members, endEnumStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an Inherits or Implements statement in a Class, Structure or ''' Interface. ''' </summary> Public MustInherit Class InheritsOrImplementsStatementSyntax Inherits DeclarationStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents an Inherits statement in a Class, Structure or Interface. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.InheritsStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class InheritsStatementSyntax Inherits InheritsOrImplementsStatementSyntax Friend _types as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), inheritsKeyword As InternalSyntax.KeywordSyntax, types As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InheritsStatementSyntax(kind, errors, annotations, inheritsKeyword, if(types IsNot Nothing, types.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Inherits" keyword. ''' </summary> Public ReadOnly Property InheritsKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InheritsStatementSyntax)._inheritsKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the InheritsKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithInheritsKeyword(inheritsKeyword as SyntaxToken) As InheritsStatementSyntax return Update(inheritsKeyword, Me.Types) End Function ''' <summary> ''' A list of the types being inherited. ''' </summary> Public ReadOnly Property Types As SeparatedSyntaxList(Of TypeSyntax) Get Dim listNode = GetRed(_types, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of TypeSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Types property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithTypes(types as SeparatedSyntaxList(Of TypeSyntax)) As InheritsStatementSyntax return Update(Me.InheritsKeyword, types) End Function Public Shadows Function AddTypes(ParamArray items As TypeSyntax()) As InheritsStatementSyntax Return Me.WithTypes(Me.Types.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._types Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_types, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitInheritsStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitInheritsStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="inheritsKeyword"> ''' The value for the InheritsKeyword property. ''' </param> ''' <param name="types"> ''' The value for the Types property. ''' </param> Public Function Update(inheritsKeyword As SyntaxToken, types As SeparatedSyntaxList(Of TypeSyntax)) As InheritsStatementSyntax If inheritsKeyword <> Me.InheritsKeyword OrElse types <> Me.Types Then Dim newNode = SyntaxFactory.InheritsStatement(inheritsKeyword, types) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an Implements statement in a Class or Structure. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ImplementsStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ImplementsStatementSyntax Inherits InheritsOrImplementsStatementSyntax Friend _types as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), implementsKeyword As InternalSyntax.KeywordSyntax, types As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImplementsStatementSyntax(kind, errors, annotations, implementsKeyword, if(types IsNot Nothing, types.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Implements" keyword. ''' </summary> Public ReadOnly Property ImplementsKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImplementsStatementSyntax)._implementsKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ImplementsKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithImplementsKeyword(implementsKeyword as SyntaxToken) As ImplementsStatementSyntax return Update(implementsKeyword, Me.Types) End Function ''' <summary> ''' A list of the types being implemented. ''' </summary> Public ReadOnly Property Types As SeparatedSyntaxList(Of TypeSyntax) Get Dim listNode = GetRed(_types, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of TypeSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Types property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithTypes(types as SeparatedSyntaxList(Of TypeSyntax)) As ImplementsStatementSyntax return Update(Me.ImplementsKeyword, types) End Function Public Shadows Function AddTypes(ParamArray items As TypeSyntax()) As ImplementsStatementSyntax Return Me.WithTypes(Me.Types.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._types Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_types, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitImplementsStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitImplementsStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="implementsKeyword"> ''' The value for the ImplementsKeyword property. ''' </param> ''' <param name="types"> ''' The value for the Types property. ''' </param> Public Function Update(implementsKeyword As SyntaxToken, types As SeparatedSyntaxList(Of TypeSyntax)) As ImplementsStatementSyntax If implementsKeyword <> Me.ImplementsKeyword OrElse types <> Me.Types Then Dim newNode = SyntaxFactory.ImplementsStatement(implementsKeyword, types) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Abstract class for the beginning statement of a Module, Class, Interface or ''' Structure declaration. This node always appears as the Begin of a TypeBlock ''' with Kind=ModuleDeclarationBlock, ClassDeclarationBlock, ''' InterfaceDeclarationBlock or StructureDeclarationBlock. ''' </summary> Public MustInherit Class TypeStatementSyntax Inherits DeclarationStatementSyntax Friend _attributeLists as SyntaxNode Friend _typeParameterList as TypeParameterListSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Return Me.GetAttributeListsCore() End Get End Property Friend Overridable Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Function WithAttributeLists(attributeLists As SyntaxList(Of AttributeListSyntax)) As TypeStatementSyntax Return WithAttributeListsCore(attributeLists) End Function Friend MustOverride Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As TypeStatementSyntax Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As TypeStatementSyntax Return AddAttributeListsCore(items) End Function Friend MustOverride Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As TypeStatementSyntax ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Modifiers As SyntaxTokenList Get Return Me.GetModifiersCore() End Get End Property Friend Overridable Function GetModifiersCore() As SyntaxTokenList Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithModifiers(modifiers As SyntaxTokenList) As TypeStatementSyntax Return WithModifiersCore(modifiers) End Function Friend MustOverride Function WithModifiersCore(modifiers As SyntaxTokenList) As TypeStatementSyntax Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As TypeStatementSyntax Return AddModifiersCore(items) End Function Friend MustOverride Function AddModifiersCore(ParamArray items As SyntaxToken()) As TypeStatementSyntax ''' <summary> ''' The name of the type being declared. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get Return Me.GetIdentifierCore() End Get End Property Friend Overridable Function GetIdentifierCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeStatementSyntax)._identifier, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Function ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithIdentifier(identifier As SyntaxToken) As TypeStatementSyntax Return WithIdentifierCore(identifier) End Function Friend MustOverride Function WithIdentifierCore(identifier As SyntaxToken) As TypeStatementSyntax ''' <summary> ''' If present, a type parameter list with generic parameters for this type. If no ''' generic parameters were present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property TypeParameterList As TypeParameterListSyntax Get Return Me.GetTypeParameterListCore() End Get End Property Friend Overridable Function GetTypeParameterListCore() As TypeParameterListSyntax Return GetRed(_typeParameterList, 3) End Function ''' <summary> ''' Returns a copy of this with the TypeParameterList property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Function WithTypeParameterList(typeParameterList As TypeParameterListSyntax) As TypeStatementSyntax Return WithTypeParameterListCore(typeParameterList) End Function Friend MustOverride Function WithTypeParameterListCore(typeParameterList As TypeParameterListSyntax) As TypeStatementSyntax Public Shadows Function AddTypeParameterListParameters(ParamArray items As TypeParameterSyntax()) As TypeStatementSyntax Return AddTypeParameterListParametersCore(items) End Function Friend MustOverride Function AddTypeParameterListParametersCore(ParamArray items As TypeParameterSyntax()) As TypeStatementSyntax End Class ''' <summary> ''' Represents the beginning statement of a Module declaration. This node always ''' appears as the Begin of a TypeBlock with Kind=ModuleDeclarationBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ModuleStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ModuleStatementSyntax Inherits TypeStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, moduleKeyword As InternalSyntax.KeywordSyntax, identifier As InternalSyntax.IdentifierTokenSyntax, typeParameterList As TypeParameterListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModuleStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, moduleKeyword, identifier, if(typeParameterList IsNot Nothing, DirectCast(typeParameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterListSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As TypeStatementSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As ModuleStatementSyntax return Update(attributeLists, Me.Modifiers, Me.ModuleKeyword, Me.Identifier, Me.TypeParameterList) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As ModuleStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As TypeStatementSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModuleStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As TypeStatementSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As ModuleStatementSyntax return Update(Me.AttributeLists, modifiers, Me.ModuleKeyword, Me.Identifier, Me.TypeParameterList) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As ModuleStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As TypeStatementSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Module" keyword. ''' </summary> Public ReadOnly Property ModuleKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModuleStatementSyntax)._moduleKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the ModuleKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModuleKeyword(moduleKeyword as SyntaxToken) As ModuleStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, moduleKeyword, Me.Identifier, Me.TypeParameterList) End Function ''' <summary> ''' The name of the type being declared. ''' </summary> Public Shadows ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModuleStatementSyntax)._identifier, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property Friend Overrides Function GetIdentifierCore() As SyntaxToken Return Me.Identifier End Function Friend Overrides Function WithIdentifierCore(identifier As SyntaxToken) As TypeStatementSyntax Return WithIdentifier(identifier) End Function ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As ModuleStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.ModuleKeyword, identifier, Me.TypeParameterList) End Function ''' <summary> ''' If present, a type parameter list with generic parameters for this type. If no ''' generic parameters were present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property TypeParameterList As TypeParameterListSyntax Get Return GetRed(_typeParameterList, 4) End Get End Property Friend Overrides Function GetTypeParameterListCore() As TypeParameterListSyntax Return Me.TypeParameterList End Function Friend Overrides Function WithTypeParameterListCore(typeParameterList As TypeParameterListSyntax) As TypeStatementSyntax Return WithTypeParameterList(typeParameterList) End Function ''' <summary> ''' Returns a copy of this with the TypeParameterList property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithTypeParameterList(typeParameterList as TypeParameterListSyntax) As ModuleStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.ModuleKeyword, Me.Identifier, typeParameterList) End Function Public Shadows Function AddTypeParameterListParameters(ParamArray items As TypeParameterSyntax()) As ModuleStatementSyntax Dim _child = If(Me.TypeParameterList IsNot Nothing, Me.TypeParameterList, SyntaxFactory.TypeParameterList()) Return Me.WithTypeParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddTypeParameterListParametersCore(ParamArray items As TypeParameterSyntax()) As TypeStatementSyntax Return AddTypeParameterListParameters(items) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 4 Return Me._typeParameterList Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 4 Return Me.TypeParameterList Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitModuleStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitModuleStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="moduleKeyword"> ''' The value for the ModuleKeyword property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="typeParameterList"> ''' The value for the TypeParameterList property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, moduleKeyword As SyntaxToken, identifier As SyntaxToken, typeParameterList As TypeParameterListSyntax) As ModuleStatementSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse moduleKeyword <> Me.ModuleKeyword OrElse identifier <> Me.Identifier OrElse typeParameterList IsNot Me.TypeParameterList Then Dim newNode = SyntaxFactory.ModuleStatement(attributeLists, modifiers, moduleKeyword, identifier, typeParameterList) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the beginning statement of a Structure declaration. This node always ''' appears as the Begin of a TypeBlock with Kind=StructureDeclarationBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.StructureStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class StructureStatementSyntax Inherits TypeStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, structureKeyword As InternalSyntax.KeywordSyntax, identifier As InternalSyntax.IdentifierTokenSyntax, typeParameterList As TypeParameterListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.StructureStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, structureKeyword, identifier, if(typeParameterList IsNot Nothing, DirectCast(typeParameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterListSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As TypeStatementSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As StructureStatementSyntax return Update(attributeLists, Me.Modifiers, Me.StructureKeyword, Me.Identifier, Me.TypeParameterList) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As StructureStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As TypeStatementSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.StructureStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As TypeStatementSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As StructureStatementSyntax return Update(Me.AttributeLists, modifiers, Me.StructureKeyword, Me.Identifier, Me.TypeParameterList) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As StructureStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As TypeStatementSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Structure" keyword. ''' </summary> Public ReadOnly Property StructureKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.StructureStatementSyntax)._structureKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the StructureKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithStructureKeyword(structureKeyword as SyntaxToken) As StructureStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, structureKeyword, Me.Identifier, Me.TypeParameterList) End Function ''' <summary> ''' The name of the type being declared. ''' </summary> Public Shadows ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.StructureStatementSyntax)._identifier, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property Friend Overrides Function GetIdentifierCore() As SyntaxToken Return Me.Identifier End Function Friend Overrides Function WithIdentifierCore(identifier As SyntaxToken) As TypeStatementSyntax Return WithIdentifier(identifier) End Function ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As StructureStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.StructureKeyword, identifier, Me.TypeParameterList) End Function ''' <summary> ''' If present, a type parameter list with generic parameters for this type. If no ''' generic parameters were present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property TypeParameterList As TypeParameterListSyntax Get Return GetRed(_typeParameterList, 4) End Get End Property Friend Overrides Function GetTypeParameterListCore() As TypeParameterListSyntax Return Me.TypeParameterList End Function Friend Overrides Function WithTypeParameterListCore(typeParameterList As TypeParameterListSyntax) As TypeStatementSyntax Return WithTypeParameterList(typeParameterList) End Function ''' <summary> ''' Returns a copy of this with the TypeParameterList property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithTypeParameterList(typeParameterList as TypeParameterListSyntax) As StructureStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.StructureKeyword, Me.Identifier, typeParameterList) End Function Public Shadows Function AddTypeParameterListParameters(ParamArray items As TypeParameterSyntax()) As StructureStatementSyntax Dim _child = If(Me.TypeParameterList IsNot Nothing, Me.TypeParameterList, SyntaxFactory.TypeParameterList()) Return Me.WithTypeParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddTypeParameterListParametersCore(ParamArray items As TypeParameterSyntax()) As TypeStatementSyntax Return AddTypeParameterListParameters(items) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 4 Return Me._typeParameterList Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 4 Return Me.TypeParameterList Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitStructureStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitStructureStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="structureKeyword"> ''' The value for the StructureKeyword property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="typeParameterList"> ''' The value for the TypeParameterList property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, structureKeyword As SyntaxToken, identifier As SyntaxToken, typeParameterList As TypeParameterListSyntax) As StructureStatementSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse structureKeyword <> Me.StructureKeyword OrElse identifier <> Me.Identifier OrElse typeParameterList IsNot Me.TypeParameterList Then Dim newNode = SyntaxFactory.StructureStatement(attributeLists, modifiers, structureKeyword, identifier, typeParameterList) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the beginning statement of a Interface declaration. This node always ''' appears as the Begin of a TypeBlock with Kind=InterfaceDeclarationBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.InterfaceStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class InterfaceStatementSyntax Inherits TypeStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, interfaceKeyword As InternalSyntax.KeywordSyntax, identifier As InternalSyntax.IdentifierTokenSyntax, typeParameterList As TypeParameterListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterfaceStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, interfaceKeyword, identifier, if(typeParameterList IsNot Nothing, DirectCast(typeParameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterListSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As TypeStatementSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As InterfaceStatementSyntax return Update(attributeLists, Me.Modifiers, Me.InterfaceKeyword, Me.Identifier, Me.TypeParameterList) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As InterfaceStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As TypeStatementSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterfaceStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As TypeStatementSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As InterfaceStatementSyntax return Update(Me.AttributeLists, modifiers, Me.InterfaceKeyword, Me.Identifier, Me.TypeParameterList) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As InterfaceStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As TypeStatementSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Interface" keyword. ''' </summary> Public ReadOnly Property InterfaceKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterfaceStatementSyntax)._interfaceKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the InterfaceKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithInterfaceKeyword(interfaceKeyword as SyntaxToken) As InterfaceStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, interfaceKeyword, Me.Identifier, Me.TypeParameterList) End Function ''' <summary> ''' The name of the type being declared. ''' </summary> Public Shadows ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterfaceStatementSyntax)._identifier, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property Friend Overrides Function GetIdentifierCore() As SyntaxToken Return Me.Identifier End Function Friend Overrides Function WithIdentifierCore(identifier As SyntaxToken) As TypeStatementSyntax Return WithIdentifier(identifier) End Function ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As InterfaceStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.InterfaceKeyword, identifier, Me.TypeParameterList) End Function ''' <summary> ''' If present, a type parameter list with generic parameters for this type. If no ''' generic parameters were present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property TypeParameterList As TypeParameterListSyntax Get Return GetRed(_typeParameterList, 4) End Get End Property Friend Overrides Function GetTypeParameterListCore() As TypeParameterListSyntax Return Me.TypeParameterList End Function Friend Overrides Function WithTypeParameterListCore(typeParameterList As TypeParameterListSyntax) As TypeStatementSyntax Return WithTypeParameterList(typeParameterList) End Function ''' <summary> ''' Returns a copy of this with the TypeParameterList property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithTypeParameterList(typeParameterList as TypeParameterListSyntax) As InterfaceStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.InterfaceKeyword, Me.Identifier, typeParameterList) End Function Public Shadows Function AddTypeParameterListParameters(ParamArray items As TypeParameterSyntax()) As InterfaceStatementSyntax Dim _child = If(Me.TypeParameterList IsNot Nothing, Me.TypeParameterList, SyntaxFactory.TypeParameterList()) Return Me.WithTypeParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddTypeParameterListParametersCore(ParamArray items As TypeParameterSyntax()) As TypeStatementSyntax Return AddTypeParameterListParameters(items) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 4 Return Me._typeParameterList Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 4 Return Me.TypeParameterList Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitInterfaceStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitInterfaceStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="interfaceKeyword"> ''' The value for the InterfaceKeyword property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="typeParameterList"> ''' The value for the TypeParameterList property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, interfaceKeyword As SyntaxToken, identifier As SyntaxToken, typeParameterList As TypeParameterListSyntax) As InterfaceStatementSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse interfaceKeyword <> Me.InterfaceKeyword OrElse identifier <> Me.Identifier OrElse typeParameterList IsNot Me.TypeParameterList Then Dim newNode = SyntaxFactory.InterfaceStatement(attributeLists, modifiers, interfaceKeyword, identifier, typeParameterList) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the beginning statement of a Class declaration. This node always ''' appears as the Begin of a TypeBlock with Kind=ClassDeclarationBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ClassStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ClassStatementSyntax Inherits TypeStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, classKeyword As InternalSyntax.KeywordSyntax, identifier As InternalSyntax.IdentifierTokenSyntax, typeParameterList As TypeParameterListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ClassStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, classKeyword, identifier, if(typeParameterList IsNot Nothing, DirectCast(typeParameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterListSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As TypeStatementSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As ClassStatementSyntax return Update(attributeLists, Me.Modifiers, Me.ClassKeyword, Me.Identifier, Me.TypeParameterList) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As ClassStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As TypeStatementSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ClassStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As TypeStatementSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As ClassStatementSyntax return Update(Me.AttributeLists, modifiers, Me.ClassKeyword, Me.Identifier, Me.TypeParameterList) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As ClassStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As TypeStatementSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Class" keyword. ''' </summary> Public ReadOnly Property ClassKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ClassStatementSyntax)._classKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the ClassKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithClassKeyword(classKeyword as SyntaxToken) As ClassStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, classKeyword, Me.Identifier, Me.TypeParameterList) End Function ''' <summary> ''' The name of the type being declared. ''' </summary> Public Shadows ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ClassStatementSyntax)._identifier, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property Friend Overrides Function GetIdentifierCore() As SyntaxToken Return Me.Identifier End Function Friend Overrides Function WithIdentifierCore(identifier As SyntaxToken) As TypeStatementSyntax Return WithIdentifier(identifier) End Function ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As ClassStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.ClassKeyword, identifier, Me.TypeParameterList) End Function ''' <summary> ''' If present, a type parameter list with generic parameters for this type. If no ''' generic parameters were present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property TypeParameterList As TypeParameterListSyntax Get Return GetRed(_typeParameterList, 4) End Get End Property Friend Overrides Function GetTypeParameterListCore() As TypeParameterListSyntax Return Me.TypeParameterList End Function Friend Overrides Function WithTypeParameterListCore(typeParameterList As TypeParameterListSyntax) As TypeStatementSyntax Return WithTypeParameterList(typeParameterList) End Function ''' <summary> ''' Returns a copy of this with the TypeParameterList property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithTypeParameterList(typeParameterList as TypeParameterListSyntax) As ClassStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.ClassKeyword, Me.Identifier, typeParameterList) End Function Public Shadows Function AddTypeParameterListParameters(ParamArray items As TypeParameterSyntax()) As ClassStatementSyntax Dim _child = If(Me.TypeParameterList IsNot Nothing, Me.TypeParameterList, SyntaxFactory.TypeParameterList()) Return Me.WithTypeParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddTypeParameterListParametersCore(ParamArray items As TypeParameterSyntax()) As TypeStatementSyntax Return AddTypeParameterListParameters(items) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 4 Return Me._typeParameterList Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 4 Return Me.TypeParameterList Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitClassStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitClassStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="classKeyword"> ''' The value for the ClassKeyword property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="typeParameterList"> ''' The value for the TypeParameterList property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, classKeyword As SyntaxToken, identifier As SyntaxToken, typeParameterList As TypeParameterListSyntax) As ClassStatementSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse classKeyword <> Me.ClassKeyword OrElse identifier <> Me.Identifier OrElse typeParameterList IsNot Me.TypeParameterList Then Dim newNode = SyntaxFactory.ClassStatement(attributeLists, modifiers, classKeyword, identifier, typeParameterList) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the beginning statement of an Enum declaration. This node always ''' appears as the Begin of an EnumBlock with Kind=EnumDeclarationBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EnumStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EnumStatementSyntax Inherits DeclarationStatementSyntax Friend _attributeLists as SyntaxNode Friend _underlyingType as AsClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, enumKeyword As InternalSyntax.KeywordSyntax, identifier As InternalSyntax.IdentifierTokenSyntax, underlyingType As AsClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnumStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, enumKeyword, identifier, if(underlyingType IsNot Nothing, DirectCast(underlyingType.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AsClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As EnumStatementSyntax return Update(attributeLists, Me.Modifiers, Me.EnumKeyword, Me.Identifier, Me.UnderlyingType) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As EnumStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnumStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As EnumStatementSyntax return Update(Me.AttributeLists, modifiers, Me.EnumKeyword, Me.Identifier, Me.UnderlyingType) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As EnumStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function ''' <summary> ''' The "Enum" keyword. ''' </summary> Public ReadOnly Property EnumKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnumStatementSyntax)._enumKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the EnumKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEnumKeyword(enumKeyword as SyntaxToken) As EnumStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, enumKeyword, Me.Identifier, Me.UnderlyingType) End Function ''' <summary> ''' The name of the enum being declared. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnumStatementSyntax)._identifier, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As EnumStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.EnumKeyword, identifier, Me.UnderlyingType) End Function ''' <summary> ''' Optional "As XXX" clause describing the underlying type of the enumeration. If ''' no As clause was specified, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property UnderlyingType As AsClauseSyntax Get Return GetRed(_underlyingType, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the UnderlyingType property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithUnderlyingType(underlyingType as AsClauseSyntax) As EnumStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.EnumKeyword, Me.Identifier, underlyingType) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 4 Return Me._underlyingType Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 4 Return Me.UnderlyingType Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEnumStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEnumStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="enumKeyword"> ''' The value for the EnumKeyword property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="underlyingType"> ''' The value for the UnderlyingType property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, enumKeyword As SyntaxToken, identifier As SyntaxToken, underlyingType As AsClauseSyntax) As EnumStatementSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse enumKeyword <> Me.EnumKeyword OrElse identifier <> Me.Identifier OrElse underlyingType IsNot Me.UnderlyingType Then Dim newNode = SyntaxFactory.EnumStatement(attributeLists, modifiers, enumKeyword, identifier, underlyingType) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the type parameter list in a declaration. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TypeParameterList"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TypeParameterListSyntax Inherits VisualBasicSyntaxNode Friend _parameters as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), openParenToken As InternalSyntax.PunctuationSyntax, ofKeyword As InternalSyntax.KeywordSyntax, parameters As SyntaxNode, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterListSyntax(kind, errors, annotations, openParenToken, ofKeyword, if(parameters IsNot Nothing, parameters.Green, Nothing), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "(" token. ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterListSyntax)._openParenToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As TypeParameterListSyntax return Update(openParenToken, Me.OfKeyword, Me.Parameters, Me.CloseParenToken) End Function ''' <summary> ''' The "Of" keyword. ''' </summary> Public ReadOnly Property OfKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterListSyntax)._ofKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OfKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOfKeyword(ofKeyword as SyntaxToken) As TypeParameterListSyntax return Update(Me.OpenParenToken, ofKeyword, Me.Parameters, Me.CloseParenToken) End Function ''' <summary> ''' A list of the type parameters. There must be at least one type parameter in the ''' list. ''' </summary> Public ReadOnly Property Parameters As SeparatedSyntaxList(Of TypeParameterSyntax) Get Dim listNode = GetRed(_parameters, 2) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of TypeParameterSyntax)(listNode, Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Parameters property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithParameters(parameters as SeparatedSyntaxList(Of TypeParameterSyntax)) As TypeParameterListSyntax return Update(Me.OpenParenToken, Me.OfKeyword, parameters, Me.CloseParenToken) End Function Public Shadows Function AddParameters(ParamArray items As TypeParameterSyntax()) As TypeParameterListSyntax Return Me.WithParameters(Me.Parameters.AddRange(items)) End Function ''' <summary> ''' The ")" token. ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterListSyntax)._closeParenToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As TypeParameterListSyntax return Update(Me.OpenParenToken, Me.OfKeyword, Me.Parameters, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._parameters Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return GetRed(_parameters, 2) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTypeParameterList(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTypeParameterList(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="ofKeyword"> ''' The value for the OfKeyword property. ''' </param> ''' <param name="parameters"> ''' The value for the Parameters property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(openParenToken As SyntaxToken, ofKeyword As SyntaxToken, parameters As SeparatedSyntaxList(Of TypeParameterSyntax), closeParenToken As SyntaxToken) As TypeParameterListSyntax If openParenToken <> Me.OpenParenToken OrElse ofKeyword <> Me.OfKeyword OrElse parameters <> Me.Parameters OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.TypeParameterList(openParenToken, ofKeyword, parameters, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a type parameter on a generic type declaration. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TypeParameter"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TypeParameterSyntax Inherits VisualBasicSyntaxNode Friend _typeParameterConstraintClause as TypeParameterConstraintClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), varianceKeyword As InternalSyntax.KeywordSyntax, identifier As InternalSyntax.IdentifierTokenSyntax, typeParameterConstraintClause As TypeParameterConstraintClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterSyntax(kind, errors, annotations, varianceKeyword, identifier, if(typeParameterConstraintClause IsNot Nothing, DirectCast(typeParameterConstraintClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterConstraintClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' Represents the "In" or "Out" variance keyword on a type parameter, if present. ''' If no variance modifier was present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property VarianceKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterSyntax)._varianceKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.Position, 0) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the VarianceKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithVarianceKeyword(varianceKeyword as SyntaxToken) As TypeParameterSyntax return Update(varianceKeyword, Me.Identifier, Me.TypeParameterConstraintClause) End Function ''' <summary> ''' The name of the type parameter ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterSyntax)._identifier, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As TypeParameterSyntax return Update(Me.VarianceKeyword, identifier, Me.TypeParameterConstraintClause) End Function ''' <summary> ''' The "As" keyword, if any type constraints were supplied. If no type constraints ''' were supplied, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property TypeParameterConstraintClause As TypeParameterConstraintClauseSyntax Get Return GetRed(_typeParameterConstraintClause, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the TypeParameterConstraintClause property changed ''' to the specified value. Returns this instance if the specified value is the ''' same as the current value. ''' </summary> Public Shadows Function WithTypeParameterConstraintClause(typeParameterConstraintClause as TypeParameterConstraintClauseSyntax) As TypeParameterSyntax return Update(Me.VarianceKeyword, Me.Identifier, typeParameterConstraintClause) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._typeParameterConstraintClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.TypeParameterConstraintClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTypeParameter(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTypeParameter(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="varianceKeyword"> ''' The value for the VarianceKeyword property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="typeParameterConstraintClause"> ''' The value for the TypeParameterConstraintClause property. ''' </param> Public Function Update(varianceKeyword As SyntaxToken, identifier As SyntaxToken, typeParameterConstraintClause As TypeParameterConstraintClauseSyntax) As TypeParameterSyntax If varianceKeyword <> Me.VarianceKeyword OrElse identifier <> Me.Identifier OrElse typeParameterConstraintClause IsNot Me.TypeParameterConstraintClause Then Dim newNode = SyntaxFactory.TypeParameter(varianceKeyword, identifier, typeParameterConstraintClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' An abstract node class that is the parent of classes that describe type ''' parameter constraint clauses. ''' </summary> Public MustInherit Class TypeParameterConstraintClauseSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' One of the type parameter constraints clauses. This represents a constraint ''' clause in the form of "As Constraint". ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TypeParameterSingleConstraintClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TypeParameterSingleConstraintClauseSyntax Inherits TypeParameterConstraintClauseSyntax Friend _constraint as ConstraintSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), asKeyword As InternalSyntax.KeywordSyntax, constraint As ConstraintSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterSingleConstraintClauseSyntax(kind, errors, annotations, asKeyword, DirectCast(constraint.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ConstraintSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "As" keyword, if any type constraints were supplied. If no type constraints ''' were supplied, Nothing is returned. ''' </summary> Public ReadOnly Property AsKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterSingleConstraintClauseSyntax)._asKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the AsKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsKeyword(asKeyword as SyntaxToken) As TypeParameterSingleConstraintClauseSyntax return Update(asKeyword, Me.Constraint) End Function ''' <summary> ''' A list of the supplied constraints. If no constraints were supplied, Nothing is ''' returned. ''' </summary> Public ReadOnly Property Constraint As ConstraintSyntax Get Return GetRed(_constraint, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Constraint property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithConstraint(constraint as ConstraintSyntax) As TypeParameterSingleConstraintClauseSyntax return Update(Me.AsKeyword, constraint) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._constraint Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Constraint Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTypeParameterSingleConstraintClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTypeParameterSingleConstraintClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="asKeyword"> ''' The value for the AsKeyword property. ''' </param> ''' <param name="constraint"> ''' The value for the Constraint property. ''' </param> Public Function Update(asKeyword As SyntaxToken, constraint As ConstraintSyntax) As TypeParameterSingleConstraintClauseSyntax If asKeyword <> Me.AsKeyword OrElse constraint IsNot Me.Constraint Then Dim newNode = SyntaxFactory.TypeParameterSingleConstraintClause(asKeyword, constraint) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' One of the type parameter constraints clauses. This represents a constraint ''' clause in the form of "As { Constraints }". ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TypeParameterMultipleConstraintClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TypeParameterMultipleConstraintClauseSyntax Inherits TypeParameterConstraintClauseSyntax Friend _constraints as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), asKeyword As InternalSyntax.KeywordSyntax, openBraceToken As InternalSyntax.PunctuationSyntax, constraints As SyntaxNode, closeBraceToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterMultipleConstraintClauseSyntax(kind, errors, annotations, asKeyword, openBraceToken, if(constraints IsNot Nothing, constraints.Green, Nothing), closeBraceToken), Nothing, 0) End Sub ''' <summary> ''' The "As" keyword. ''' </summary> Public ReadOnly Property AsKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterMultipleConstraintClauseSyntax)._asKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the AsKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsKeyword(asKeyword as SyntaxToken) As TypeParameterMultipleConstraintClauseSyntax return Update(asKeyword, Me.OpenBraceToken, Me.Constraints, Me.CloseBraceToken) End Function ''' <summary> ''' The "{" token. ''' </summary> Public ReadOnly Property OpenBraceToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterMultipleConstraintClauseSyntax)._openBraceToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenBraceToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenBraceToken(openBraceToken as SyntaxToken) As TypeParameterMultipleConstraintClauseSyntax return Update(Me.AsKeyword, openBraceToken, Me.Constraints, Me.CloseBraceToken) End Function ''' <summary> ''' A list of the supplied constraints. If no constraints were supplied, an empty ''' list is returned. ''' </summary> Public ReadOnly Property Constraints As SeparatedSyntaxList(Of ConstraintSyntax) Get Dim listNode = GetRed(_constraints, 2) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ConstraintSyntax)(listNode, Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Constraints property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithConstraints(constraints as SeparatedSyntaxList(Of ConstraintSyntax)) As TypeParameterMultipleConstraintClauseSyntax return Update(Me.AsKeyword, Me.OpenBraceToken, constraints, Me.CloseBraceToken) End Function Public Shadows Function AddConstraints(ParamArray items As ConstraintSyntax()) As TypeParameterMultipleConstraintClauseSyntax Return Me.WithConstraints(Me.Constraints.AddRange(items)) End Function ''' <summary> ''' The "}" token. ''' </summary> Public ReadOnly Property CloseBraceToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterMultipleConstraintClauseSyntax)._closeBraceToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseBraceToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseBraceToken(closeBraceToken as SyntaxToken) As TypeParameterMultipleConstraintClauseSyntax return Update(Me.AsKeyword, Me.OpenBraceToken, Me.Constraints, closeBraceToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._constraints Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return GetRed(_constraints, 2) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTypeParameterMultipleConstraintClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTypeParameterMultipleConstraintClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="asKeyword"> ''' The value for the AsKeyword property. ''' </param> ''' <param name="openBraceToken"> ''' The value for the OpenBraceToken property. ''' </param> ''' <param name="constraints"> ''' The value for the Constraints property. ''' </param> ''' <param name="closeBraceToken"> ''' The value for the CloseBraceToken property. ''' </param> Public Function Update(asKeyword As SyntaxToken, openBraceToken As SyntaxToken, constraints As SeparatedSyntaxList(Of ConstraintSyntax), closeBraceToken As SyntaxToken) As TypeParameterMultipleConstraintClauseSyntax If asKeyword <> Me.AsKeyword OrElse openBraceToken <> Me.OpenBraceToken OrElse constraints <> Me.Constraints OrElse closeBraceToken <> Me.CloseBraceToken Then Dim newNode = SyntaxFactory.TypeParameterMultipleConstraintClause(asKeyword, openBraceToken, constraints, closeBraceToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' An abstract node class that is the parent of classes that describe type ''' parameter constraints. ''' </summary> Public MustInherit Class ConstraintSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' One of the special type parameter constraints: New, Class or Structure. Which ''' kind of special constraint it is can be obtained from the Kind property and is ''' one of: NewConstraint, ReferenceConstraint or ValueConstraint. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.NewConstraint"/></description></item> ''' <item><description><see cref="SyntaxKind.ClassConstraint"/></description></item> ''' <item><description><see cref="SyntaxKind.StructureConstraint"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SpecialConstraintSyntax Inherits ConstraintSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), constraintKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SpecialConstraintSyntax(kind, errors, annotations, constraintKeyword), Nothing, 0) End Sub ''' <summary> ''' The "New", "Class" or "Structure" keyword that denotes the kind of special ''' constraint. ''' </summary> Public ReadOnly Property ConstraintKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SpecialConstraintSyntax)._constraintKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ConstraintKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithConstraintKeyword(constraintKeyword as SyntaxToken) As SpecialConstraintSyntax return Update(Me.Kind, constraintKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSpecialConstraint(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSpecialConstraint(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="constraintKeyword"> ''' The value for the ConstraintKeyword property. ''' </param> Public Function Update(kind As SyntaxKind, constraintKeyword As SyntaxToken) As SpecialConstraintSyntax If kind <> Me.Kind OrElse constraintKeyword <> Me.ConstraintKeyword Then Dim newNode = SyntaxFactory.SpecialConstraint(kind, constraintKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a type parameter constraint that is a type. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TypeConstraint"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TypeConstraintSyntax Inherits ConstraintSyntax Friend _type as TypeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), type As TypeSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeConstraintSyntax(kind, errors, annotations, DirectCast(type.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax)), Nothing, 0) End Sub ''' <summary> ''' The type describing the constraint. ''' </summary> Public ReadOnly Property Type As TypeSyntax Get Return GetRedAtZero(_type) End Get End Property ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithType(type as TypeSyntax) As TypeConstraintSyntax return Update(type) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Me._type Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode If i = 0 Then Return Me.Type Else Return Nothing End If End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTypeConstraint(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTypeConstraint(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="type"> ''' The value for the Type property. ''' </param> Public Function Update(type As TypeSyntax) As TypeConstraintSyntax If type IsNot Me.Type Then Dim newNode = SyntaxFactory.TypeConstraint(type) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a name and value in an EnumDeclarationBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EnumMemberDeclaration"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EnumMemberDeclarationSyntax Inherits DeclarationStatementSyntax Friend _attributeLists as SyntaxNode Friend _initializer as EqualsValueSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, identifier As InternalSyntax.IdentifierTokenSyntax, initializer As EqualsValueSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnumMemberDeclarationSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), identifier, if(initializer IsNot Nothing, DirectCast(initializer.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EqualsValueSyntax), Nothing)), Nothing, 0) End Sub ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As EnumMemberDeclarationSyntax return Update(attributeLists, Me.Identifier, Me.Initializer) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As EnumMemberDeclarationSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnumMemberDeclarationSyntax)._identifier, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As EnumMemberDeclarationSyntax return Update(Me.AttributeLists, identifier, Me.Initializer) End Function ''' <summary> ''' An optional value for the enum member. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Initializer As EqualsValueSyntax Get Return GetRed(_initializer, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Initializer property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInitializer(initializer as EqualsValueSyntax) As EnumMemberDeclarationSyntax return Update(Me.AttributeLists, Me.Identifier, initializer) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 2 Return Me._initializer Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 2 Return Me.Initializer Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEnumMemberDeclaration(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEnumMemberDeclaration(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="initializer"> ''' The value for the Initializer property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), identifier As SyntaxToken, initializer As EqualsValueSyntax) As EnumMemberDeclarationSyntax If attributeLists <> Me.AttributeLists OrElse identifier <> Me.Identifier OrElse initializer IsNot Me.Initializer Then Dim newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, identifier, initializer) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a block member declaration: A declaration that has a beginning ''' declaration, a body of executable statements and an end statement. Examples ''' include methods, constructors, operators, property accessors and custom event ''' accessors. ''' </summary> Public MustInherit Class MethodBlockBaseSyntax Inherits DeclarationStatementSyntax Friend _statements as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The statements contained in the block statement. This might be an empty list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Return Me.GetStatementsCore() End Get End Property Friend Overridable Function GetStatementsCore() As SyntaxList(Of StatementSyntax) Dim listNode = GetRedAtZero(_statements) Return new SyntaxList(Of StatementSyntax)(listNode) End Function ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithStatements(statements As SyntaxList(Of StatementSyntax)) As MethodBlockBaseSyntax Return WithStatementsCore(statements) End Function Friend MustOverride Function WithStatementsCore(statements As SyntaxList(Of StatementSyntax)) As MethodBlockBaseSyntax Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As MethodBlockBaseSyntax Return AddStatementsCore(items) End Function Friend MustOverride Function AddStatementsCore(ParamArray items As StatementSyntax()) As MethodBlockBaseSyntax End Class ''' <summary> ''' Represents a Function or Sub block declaration: A declaration that has a ''' beginning declaration, a body of executable statements and an end statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SubBlock"/></description></item> ''' <item><description><see cref="SyntaxKind.FunctionBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class MethodBlockSyntax Inherits MethodBlockBaseSyntax Friend _subOrFunctionStatement as MethodStatementSyntax Friend _endSubOrFunctionStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), subOrFunctionStatement As MethodStatementSyntax, statements As SyntaxNode, endSubOrFunctionStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MethodBlockSyntax(kind, errors, annotations, DirectCast(subOrFunctionStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MethodStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), DirectCast(endSubOrFunctionStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Sub" or "Function" statement that begins the block. ''' </summary> Public ReadOnly Property SubOrFunctionStatement As MethodStatementSyntax Get Return GetRedAtZero(_subOrFunctionStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the SubOrFunctionStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSubOrFunctionStatement(subOrFunctionStatement as MethodStatementSyntax) As MethodBlockSyntax return Update(Me.Kind, subOrFunctionStatement, Me.Statements, Me.EndSubOrFunctionStatement) End Function ''' <summary> ''' The statements contained in the block statement. This might be an empty list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property Friend Overrides Function GetStatementsCore() As SyntaxList(Of StatementSyntax) Return Me.Statements End Function Friend Overrides Function WithStatementsCore(statements As SyntaxList(Of StatementSyntax)) As MethodBlockBaseSyntax Return WithStatements(statements) End Function ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As MethodBlockSyntax return Update(Me.Kind, Me.SubOrFunctionStatement, statements, Me.EndSubOrFunctionStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As MethodBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function AddStatementsCore(ParamArray items As StatementSyntax()) As MethodBlockBaseSyntax Return AddStatements(items) End Function ''' <summary> ''' The "End Sub" or "End Function" statement that ends the block. ''' </summary> Public ReadOnly Property EndSubOrFunctionStatement As EndBlockStatementSyntax Get Return GetRed(_endSubOrFunctionStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndSubOrFunctionStatement property changed to ''' the specified value. Returns this instance if the specified value is the same ''' as the current value. ''' </summary> Public Shadows Function WithEndSubOrFunctionStatement(endSubOrFunctionStatement as EndBlockStatementSyntax) As MethodBlockSyntax return Update(Me.Kind, Me.SubOrFunctionStatement, Me.Statements, endSubOrFunctionStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._subOrFunctionStatement Case 1 Return Me._statements Case 2 Return Me._endSubOrFunctionStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.SubOrFunctionStatement Case 1 Return GetRed(_statements, 1) Case 2 Return Me.EndSubOrFunctionStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitMethodBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitMethodBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="subOrFunctionStatement"> ''' The value for the SubOrFunctionStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="endSubOrFunctionStatement"> ''' The value for the EndSubOrFunctionStatement property. ''' </param> Public Function Update(kind As SyntaxKind, subOrFunctionStatement As MethodStatementSyntax, statements As SyntaxList(of StatementSyntax), endSubOrFunctionStatement As EndBlockStatementSyntax) As MethodBlockSyntax If kind <> Me.Kind OrElse subOrFunctionStatement IsNot Me.SubOrFunctionStatement OrElse statements <> Me.Statements OrElse endSubOrFunctionStatement IsNot Me.EndSubOrFunctionStatement Then Dim newNode = SyntaxFactory.MethodBlock(kind, subOrFunctionStatement, statements, endSubOrFunctionStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a constructor block declaration: A declaration that has a beginning ''' declaration, a body of executable statements and an end statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ConstructorBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ConstructorBlockSyntax Inherits MethodBlockBaseSyntax Friend _subNewStatement as SubNewStatementSyntax Friend _endSubStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), subNewStatement As SubNewStatementSyntax, statements As SyntaxNode, endSubStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ConstructorBlockSyntax(kind, errors, annotations, DirectCast(subNewStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SubNewStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), DirectCast(endSubStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Sub New" statement that begins the block. ''' </summary> Public ReadOnly Property SubNewStatement As SubNewStatementSyntax Get Return GetRedAtZero(_subNewStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the SubNewStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSubNewStatement(subNewStatement as SubNewStatementSyntax) As ConstructorBlockSyntax return Update(subNewStatement, Me.Statements, Me.EndSubStatement) End Function ''' <summary> ''' The statements contained in the block statement. This might be an empty list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property Friend Overrides Function GetStatementsCore() As SyntaxList(Of StatementSyntax) Return Me.Statements End Function Friend Overrides Function WithStatementsCore(statements As SyntaxList(Of StatementSyntax)) As MethodBlockBaseSyntax Return WithStatements(statements) End Function ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As ConstructorBlockSyntax return Update(Me.SubNewStatement, statements, Me.EndSubStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As ConstructorBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function AddStatementsCore(ParamArray items As StatementSyntax()) As MethodBlockBaseSyntax Return AddStatements(items) End Function ''' <summary> ''' The "End Sub" statement that ends the block declaration. ''' </summary> Public ReadOnly Property EndSubStatement As EndBlockStatementSyntax Get Return GetRed(_endSubStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndSubStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndSubStatement(endSubStatement as EndBlockStatementSyntax) As ConstructorBlockSyntax return Update(Me.SubNewStatement, Me.Statements, endSubStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._subNewStatement Case 1 Return Me._statements Case 2 Return Me._endSubStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.SubNewStatement Case 1 Return GetRed(_statements, 1) Case 2 Return Me.EndSubStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitConstructorBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitConstructorBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="subNewStatement"> ''' The value for the SubNewStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="endSubStatement"> ''' The value for the EndSubStatement property. ''' </param> Public Function Update(subNewStatement As SubNewStatementSyntax, statements As SyntaxList(of StatementSyntax), endSubStatement As EndBlockStatementSyntax) As ConstructorBlockSyntax If subNewStatement IsNot Me.SubNewStatement OrElse statements <> Me.Statements OrElse endSubStatement IsNot Me.EndSubStatement Then Dim newNode = SyntaxFactory.ConstructorBlock(subNewStatement, statements, endSubStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an Operator block member declaration: A declaration that has a ''' beginning declaration, a body of executable statements and an end statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.OperatorBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class OperatorBlockSyntax Inherits MethodBlockBaseSyntax Friend _operatorStatement as OperatorStatementSyntax Friend _endOperatorStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), operatorStatement As OperatorStatementSyntax, statements As SyntaxNode, endOperatorStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OperatorBlockSyntax(kind, errors, annotations, DirectCast(operatorStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OperatorStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), DirectCast(endOperatorStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Operator" statement that begins the block. ''' </summary> Public ReadOnly Property OperatorStatement As OperatorStatementSyntax Get Return GetRedAtZero(_operatorStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the OperatorStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOperatorStatement(operatorStatement as OperatorStatementSyntax) As OperatorBlockSyntax return Update(operatorStatement, Me.Statements, Me.EndOperatorStatement) End Function ''' <summary> ''' The statements contained in the block statement. This might be an empty list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property Friend Overrides Function GetStatementsCore() As SyntaxList(Of StatementSyntax) Return Me.Statements End Function Friend Overrides Function WithStatementsCore(statements As SyntaxList(Of StatementSyntax)) As MethodBlockBaseSyntax Return WithStatements(statements) End Function ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As OperatorBlockSyntax return Update(Me.OperatorStatement, statements, Me.EndOperatorStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As OperatorBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function AddStatementsCore(ParamArray items As StatementSyntax()) As MethodBlockBaseSyntax Return AddStatements(items) End Function ''' <summary> ''' The "End Operator" statement that ends the block declaration. ''' </summary> Public ReadOnly Property EndOperatorStatement As EndBlockStatementSyntax Get Return GetRed(_endOperatorStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndOperatorStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndOperatorStatement(endOperatorStatement as EndBlockStatementSyntax) As OperatorBlockSyntax return Update(Me.OperatorStatement, Me.Statements, endOperatorStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._operatorStatement Case 1 Return Me._statements Case 2 Return Me._endOperatorStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.OperatorStatement Case 1 Return GetRed(_statements, 1) Case 2 Return Me.EndOperatorStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitOperatorBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitOperatorBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="operatorStatement"> ''' The value for the OperatorStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="endOperatorStatement"> ''' The value for the EndOperatorStatement property. ''' </param> Public Function Update(operatorStatement As OperatorStatementSyntax, statements As SyntaxList(of StatementSyntax), endOperatorStatement As EndBlockStatementSyntax) As OperatorBlockSyntax If operatorStatement IsNot Me.OperatorStatement OrElse statements <> Me.Statements OrElse endOperatorStatement IsNot Me.EndOperatorStatement Then Dim newNode = SyntaxFactory.OperatorBlock(operatorStatement, statements, endOperatorStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an accessor block member declaration: A declaration that has a ''' beginning declaration, a body of executable statements and an end statement. ''' Examples include property accessors and custom event accessors. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.GetAccessorBlock"/></description></item> ''' <item><description><see cref="SyntaxKind.SetAccessorBlock"/></description></item> ''' <item><description><see cref="SyntaxKind.AddHandlerAccessorBlock"/></description></item> ''' <item><description><see cref="SyntaxKind.RemoveHandlerAccessorBlock"/></description></item> ''' <item><description><see cref="SyntaxKind.RaiseEventAccessorBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AccessorBlockSyntax Inherits MethodBlockBaseSyntax Friend _accessorStatement as AccessorStatementSyntax Friend _endAccessorStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), accessorStatement As AccessorStatementSyntax, statements As SyntaxNode, endAccessorStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AccessorBlockSyntax(kind, errors, annotations, DirectCast(accessorStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AccessorStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), DirectCast(endAccessorStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Get", "Set", "AddHandler", "RemoveHandler", or "RaiseEvent" statement that ''' begins the accessor block. ''' </summary> Public ReadOnly Property AccessorStatement As AccessorStatementSyntax Get Return GetRedAtZero(_accessorStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the AccessorStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAccessorStatement(accessorStatement as AccessorStatementSyntax) As AccessorBlockSyntax return Update(Me.Kind, accessorStatement, Me.Statements, Me.EndAccessorStatement) End Function ''' <summary> ''' The statements contained in the block statement. This might be an empty list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property Friend Overrides Function GetStatementsCore() As SyntaxList(Of StatementSyntax) Return Me.Statements End Function Friend Overrides Function WithStatementsCore(statements As SyntaxList(Of StatementSyntax)) As MethodBlockBaseSyntax Return WithStatements(statements) End Function ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As AccessorBlockSyntax return Update(Me.Kind, Me.AccessorStatement, statements, Me.EndAccessorStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As AccessorBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function AddStatementsCore(ParamArray items As StatementSyntax()) As MethodBlockBaseSyntax Return AddStatements(items) End Function ''' <summary> ''' The "End Get", "End Set", "End AddHandler", "End RemoveHandler", or "End ''' RaiseEvent" statement that ends the accessor block. ''' </summary> Public ReadOnly Property EndAccessorStatement As EndBlockStatementSyntax Get Return GetRed(_endAccessorStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndAccessorStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndAccessorStatement(endAccessorStatement as EndBlockStatementSyntax) As AccessorBlockSyntax return Update(Me.Kind, Me.AccessorStatement, Me.Statements, endAccessorStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._accessorStatement Case 1 Return Me._statements Case 2 Return Me._endAccessorStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.AccessorStatement Case 1 Return GetRed(_statements, 1) Case 2 Return Me.EndAccessorStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAccessorBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAccessorBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="accessorStatement"> ''' The value for the AccessorStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="endAccessorStatement"> ''' The value for the EndAccessorStatement property. ''' </param> Public Function Update(kind As SyntaxKind, accessorStatement As AccessorStatementSyntax, statements As SyntaxList(of StatementSyntax), endAccessorStatement As EndBlockStatementSyntax) As AccessorBlockSyntax If kind <> Me.Kind OrElse accessorStatement IsNot Me.AccessorStatement OrElse statements <> Me.Statements OrElse endAccessorStatement IsNot Me.EndAccessorStatement Then Dim newNode = SyntaxFactory.AccessorBlock(kind, accessorStatement, statements, endAccessorStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a block property declaration: A declaration that has a beginning ''' declaration, some get or set accessor blocks and an end statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.PropertyBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class PropertyBlockSyntax Inherits DeclarationStatementSyntax Friend _propertyStatement as PropertyStatementSyntax Friend _accessors as SyntaxNode Friend _endPropertyStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), propertyStatement As PropertyStatementSyntax, accessors As SyntaxNode, endPropertyStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PropertyBlockSyntax(kind, errors, annotations, DirectCast(propertyStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PropertyStatementSyntax), if(accessors IsNot Nothing, accessors.Green, Nothing), DirectCast(endPropertyStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The property declaration that begins the block. ''' </summary> Public ReadOnly Property PropertyStatement As PropertyStatementSyntax Get Return GetRedAtZero(_propertyStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the PropertyStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithPropertyStatement(propertyStatement as PropertyStatementSyntax) As PropertyBlockSyntax return Update(propertyStatement, Me.Accessors, Me.EndPropertyStatement) End Function ''' <summary> ''' The accessor blocks contained in the property, between the Property and the End ''' Property statements. ''' </summary> Public ReadOnly Property Accessors As SyntaxList(Of AccessorBlockSyntax) Get Dim listNode = GetRed(_accessors, 1) Return new SyntaxList(Of AccessorBlockSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Accessors property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAccessors(accessors as SyntaxList(Of AccessorBlockSyntax)) As PropertyBlockSyntax return Update(Me.PropertyStatement, accessors, Me.EndPropertyStatement) End Function Public Shadows Function AddAccessors(ParamArray items As AccessorBlockSyntax()) As PropertyBlockSyntax Return Me.WithAccessors(Me.Accessors.AddRange(items)) End Function ''' <summary> ''' The End Property statement that ends the block. ''' </summary> Public ReadOnly Property EndPropertyStatement As EndBlockStatementSyntax Get Return GetRed(_endPropertyStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndPropertyStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndPropertyStatement(endPropertyStatement as EndBlockStatementSyntax) As PropertyBlockSyntax return Update(Me.PropertyStatement, Me.Accessors, endPropertyStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._propertyStatement Case 1 Return Me._accessors Case 2 Return Me._endPropertyStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.PropertyStatement Case 1 Return GetRed(_accessors, 1) Case 2 Return Me.EndPropertyStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitPropertyBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitPropertyBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="propertyStatement"> ''' The value for the PropertyStatement property. ''' </param> ''' <param name="accessors"> ''' The value for the Accessors property. ''' </param> ''' <param name="endPropertyStatement"> ''' The value for the EndPropertyStatement property. ''' </param> Public Function Update(propertyStatement As PropertyStatementSyntax, accessors As SyntaxList(of AccessorBlockSyntax), endPropertyStatement As EndBlockStatementSyntax) As PropertyBlockSyntax If propertyStatement IsNot Me.PropertyStatement OrElse accessors <> Me.Accessors OrElse endPropertyStatement IsNot Me.EndPropertyStatement Then Dim newNode = SyntaxFactory.PropertyBlock(propertyStatement, accessors, endPropertyStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a custom event declaration: A declaration that has a beginning event ''' declaration, some accessor blocks and an end statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EventBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EventBlockSyntax Inherits DeclarationStatementSyntax Friend _eventStatement as EventStatementSyntax Friend _accessors as SyntaxNode Friend _endEventStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), eventStatement As EventStatementSyntax, accessors As SyntaxNode, endEventStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EventBlockSyntax(kind, errors, annotations, DirectCast(eventStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EventStatementSyntax), if(accessors IsNot Nothing, accessors.Green, Nothing), DirectCast(endEventStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The event declaration that begins the block. ''' </summary> Public ReadOnly Property EventStatement As EventStatementSyntax Get Return GetRedAtZero(_eventStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the EventStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEventStatement(eventStatement as EventStatementSyntax) As EventBlockSyntax return Update(eventStatement, Me.Accessors, Me.EndEventStatement) End Function ''' <summary> ''' The accessor blocks contained in the custom event declaration, between the ''' Event statement and the End Event statement. ''' </summary> Public ReadOnly Property Accessors As SyntaxList(Of AccessorBlockSyntax) Get Dim listNode = GetRed(_accessors, 1) Return new SyntaxList(Of AccessorBlockSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Accessors property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAccessors(accessors as SyntaxList(Of AccessorBlockSyntax)) As EventBlockSyntax return Update(Me.EventStatement, accessors, Me.EndEventStatement) End Function Public Shadows Function AddAccessors(ParamArray items As AccessorBlockSyntax()) As EventBlockSyntax Return Me.WithAccessors(Me.Accessors.AddRange(items)) End Function ''' <summary> ''' The End Event statement that ends the block. ''' </summary> Public ReadOnly Property EndEventStatement As EndBlockStatementSyntax Get Return GetRed(_endEventStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndEventStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndEventStatement(endEventStatement as EndBlockStatementSyntax) As EventBlockSyntax return Update(Me.EventStatement, Me.Accessors, endEventStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._eventStatement Case 1 Return Me._accessors Case 2 Return Me._endEventStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.EventStatement Case 1 Return GetRed(_accessors, 1) Case 2 Return Me.EndEventStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEventBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEventBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="eventStatement"> ''' The value for the EventStatement property. ''' </param> ''' <param name="accessors"> ''' The value for the Accessors property. ''' </param> ''' <param name="endEventStatement"> ''' The value for the EndEventStatement property. ''' </param> Public Function Update(eventStatement As EventStatementSyntax, accessors As SyntaxList(of AccessorBlockSyntax), endEventStatement As EndBlockStatementSyntax) As EventBlockSyntax If eventStatement IsNot Me.EventStatement OrElse accessors <> Me.Accessors OrElse endEventStatement IsNot Me.EndEventStatement Then Dim newNode = SyntaxFactory.EventBlock(eventStatement, accessors, endEventStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' An abstract node class that is the parent for declarations that are ''' "method-like"; i.e., that have a parameter list and return type. This includes ''' methods, constructors, properties, events, operators, declares, delegates, ''' property accessors and custom event accessors. ''' </summary> Public MustInherit Class MethodBaseSyntax Inherits DeclarationStatementSyntax Friend _attributeLists as SyntaxNode Friend _parameterList as ParameterListSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Return Me.GetAttributeListsCore() End Get End Property Friend Overridable Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Function WithAttributeLists(attributeLists As SyntaxList(Of AttributeListSyntax)) As MethodBaseSyntax Return WithAttributeListsCore(attributeLists) End Function Friend MustOverride Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As MethodBaseSyntax Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As MethodBaseSyntax Return AddAttributeListsCore(items) End Function Friend MustOverride Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As MethodBaseSyntax ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. A bitfield version of all ''' the modifiers ORed together, which is in many cases easier to use, can be ''' obtained with the Modifiers property. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Modifiers As SyntaxTokenList Get Return Me.GetModifiersCore() End Get End Property Friend Overridable Function GetModifiersCore() As SyntaxTokenList Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MethodBaseSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithModifiers(modifiers As SyntaxTokenList) As MethodBaseSyntax Return WithModifiersCore(modifiers) End Function Friend MustOverride Function WithModifiersCore(modifiers As SyntaxTokenList) As MethodBaseSyntax Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As MethodBaseSyntax Return AddModifiersCore(items) End Function Friend MustOverride Function AddModifiersCore(ParamArray items As SyntaxToken()) As MethodBaseSyntax ''' <summary> ''' The method's parameter list including the parentheses. If no parameter list was ''' present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ParameterList As ParameterListSyntax Get Return Me.GetParameterListCore() End Get End Property Friend Overridable Function GetParameterListCore() As ParameterListSyntax Return GetRed(_parameterList, 2) End Function ''' <summary> ''' Returns a copy of this with the ParameterList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithParameterList(parameterList As ParameterListSyntax) As MethodBaseSyntax Return WithParameterListCore(parameterList) End Function Friend MustOverride Function WithParameterListCore(parameterList As ParameterListSyntax) As MethodBaseSyntax Public Shadows Function AddParameterListParameters(ParamArray items As ParameterSyntax()) As MethodBaseSyntax Return AddParameterListParametersCore(items) End Function Friend MustOverride Function AddParameterListParametersCore(ParamArray items As ParameterSyntax()) As MethodBaseSyntax End Class ''' <summary> ''' Represents the parameter list in a method declaration. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ParameterList"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ParameterListSyntax Inherits VisualBasicSyntaxNode Friend _parameters as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), openParenToken As InternalSyntax.PunctuationSyntax, parameters As SyntaxNode, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax(kind, errors, annotations, openParenToken, if(parameters IsNot Nothing, parameters.Green, Nothing), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "(" token that introduces the parameter list. If no parameter list was ''' present, Nothing is returned. ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax)._openParenToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As ParameterListSyntax return Update(openParenToken, Me.Parameters, Me.CloseParenToken) End Function ''' <summary> ''' The list of parameters. If no parameter list was present, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Parameters As SeparatedSyntaxList(Of ParameterSyntax) Get Dim listNode = GetRed(_parameters, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ParameterSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Parameters property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithParameters(parameters as SeparatedSyntaxList(Of ParameterSyntax)) As ParameterListSyntax return Update(Me.OpenParenToken, parameters, Me.CloseParenToken) End Function Public Shadows Function AddParameters(ParamArray items As ParameterSyntax()) As ParameterListSyntax Return Me.WithParameters(Me.Parameters.AddRange(items)) End Function ''' <summary> ''' The ")" token that concludes the parameter list. If no parameter list was ''' present, Nothing is returned. ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax)._closeParenToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As ParameterListSyntax return Update(Me.OpenParenToken, Me.Parameters, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._parameters Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_parameters, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitParameterList(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitParameterList(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="parameters"> ''' The value for the Parameters property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(openParenToken As SyntaxToken, parameters As SeparatedSyntaxList(Of ParameterSyntax), closeParenToken As SyntaxToken) As ParameterListSyntax If openParenToken <> Me.OpenParenToken OrElse parameters <> Me.Parameters OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' The statement that declares a Sub or Function. If this method has a body, this ''' statement will be the Begin of a BlockStatement with ''' Kind=MethodDeclarationBlock, and the body of the method will be the Body of ''' that BlockStatement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SubStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.FunctionStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class MethodStatementSyntax Inherits MethodBaseSyntax Friend _typeParameterList as TypeParameterListSyntax Friend _asClause as SimpleAsClauseSyntax Friend _handlesClause as HandlesClauseSyntax Friend _implementsClause as ImplementsClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, subOrFunctionKeyword As InternalSyntax.KeywordSyntax, identifier As InternalSyntax.IdentifierTokenSyntax, typeParameterList As TypeParameterListSyntax, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax, handlesClause As HandlesClauseSyntax, implementsClause As ImplementsClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MethodStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, subOrFunctionKeyword, identifier, if(typeParameterList IsNot Nothing, DirectCast(typeParameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterListSyntax), Nothing), if(parameterList IsNot Nothing, DirectCast(parameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax), Nothing), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing), if(handlesClause IsNot Nothing, DirectCast(handlesClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.HandlesClauseSyntax), Nothing), if(implementsClause IsNot Nothing, DirectCast(implementsClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImplementsClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As MethodBaseSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As MethodStatementSyntax return Update(Me.Kind, attributeLists, Me.Modifiers, Me.SubOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, Me.ParameterList, Me.AsClause, Me.HandlesClause, Me.ImplementsClause) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As MethodStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As MethodBaseSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. A bitfield version of all ''' the modifiers ORed together, which is in many cases easier to use, can be ''' obtained with the Modifiers property. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MethodStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As MethodBaseSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As MethodStatementSyntax return Update(Me.Kind, Me.AttributeLists, modifiers, Me.SubOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, Me.ParameterList, Me.AsClause, Me.HandlesClause, Me.ImplementsClause) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As MethodStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As MethodBaseSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Sub" or "Function" keyword that introduces this method declaration. ''' </summary> Public ReadOnly Property SubOrFunctionKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MethodStatementSyntax)._subOrFunctionKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the SubOrFunctionKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSubOrFunctionKeyword(subOrFunctionKeyword as SyntaxToken) As MethodStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, subOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, Me.ParameterList, Me.AsClause, Me.HandlesClause, Me.ImplementsClause) End Function ''' <summary> ''' The name of the method being declared. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MethodStatementSyntax)._identifier, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As MethodStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.SubOrFunctionKeyword, identifier, Me.TypeParameterList, Me.ParameterList, Me.AsClause, Me.HandlesClause, Me.ImplementsClause) End Function ''' <summary> ''' If present, a type parameter list with generic type parameters for this method. ''' If no generic type parameters were present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property TypeParameterList As TypeParameterListSyntax Get Return GetRed(_typeParameterList, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the TypeParameterList property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithTypeParameterList(typeParameterList as TypeParameterListSyntax) As MethodStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.SubOrFunctionKeyword, Me.Identifier, typeParameterList, Me.ParameterList, Me.AsClause, Me.HandlesClause, Me.ImplementsClause) End Function Public Shadows Function AddTypeParameterListParameters(ParamArray items As TypeParameterSyntax()) As MethodStatementSyntax Dim _child = If(Me.TypeParameterList IsNot Nothing, Me.TypeParameterList, SyntaxFactory.TypeParameterList()) Return Me.WithTypeParameterList(_child.AddParameters(items)) End Function ''' <summary> ''' The method's parameter list including the parentheses. If no parameter list was ''' present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property ParameterList As ParameterListSyntax Get Return GetRed(_parameterList, 5) End Get End Property Friend Overrides Function GetParameterListCore() As ParameterListSyntax Return Me.ParameterList End Function Friend Overrides Function WithParameterListCore(parameterList As ParameterListSyntax) As MethodBaseSyntax Return WithParameterList(parameterList) End Function ''' <summary> ''' Returns a copy of this with the ParameterList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithParameterList(parameterList as ParameterListSyntax) As MethodStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.SubOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, parameterList, Me.AsClause, Me.HandlesClause, Me.ImplementsClause) End Function Public Shadows Function AddParameterListParameters(ParamArray items As ParameterSyntax()) As MethodStatementSyntax Dim _child = If(Me.ParameterList IsNot Nothing, Me.ParameterList, SyntaxFactory.ParameterList()) Return Me.WithParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddParameterListParametersCore(ParamArray items As ParameterSyntax()) As MethodBaseSyntax Return AddParameterListParameters(items) End Function ''' <summary> ''' The "As" clause that describes the return type. If no As clause was present, ''' Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 6) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As MethodStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.SubOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, Me.ParameterList, asClause, Me.HandlesClause, Me.ImplementsClause) End Function ''' <summary> ''' If present, a Handles clause indicated the events that this method handles. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property HandlesClause As HandlesClauseSyntax Get Return GetRed(_handlesClause, 7) End Get End Property ''' <summary> ''' Returns a copy of this with the HandlesClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHandlesClause(handlesClause as HandlesClauseSyntax) As MethodStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.SubOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, Me.ParameterList, Me.AsClause, handlesClause, Me.ImplementsClause) End Function Public Shadows Function AddHandlesClauseEvents(ParamArray items As HandlesClauseItemSyntax()) As MethodStatementSyntax Dim _child = If(Me.HandlesClause IsNot Nothing, Me.HandlesClause, SyntaxFactory.HandlesClause()) Return Me.WithHandlesClause(_child.AddEvents(items)) End Function ''' <summary> ''' If present, an Implements clause indicated the interface methods that this ''' method implements. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ImplementsClause As ImplementsClauseSyntax Get Return GetRed(_implementsClause, 8) End Get End Property ''' <summary> ''' Returns a copy of this with the ImplementsClause property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithImplementsClause(implementsClause as ImplementsClauseSyntax) As MethodStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.SubOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, Me.ParameterList, Me.AsClause, Me.HandlesClause, implementsClause) End Function Public Shadows Function AddImplementsClauseInterfaceMembers(ParamArray items As QualifiedNameSyntax()) As MethodStatementSyntax Dim _child = If(Me.ImplementsClause IsNot Nothing, Me.ImplementsClause, SyntaxFactory.ImplementsClause()) Return Me.WithImplementsClause(_child.AddInterfaceMembers(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 4 Return Me._typeParameterList Case 5 Return Me._parameterList Case 6 Return Me._asClause Case 7 Return Me._handlesClause Case 8 Return Me._implementsClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 4 Return Me.TypeParameterList Case 5 Return Me.ParameterList Case 6 Return Me.AsClause Case 7 Return Me.HandlesClause Case 8 Return Me.ImplementsClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitMethodStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitMethodStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="subOrFunctionKeyword"> ''' The value for the SubOrFunctionKeyword property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="typeParameterList"> ''' The value for the TypeParameterList property. ''' </param> ''' <param name="parameterList"> ''' The value for the ParameterList property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> ''' <param name="handlesClause"> ''' The value for the HandlesClause property. ''' </param> ''' <param name="implementsClause"> ''' The value for the ImplementsClause property. ''' </param> Public Function Update(kind As SyntaxKind, attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, subOrFunctionKeyword As SyntaxToken, identifier As SyntaxToken, typeParameterList As TypeParameterListSyntax, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax, handlesClause As HandlesClauseSyntax, implementsClause As ImplementsClauseSyntax) As MethodStatementSyntax If kind <> Me.Kind OrElse attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse subOrFunctionKeyword <> Me.SubOrFunctionKeyword OrElse identifier <> Me.Identifier OrElse typeParameterList IsNot Me.TypeParameterList OrElse parameterList IsNot Me.ParameterList OrElse asClause IsNot Me.AsClause OrElse handlesClause IsNot Me.HandlesClause OrElse implementsClause IsNot Me.ImplementsClause Then Dim newNode = SyntaxFactory.MethodStatement(kind, attributeLists, modifiers, subOrFunctionKeyword, identifier, typeParameterList, parameterList, asClause, handlesClause, implementsClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' A statement that declares a constructor. This statement will be the Begin of a ''' BlockStatement with Kind=MethodDeclarationBlock, and the body of the method ''' will be the Body of that BlockStatement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SubNewStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SubNewStatementSyntax Inherits MethodBaseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, subKeyword As InternalSyntax.KeywordSyntax, newKeyword As InternalSyntax.KeywordSyntax, parameterList As ParameterListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SubNewStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, subKeyword, newKeyword, if(parameterList IsNot Nothing, DirectCast(parameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As MethodBaseSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As SubNewStatementSyntax return Update(attributeLists, Me.Modifiers, Me.SubKeyword, Me.NewKeyword, Me.ParameterList) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As SubNewStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As MethodBaseSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. A bitfield version of all ''' the modifiers ORed together, which is in many cases easier to use, can be ''' obtained with the Modifiers property. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SubNewStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As MethodBaseSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As SubNewStatementSyntax return Update(Me.AttributeLists, modifiers, Me.SubKeyword, Me.NewKeyword, Me.ParameterList) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As SubNewStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As MethodBaseSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Sub" keyword. ''' </summary> Public ReadOnly Property SubKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SubNewStatementSyntax)._subKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the SubKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithSubKeyword(subKeyword as SyntaxToken) As SubNewStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, subKeyword, Me.NewKeyword, Me.ParameterList) End Function ''' <summary> ''' The "New" keyword in the constructor declaration. ''' </summary> Public ReadOnly Property NewKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SubNewStatementSyntax)._newKeyword, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the NewKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNewKeyword(newKeyword as SyntaxToken) As SubNewStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.SubKeyword, newKeyword, Me.ParameterList) End Function ''' <summary> ''' The method's parameter list including the parentheses. If no parameter list was ''' present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property ParameterList As ParameterListSyntax Get Return GetRed(_parameterList, 4) End Get End Property Friend Overrides Function GetParameterListCore() As ParameterListSyntax Return Me.ParameterList End Function Friend Overrides Function WithParameterListCore(parameterList As ParameterListSyntax) As MethodBaseSyntax Return WithParameterList(parameterList) End Function ''' <summary> ''' Returns a copy of this with the ParameterList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithParameterList(parameterList as ParameterListSyntax) As SubNewStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.SubKeyword, Me.NewKeyword, parameterList) End Function Public Shadows Function AddParameterListParameters(ParamArray items As ParameterSyntax()) As SubNewStatementSyntax Dim _child = If(Me.ParameterList IsNot Nothing, Me.ParameterList, SyntaxFactory.ParameterList()) Return Me.WithParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddParameterListParametersCore(ParamArray items As ParameterSyntax()) As MethodBaseSyntax Return AddParameterListParameters(items) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 4 Return Me._parameterList Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 4 Return Me.ParameterList Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSubNewStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSubNewStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="subKeyword"> ''' The value for the SubKeyword property. ''' </param> ''' <param name="newKeyword"> ''' The value for the NewKeyword property. ''' </param> ''' <param name="parameterList"> ''' The value for the ParameterList property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, subKeyword As SyntaxToken, newKeyword As SyntaxToken, parameterList As ParameterListSyntax) As SubNewStatementSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse subKeyword <> Me.SubKeyword OrElse newKeyword <> Me.NewKeyword OrElse parameterList IsNot Me.ParameterList Then Dim newNode = SyntaxFactory.SubNewStatement(attributeLists, modifiers, subKeyword, newKeyword, parameterList) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' A Declare statement that declares an external DLL method. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.DeclareSubStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.DeclareFunctionStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class DeclareStatementSyntax Inherits MethodBaseSyntax Friend _libraryName as LiteralExpressionSyntax Friend _aliasName as LiteralExpressionSyntax Friend _asClause as SimpleAsClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, declareKeyword As InternalSyntax.KeywordSyntax, charsetKeyword As InternalSyntax.KeywordSyntax, subOrFunctionKeyword As InternalSyntax.KeywordSyntax, identifier As InternalSyntax.IdentifierTokenSyntax, libKeyword As InternalSyntax.KeywordSyntax, libraryName As LiteralExpressionSyntax, aliasKeyword As InternalSyntax.KeywordSyntax, aliasName As LiteralExpressionSyntax, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DeclareStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, declareKeyword, charsetKeyword, subOrFunctionKeyword, identifier, libKeyword, DirectCast(libraryName.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LiteralExpressionSyntax), aliasKeyword, if(aliasName IsNot Nothing, DirectCast(aliasName.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LiteralExpressionSyntax), Nothing), if(parameterList IsNot Nothing, DirectCast(parameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax), Nothing), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As MethodBaseSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As DeclareStatementSyntax return Update(Me.Kind, attributeLists, Me.Modifiers, Me.DeclareKeyword, Me.CharsetKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.LibKeyword, Me.LibraryName, Me.AliasKeyword, Me.AliasName, Me.ParameterList, Me.AsClause) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As DeclareStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As MethodBaseSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. A bitfield version of all ''' the modifiers ORed together, which is in many cases easier to use, can be ''' obtained with the Modifiers property. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DeclareStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As MethodBaseSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As DeclareStatementSyntax return Update(Me.Kind, Me.AttributeLists, modifiers, Me.DeclareKeyword, Me.CharsetKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.LibKeyword, Me.LibraryName, Me.AliasKeyword, Me.AliasName, Me.ParameterList, Me.AsClause) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As DeclareStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As MethodBaseSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Declare" keyword. ''' </summary> Public ReadOnly Property DeclareKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DeclareStatementSyntax)._declareKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the DeclareKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithDeclareKeyword(declareKeyword as SyntaxToken) As DeclareStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, declareKeyword, Me.CharsetKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.LibKeyword, Me.LibraryName, Me.AliasKeyword, Me.AliasName, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' If present, the keyword that defines the string translation semantics of the ''' external method. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property CharsetKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DeclareStatementSyntax)._charsetKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(3), Me.GetChildIndex(3)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the CharsetKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCharsetKeyword(charsetKeyword as SyntaxToken) As DeclareStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DeclareKeyword, charsetKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.LibKeyword, Me.LibraryName, Me.AliasKeyword, Me.AliasName, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' The "Sub" or "Function" keyword. ''' </summary> Public ReadOnly Property SubOrFunctionKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DeclareStatementSyntax)._subOrFunctionKeyword, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property ''' <summary> ''' Returns a copy of this with the SubOrFunctionKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSubOrFunctionKeyword(subOrFunctionKeyword as SyntaxToken) As DeclareStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DeclareKeyword, Me.CharsetKeyword, subOrFunctionKeyword, Me.Identifier, Me.LibKeyword, Me.LibraryName, Me.AliasKeyword, Me.AliasName, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' The name of the method being declared. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DeclareStatementSyntax)._identifier, Me.GetChildPosition(5), Me.GetChildIndex(5)) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As DeclareStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DeclareKeyword, Me.CharsetKeyword, Me.SubOrFunctionKeyword, identifier, Me.LibKeyword, Me.LibraryName, Me.AliasKeyword, Me.AliasName, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' The "Lib" keyword. ''' </summary> Public ReadOnly Property LibKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DeclareStatementSyntax)._libKeyword, Me.GetChildPosition(6), Me.GetChildIndex(6)) End Get End Property ''' <summary> ''' Returns a copy of this with the LibKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLibKeyword(libKeyword as SyntaxToken) As DeclareStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DeclareKeyword, Me.CharsetKeyword, Me.SubOrFunctionKeyword, Me.Identifier, libKeyword, Me.LibraryName, Me.AliasKeyword, Me.AliasName, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' The string literal with the library name. ''' </summary> Public ReadOnly Property LibraryName As LiteralExpressionSyntax Get Return GetRed(_libraryName, 7) End Get End Property ''' <summary> ''' Returns a copy of this with the LibraryName property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLibraryName(libraryName as LiteralExpressionSyntax) As DeclareStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DeclareKeyword, Me.CharsetKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.LibKeyword, libraryName, Me.AliasKeyword, Me.AliasName, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' If present, the "Alias" keyword. If not present, returns Nothing. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AliasKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DeclareStatementSyntax)._aliasKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(8), Me.GetChildIndex(8)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the AliasKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAliasKeyword(aliasKeyword as SyntaxToken) As DeclareStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DeclareKeyword, Me.CharsetKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.LibKeyword, Me.LibraryName, aliasKeyword, Me.AliasName, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' The string literal with the alias. If not present, returns Nothing. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AliasName As LiteralExpressionSyntax Get Return GetRed(_aliasName, 9) End Get End Property ''' <summary> ''' Returns a copy of this with the AliasName property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAliasName(aliasName as LiteralExpressionSyntax) As DeclareStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DeclareKeyword, Me.CharsetKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.LibKeyword, Me.LibraryName, Me.AliasKeyword, aliasName, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' The method's parameter list including the parentheses. If no parameter list was ''' present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property ParameterList As ParameterListSyntax Get Return GetRed(_parameterList, 10) End Get End Property Friend Overrides Function GetParameterListCore() As ParameterListSyntax Return Me.ParameterList End Function Friend Overrides Function WithParameterListCore(parameterList As ParameterListSyntax) As MethodBaseSyntax Return WithParameterList(parameterList) End Function ''' <summary> ''' Returns a copy of this with the ParameterList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithParameterList(parameterList as ParameterListSyntax) As DeclareStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DeclareKeyword, Me.CharsetKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.LibKeyword, Me.LibraryName, Me.AliasKeyword, Me.AliasName, parameterList, Me.AsClause) End Function Public Shadows Function AddParameterListParameters(ParamArray items As ParameterSyntax()) As DeclareStatementSyntax Dim _child = If(Me.ParameterList IsNot Nothing, Me.ParameterList, SyntaxFactory.ParameterList()) Return Me.WithParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddParameterListParametersCore(ParamArray items As ParameterSyntax()) As MethodBaseSyntax Return AddParameterListParameters(items) End Function ''' <summary> ''' The "As" clause that describes the return type. If no As clause was present, ''' Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 11) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As DeclareStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DeclareKeyword, Me.CharsetKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.LibKeyword, Me.LibraryName, Me.AliasKeyword, Me.AliasName, Me.ParameterList, asClause) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 7 Return Me._libraryName Case 9 Return Me._aliasName Case 10 Return Me._parameterList Case 11 Return Me._asClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 7 Return Me.LibraryName Case 9 Return Me.AliasName Case 10 Return Me.ParameterList Case 11 Return Me.AsClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitDeclareStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitDeclareStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="declareKeyword"> ''' The value for the DeclareKeyword property. ''' </param> ''' <param name="charsetKeyword"> ''' The value for the CharsetKeyword property. ''' </param> ''' <param name="subOrFunctionKeyword"> ''' The value for the SubOrFunctionKeyword property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="libKeyword"> ''' The value for the LibKeyword property. ''' </param> ''' <param name="libraryName"> ''' The value for the LibraryName property. ''' </param> ''' <param name="aliasKeyword"> ''' The value for the AliasKeyword property. ''' </param> ''' <param name="aliasName"> ''' The value for the AliasName property. ''' </param> ''' <param name="parameterList"> ''' The value for the ParameterList property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> Public Function Update(kind As SyntaxKind, attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, declareKeyword As SyntaxToken, charsetKeyword As SyntaxToken, subOrFunctionKeyword As SyntaxToken, identifier As SyntaxToken, libKeyword As SyntaxToken, libraryName As LiteralExpressionSyntax, aliasKeyword As SyntaxToken, aliasName As LiteralExpressionSyntax, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax) As DeclareStatementSyntax If kind <> Me.Kind OrElse attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse declareKeyword <> Me.DeclareKeyword OrElse charsetKeyword <> Me.CharsetKeyword OrElse subOrFunctionKeyword <> Me.SubOrFunctionKeyword OrElse identifier <> Me.Identifier OrElse libKeyword <> Me.LibKeyword OrElse libraryName IsNot Me.LibraryName OrElse aliasKeyword <> Me.AliasKeyword OrElse aliasName IsNot Me.AliasName OrElse parameterList IsNot Me.ParameterList OrElse asClause IsNot Me.AsClause Then Dim newNode = SyntaxFactory.DeclareStatement(kind, attributeLists, modifiers, declareKeyword, charsetKeyword, subOrFunctionKeyword, identifier, libKeyword, libraryName, aliasKeyword, aliasName, parameterList, asClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' A statement that declares a delegate type. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.DelegateSubStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.DelegateFunctionStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class DelegateStatementSyntax Inherits MethodBaseSyntax Friend _typeParameterList as TypeParameterListSyntax Friend _asClause as SimpleAsClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, delegateKeyword As InternalSyntax.KeywordSyntax, subOrFunctionKeyword As InternalSyntax.KeywordSyntax, identifier As InternalSyntax.IdentifierTokenSyntax, typeParameterList As TypeParameterListSyntax, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DelegateStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, delegateKeyword, subOrFunctionKeyword, identifier, if(typeParameterList IsNot Nothing, DirectCast(typeParameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeParameterListSyntax), Nothing), if(parameterList IsNot Nothing, DirectCast(parameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax), Nothing), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As MethodBaseSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As DelegateStatementSyntax return Update(Me.Kind, attributeLists, Me.Modifiers, Me.DelegateKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, Me.ParameterList, Me.AsClause) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As DelegateStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As MethodBaseSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. A bitfield version of all ''' the modifiers ORed together, which is in many cases easier to use, can be ''' obtained with the Modifiers property. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DelegateStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As MethodBaseSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As DelegateStatementSyntax return Update(Me.Kind, Me.AttributeLists, modifiers, Me.DelegateKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, Me.ParameterList, Me.AsClause) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As DelegateStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As MethodBaseSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Delegate" keyword. ''' </summary> Public ReadOnly Property DelegateKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DelegateStatementSyntax)._delegateKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the DelegateKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithDelegateKeyword(delegateKeyword as SyntaxToken) As DelegateStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, delegateKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' The "Sub" or "Function" keyword. ''' </summary> Public ReadOnly Property SubOrFunctionKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DelegateStatementSyntax)._subOrFunctionKeyword, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the SubOrFunctionKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSubOrFunctionKeyword(subOrFunctionKeyword as SyntaxToken) As DelegateStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DelegateKeyword, subOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' The name of the delegate being declared. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DelegateStatementSyntax)._identifier, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As DelegateStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DelegateKeyword, Me.SubOrFunctionKeyword, identifier, Me.TypeParameterList, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' If present, a type parameter list with generic type parameters for this ''' delegate. If no generic type parameters were present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property TypeParameterList As TypeParameterListSyntax Get Return GetRed(_typeParameterList, 5) End Get End Property ''' <summary> ''' Returns a copy of this with the TypeParameterList property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithTypeParameterList(typeParameterList as TypeParameterListSyntax) As DelegateStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DelegateKeyword, Me.SubOrFunctionKeyword, Me.Identifier, typeParameterList, Me.ParameterList, Me.AsClause) End Function Public Shadows Function AddTypeParameterListParameters(ParamArray items As TypeParameterSyntax()) As DelegateStatementSyntax Dim _child = If(Me.TypeParameterList IsNot Nothing, Me.TypeParameterList, SyntaxFactory.TypeParameterList()) Return Me.WithTypeParameterList(_child.AddParameters(items)) End Function ''' <summary> ''' The method's parameter list including the parentheses. If no parameter list was ''' present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property ParameterList As ParameterListSyntax Get Return GetRed(_parameterList, 6) End Get End Property Friend Overrides Function GetParameterListCore() As ParameterListSyntax Return Me.ParameterList End Function Friend Overrides Function WithParameterListCore(parameterList As ParameterListSyntax) As MethodBaseSyntax Return WithParameterList(parameterList) End Function ''' <summary> ''' Returns a copy of this with the ParameterList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithParameterList(parameterList as ParameterListSyntax) As DelegateStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DelegateKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, parameterList, Me.AsClause) End Function Public Shadows Function AddParameterListParameters(ParamArray items As ParameterSyntax()) As DelegateStatementSyntax Dim _child = If(Me.ParameterList IsNot Nothing, Me.ParameterList, SyntaxFactory.ParameterList()) Return Me.WithParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddParameterListParametersCore(ParamArray items As ParameterSyntax()) As MethodBaseSyntax Return AddParameterListParameters(items) End Function ''' <summary> ''' The "As" clause that describes the return type. If no As clause was present, ''' Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 7) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As DelegateStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.DelegateKeyword, Me.SubOrFunctionKeyword, Me.Identifier, Me.TypeParameterList, Me.ParameterList, asClause) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 5 Return Me._typeParameterList Case 6 Return Me._parameterList Case 7 Return Me._asClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 5 Return Me.TypeParameterList Case 6 Return Me.ParameterList Case 7 Return Me.AsClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitDelegateStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitDelegateStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="delegateKeyword"> ''' The value for the DelegateKeyword property. ''' </param> ''' <param name="subOrFunctionKeyword"> ''' The value for the SubOrFunctionKeyword property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="typeParameterList"> ''' The value for the TypeParameterList property. ''' </param> ''' <param name="parameterList"> ''' The value for the ParameterList property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> Public Function Update(kind As SyntaxKind, attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, delegateKeyword As SyntaxToken, subOrFunctionKeyword As SyntaxToken, identifier As SyntaxToken, typeParameterList As TypeParameterListSyntax, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax) As DelegateStatementSyntax If kind <> Me.Kind OrElse attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse delegateKeyword <> Me.DelegateKeyword OrElse subOrFunctionKeyword <> Me.SubOrFunctionKeyword OrElse identifier <> Me.Identifier OrElse typeParameterList IsNot Me.TypeParameterList OrElse parameterList IsNot Me.ParameterList OrElse asClause IsNot Me.AsClause Then Dim newNode = SyntaxFactory.DelegateStatement(kind, attributeLists, modifiers, delegateKeyword, subOrFunctionKeyword, identifier, typeParameterList, parameterList, asClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' A statement that declares an event. If the event being declared is a custom ''' event, this statement will be the Begin of a PropertyOrEventBlock, and the ''' accessors will be part of the Accessors of that node. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EventStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EventStatementSyntax Inherits MethodBaseSyntax Friend _asClause as SimpleAsClauseSyntax Friend _implementsClause as ImplementsClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, customKeyword As InternalSyntax.KeywordSyntax, eventKeyword As InternalSyntax.KeywordSyntax, identifier As InternalSyntax.IdentifierTokenSyntax, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax, implementsClause As ImplementsClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EventStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, customKeyword, eventKeyword, identifier, if(parameterList IsNot Nothing, DirectCast(parameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax), Nothing), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing), if(implementsClause IsNot Nothing, DirectCast(implementsClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImplementsClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As MethodBaseSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As EventStatementSyntax return Update(attributeLists, Me.Modifiers, Me.CustomKeyword, Me.EventKeyword, Me.Identifier, Me.ParameterList, Me.AsClause, Me.ImplementsClause) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As EventStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As MethodBaseSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. A bitfield version of all ''' the modifiers ORed together, which is in many cases easier to use, can be ''' obtained with the Modifiers property. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EventStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As MethodBaseSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As EventStatementSyntax return Update(Me.AttributeLists, modifiers, Me.CustomKeyword, Me.EventKeyword, Me.Identifier, Me.ParameterList, Me.AsClause, Me.ImplementsClause) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As EventStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As MethodBaseSyntax Return AddModifiers(items) End Function ''' <summary> ''' The optional Custom keyword for custom event declarations. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property CustomKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EventStatementSyntax)._customKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(2), Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the CustomKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCustomKeyword(customKeyword as SyntaxToken) As EventStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, customKeyword, Me.EventKeyword, Me.Identifier, Me.ParameterList, Me.AsClause, Me.ImplementsClause) End Function ''' <summary> ''' The "Event" keyword that introduces this event declaration. ''' </summary> Public ReadOnly Property EventKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EventStatementSyntax)._eventKeyword, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the EventKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEventKeyword(eventKeyword as SyntaxToken) As EventStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.CustomKeyword, eventKeyword, Me.Identifier, Me.ParameterList, Me.AsClause, Me.ImplementsClause) End Function ''' <summary> ''' The name of the event being declared. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EventStatementSyntax)._identifier, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As EventStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.CustomKeyword, Me.EventKeyword, identifier, Me.ParameterList, Me.AsClause, Me.ImplementsClause) End Function ''' <summary> ''' The method's parameter list including the parentheses. If no parameter list was ''' present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property ParameterList As ParameterListSyntax Get Return GetRed(_parameterList, 5) End Get End Property Friend Overrides Function GetParameterListCore() As ParameterListSyntax Return Me.ParameterList End Function Friend Overrides Function WithParameterListCore(parameterList As ParameterListSyntax) As MethodBaseSyntax Return WithParameterList(parameterList) End Function ''' <summary> ''' Returns a copy of this with the ParameterList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithParameterList(parameterList as ParameterListSyntax) As EventStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.CustomKeyword, Me.EventKeyword, Me.Identifier, parameterList, Me.AsClause, Me.ImplementsClause) End Function Public Shadows Function AddParameterListParameters(ParamArray items As ParameterSyntax()) As EventStatementSyntax Dim _child = If(Me.ParameterList IsNot Nothing, Me.ParameterList, SyntaxFactory.ParameterList()) Return Me.WithParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddParameterListParametersCore(ParamArray items As ParameterSyntax()) As MethodBaseSyntax Return AddParameterListParameters(items) End Function ''' <summary> ''' The "As" clause that describes the return type. If no As clause was present, ''' Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 6) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As EventStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.CustomKeyword, Me.EventKeyword, Me.Identifier, Me.ParameterList, asClause, Me.ImplementsClause) End Function ''' <summary> ''' If present, an Implements clause indicates the interface methods that this ''' method implements. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ImplementsClause As ImplementsClauseSyntax Get Return GetRed(_implementsClause, 7) End Get End Property ''' <summary> ''' Returns a copy of this with the ImplementsClause property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithImplementsClause(implementsClause as ImplementsClauseSyntax) As EventStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.CustomKeyword, Me.EventKeyword, Me.Identifier, Me.ParameterList, Me.AsClause, implementsClause) End Function Public Shadows Function AddImplementsClauseInterfaceMembers(ParamArray items As QualifiedNameSyntax()) As EventStatementSyntax Dim _child = If(Me.ImplementsClause IsNot Nothing, Me.ImplementsClause, SyntaxFactory.ImplementsClause()) Return Me.WithImplementsClause(_child.AddInterfaceMembers(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 5 Return Me._parameterList Case 6 Return Me._asClause Case 7 Return Me._implementsClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 5 Return Me.ParameterList Case 6 Return Me.AsClause Case 7 Return Me.ImplementsClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEventStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEventStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="customKeyword"> ''' The value for the CustomKeyword property. ''' </param> ''' <param name="eventKeyword"> ''' The value for the EventKeyword property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="parameterList"> ''' The value for the ParameterList property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> ''' <param name="implementsClause"> ''' The value for the ImplementsClause property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, customKeyword As SyntaxToken, eventKeyword As SyntaxToken, identifier As SyntaxToken, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax, implementsClause As ImplementsClauseSyntax) As EventStatementSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse customKeyword <> Me.CustomKeyword OrElse eventKeyword <> Me.EventKeyword OrElse identifier <> Me.Identifier OrElse parameterList IsNot Me.ParameterList OrElse asClause IsNot Me.AsClause OrElse implementsClause IsNot Me.ImplementsClause Then Dim newNode = SyntaxFactory.EventStatement(attributeLists, modifiers, customKeyword, eventKeyword, identifier, parameterList, asClause, implementsClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' A statement that declares an operator. If this operator has a body, this ''' statement will be the Begin of a BlockStatement with ''' Kind=MethodDeclarationBlock, and the body of the method will be the Body of ''' that BlockStatement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.OperatorStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class OperatorStatementSyntax Inherits MethodBaseSyntax Friend _asClause as SimpleAsClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, operatorKeyword As InternalSyntax.KeywordSyntax, operatorToken As InternalSyntax.SyntaxToken, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OperatorStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, operatorKeyword, operatorToken, if(parameterList IsNot Nothing, DirectCast(parameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax), Nothing), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As MethodBaseSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As OperatorStatementSyntax return Update(attributeLists, Me.Modifiers, Me.OperatorKeyword, Me.OperatorToken, Me.ParameterList, Me.AsClause) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As OperatorStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As MethodBaseSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. A bitfield version of all ''' the modifiers ORed together, which is in many cases easier to use, can be ''' obtained with the Modifiers property. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OperatorStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As MethodBaseSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As OperatorStatementSyntax return Update(Me.AttributeLists, modifiers, Me.OperatorKeyword, Me.OperatorToken, Me.ParameterList, Me.AsClause) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As OperatorStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As MethodBaseSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Operator" keyword that introduces this operator declaration. ''' </summary> Public ReadOnly Property OperatorKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OperatorStatementSyntax)._operatorKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the OperatorKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOperatorKeyword(operatorKeyword as SyntaxToken) As OperatorStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, operatorKeyword, Me.OperatorToken, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' The operator being defined. ''' </summary> Public ReadOnly Property OperatorToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OperatorStatementSyntax)._operatorToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the OperatorToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOperatorToken(operatorToken as SyntaxToken) As OperatorStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.OperatorKeyword, operatorToken, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' The method's parameter list including the parentheses. If no parameter list was ''' present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property ParameterList As ParameterListSyntax Get Return GetRed(_parameterList, 4) End Get End Property Friend Overrides Function GetParameterListCore() As ParameterListSyntax Return Me.ParameterList End Function Friend Overrides Function WithParameterListCore(parameterList As ParameterListSyntax) As MethodBaseSyntax Return WithParameterList(parameterList) End Function ''' <summary> ''' Returns a copy of this with the ParameterList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithParameterList(parameterList as ParameterListSyntax) As OperatorStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.OperatorKeyword, Me.OperatorToken, parameterList, Me.AsClause) End Function Public Shadows Function AddParameterListParameters(ParamArray items As ParameterSyntax()) As OperatorStatementSyntax Dim _child = If(Me.ParameterList IsNot Nothing, Me.ParameterList, SyntaxFactory.ParameterList()) Return Me.WithParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddParameterListParametersCore(ParamArray items As ParameterSyntax()) As MethodBaseSyntax Return AddParameterListParameters(items) End Function ''' <summary> ''' The "As" clause that describes the return type. If no As clause was present, ''' Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 5) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As OperatorStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.OperatorKeyword, Me.OperatorToken, Me.ParameterList, asClause) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 4 Return Me._parameterList Case 5 Return Me._asClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 4 Return Me.ParameterList Case 5 Return Me.AsClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitOperatorStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitOperatorStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="operatorKeyword"> ''' The value for the OperatorKeyword property. ''' </param> ''' <param name="operatorToken"> ''' The value for the OperatorToken property. ''' </param> ''' <param name="parameterList"> ''' The value for the ParameterList property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, operatorKeyword As SyntaxToken, operatorToken As SyntaxToken, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax) As OperatorStatementSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse operatorKeyword <> Me.OperatorKeyword OrElse operatorToken <> Me.OperatorToken OrElse parameterList IsNot Me.ParameterList OrElse asClause IsNot Me.AsClause Then Dim newNode = SyntaxFactory.OperatorStatement(attributeLists, modifiers, operatorKeyword, operatorToken, parameterList, asClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Statement that declares a property. If this property has accessors declared, ''' this statement will be the Begin of a BlockNode, and the accessors will be the ''' Body of that node. Auto properties are property declarations without a ''' PropertyBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.PropertyStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class PropertyStatementSyntax Inherits MethodBaseSyntax Friend _asClause as AsClauseSyntax Friend _initializer as EqualsValueSyntax Friend _implementsClause as ImplementsClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, propertyKeyword As InternalSyntax.KeywordSyntax, identifier As InternalSyntax.IdentifierTokenSyntax, parameterList As ParameterListSyntax, asClause As AsClauseSyntax, initializer As EqualsValueSyntax, implementsClause As ImplementsClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PropertyStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, propertyKeyword, identifier, if(parameterList IsNot Nothing, DirectCast(parameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax), Nothing), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AsClauseSyntax), Nothing), if(initializer IsNot Nothing, DirectCast(initializer.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EqualsValueSyntax), Nothing), if(implementsClause IsNot Nothing, DirectCast(implementsClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImplementsClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As MethodBaseSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As PropertyStatementSyntax return Update(attributeLists, Me.Modifiers, Me.PropertyKeyword, Me.Identifier, Me.ParameterList, Me.AsClause, Me.Initializer, Me.ImplementsClause) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As PropertyStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As MethodBaseSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. A bitfield version of all ''' the modifiers ORed together, which is in many cases easier to use, can be ''' obtained with the Modifiers property. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PropertyStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As MethodBaseSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As PropertyStatementSyntax return Update(Me.AttributeLists, modifiers, Me.PropertyKeyword, Me.Identifier, Me.ParameterList, Me.AsClause, Me.Initializer, Me.ImplementsClause) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As PropertyStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As MethodBaseSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Property" keyword that introduces this property declaration. ''' </summary> Public ReadOnly Property PropertyKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PropertyStatementSyntax)._propertyKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the PropertyKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithPropertyKeyword(propertyKeyword as SyntaxToken) As PropertyStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, propertyKeyword, Me.Identifier, Me.ParameterList, Me.AsClause, Me.Initializer, Me.ImplementsClause) End Function ''' <summary> ''' The name of the property being declared. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PropertyStatementSyntax)._identifier, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As PropertyStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.PropertyKeyword, identifier, Me.ParameterList, Me.AsClause, Me.Initializer, Me.ImplementsClause) End Function ''' <summary> ''' The method's parameter list including the parentheses. If no parameter list was ''' present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property ParameterList As ParameterListSyntax Get Return GetRed(_parameterList, 4) End Get End Property Friend Overrides Function GetParameterListCore() As ParameterListSyntax Return Me.ParameterList End Function Friend Overrides Function WithParameterListCore(parameterList As ParameterListSyntax) As MethodBaseSyntax Return WithParameterList(parameterList) End Function ''' <summary> ''' Returns a copy of this with the ParameterList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithParameterList(parameterList as ParameterListSyntax) As PropertyStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.PropertyKeyword, Me.Identifier, parameterList, Me.AsClause, Me.Initializer, Me.ImplementsClause) End Function Public Shadows Function AddParameterListParameters(ParamArray items As ParameterSyntax()) As PropertyStatementSyntax Dim _child = If(Me.ParameterList IsNot Nothing, Me.ParameterList, SyntaxFactory.ParameterList()) Return Me.WithParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddParameterListParametersCore(ParamArray items As ParameterSyntax()) As MethodBaseSyntax Return AddParameterListParameters(items) End Function ''' <summary> ''' The "As" clause that describes the return type. If no As clause was present, ''' Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As AsClauseSyntax Get Return GetRed(_asClause, 5) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as AsClauseSyntax) As PropertyStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.PropertyKeyword, Me.Identifier, Me.ParameterList, asClause, Me.Initializer, Me.ImplementsClause) End Function ''' <summary> ''' If present, an "= initial-value" clause describing the initial value of the ''' property. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Initializer As EqualsValueSyntax Get Return GetRed(_initializer, 6) End Get End Property ''' <summary> ''' Returns a copy of this with the Initializer property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInitializer(initializer as EqualsValueSyntax) As PropertyStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.PropertyKeyword, Me.Identifier, Me.ParameterList, Me.AsClause, initializer, Me.ImplementsClause) End Function ''' <summary> ''' If present, an Implements clause indicated the interface methods that this ''' method implements. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ImplementsClause As ImplementsClauseSyntax Get Return GetRed(_implementsClause, 7) End Get End Property ''' <summary> ''' Returns a copy of this with the ImplementsClause property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithImplementsClause(implementsClause as ImplementsClauseSyntax) As PropertyStatementSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.PropertyKeyword, Me.Identifier, Me.ParameterList, Me.AsClause, Me.Initializer, implementsClause) End Function Public Shadows Function AddImplementsClauseInterfaceMembers(ParamArray items As QualifiedNameSyntax()) As PropertyStatementSyntax Dim _child = If(Me.ImplementsClause IsNot Nothing, Me.ImplementsClause, SyntaxFactory.ImplementsClause()) Return Me.WithImplementsClause(_child.AddInterfaceMembers(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 4 Return Me._parameterList Case 5 Return Me._asClause Case 6 Return Me._initializer Case 7 Return Me._implementsClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 4 Return Me.ParameterList Case 5 Return Me.AsClause Case 6 Return Me.Initializer Case 7 Return Me.ImplementsClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitPropertyStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitPropertyStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="propertyKeyword"> ''' The value for the PropertyKeyword property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="parameterList"> ''' The value for the ParameterList property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> ''' <param name="initializer"> ''' The value for the Initializer property. ''' </param> ''' <param name="implementsClause"> ''' The value for the ImplementsClause property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, propertyKeyword As SyntaxToken, identifier As SyntaxToken, parameterList As ParameterListSyntax, asClause As AsClauseSyntax, initializer As EqualsValueSyntax, implementsClause As ImplementsClauseSyntax) As PropertyStatementSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse propertyKeyword <> Me.PropertyKeyword OrElse identifier <> Me.Identifier OrElse parameterList IsNot Me.ParameterList OrElse asClause IsNot Me.AsClause OrElse initializer IsNot Me.Initializer OrElse implementsClause IsNot Me.ImplementsClause Then Dim newNode = SyntaxFactory.PropertyStatement(attributeLists, modifiers, propertyKeyword, identifier, parameterList, asClause, initializer, implementsClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a Get or Set accessor on a property declaration or an AddHandler, ''' RemoveHandler or RaiseEvent accessor on a custom event declaration. The Kind of ''' the node determines what kind of accessor this is. This statement is always the ''' Begin of a BlockNode, and the body of the accessor is the Body of that node. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.GetAccessorStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.SetAccessorStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.AddHandlerAccessorStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.RemoveHandlerAccessorStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.RaiseEventAccessorStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AccessorStatementSyntax Inherits MethodBaseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, accessorKeyword As InternalSyntax.KeywordSyntax, parameterList As ParameterListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AccessorStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, accessorKeyword, if(parameterList IsNot Nothing, DirectCast(parameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As MethodBaseSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As AccessorStatementSyntax return Update(Me.Kind, attributeLists, Me.Modifiers, Me.AccessorKeyword, Me.ParameterList) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As AccessorStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As MethodBaseSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. A bitfield version of all ''' the modifiers ORed together, which is in many cases easier to use, can be ''' obtained with the Modifiers property. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AccessorStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As MethodBaseSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As AccessorStatementSyntax return Update(Me.Kind, Me.AttributeLists, modifiers, Me.AccessorKeyword, Me.ParameterList) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As AccessorStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As MethodBaseSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Get", "Set", "AddHandler", "RemoveHandler", or "RaiseEvent" keyword that ''' introduces this accessor declaration. ''' </summary> Public ReadOnly Property AccessorKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AccessorStatementSyntax)._accessorKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the AccessorKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAccessorKeyword(accessorKeyword as SyntaxToken) As AccessorStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, accessorKeyword, Me.ParameterList) End Function ''' <summary> ''' The method's parameter list including the parentheses. If no parameter list was ''' present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property ParameterList As ParameterListSyntax Get Return GetRed(_parameterList, 3) End Get End Property Friend Overrides Function GetParameterListCore() As ParameterListSyntax Return Me.ParameterList End Function Friend Overrides Function WithParameterListCore(parameterList As ParameterListSyntax) As MethodBaseSyntax Return WithParameterList(parameterList) End Function ''' <summary> ''' Returns a copy of this with the ParameterList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithParameterList(parameterList as ParameterListSyntax) As AccessorStatementSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.AccessorKeyword, parameterList) End Function Public Shadows Function AddParameterListParameters(ParamArray items As ParameterSyntax()) As AccessorStatementSyntax Dim _child = If(Me.ParameterList IsNot Nothing, Me.ParameterList, SyntaxFactory.ParameterList()) Return Me.WithParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddParameterListParametersCore(ParamArray items As ParameterSyntax()) As MethodBaseSyntax Return AddParameterListParameters(items) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 3 Return Me._parameterList Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 3 Return Me.ParameterList Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAccessorStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAccessorStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="accessorKeyword"> ''' The value for the AccessorKeyword property. ''' </param> ''' <param name="parameterList"> ''' The value for the ParameterList property. ''' </param> Public Function Update(kind As SyntaxKind, attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, accessorKeyword As SyntaxToken, parameterList As ParameterListSyntax) As AccessorStatementSyntax If kind <> Me.Kind OrElse attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse accessorKeyword <> Me.AccessorKeyword OrElse parameterList IsNot Me.ParameterList Then Dim newNode = SyntaxFactory.AccessorStatement(kind, attributeLists, modifiers, accessorKeyword, parameterList) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Implements ..." clause on a type member, which describes which ''' interface members this member implements. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ImplementsClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ImplementsClauseSyntax Inherits VisualBasicSyntaxNode Friend _interfaceMembers as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), implementsKeyword As InternalSyntax.KeywordSyntax, interfaceMembers As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImplementsClauseSyntax(kind, errors, annotations, implementsKeyword, if(interfaceMembers IsNot Nothing, interfaceMembers.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Implements" keyword. ''' </summary> Public ReadOnly Property ImplementsKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ImplementsClauseSyntax)._implementsKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ImplementsKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithImplementsKeyword(implementsKeyword as SyntaxToken) As ImplementsClauseSyntax return Update(implementsKeyword, Me.InterfaceMembers) End Function ''' <summary> ''' The list of interface members being implemented. ''' </summary> Public ReadOnly Property InterfaceMembers As SeparatedSyntaxList(Of QualifiedNameSyntax) Get Dim listNode = GetRed(_interfaceMembers, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of QualifiedNameSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the InterfaceMembers property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithInterfaceMembers(interfaceMembers as SeparatedSyntaxList(Of QualifiedNameSyntax)) As ImplementsClauseSyntax return Update(Me.ImplementsKeyword, interfaceMembers) End Function Public Shadows Function AddInterfaceMembers(ParamArray items As QualifiedNameSyntax()) As ImplementsClauseSyntax Return Me.WithInterfaceMembers(Me.InterfaceMembers.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._interfaceMembers Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_interfaceMembers, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitImplementsClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitImplementsClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="implementsKeyword"> ''' The value for the ImplementsKeyword property. ''' </param> ''' <param name="interfaceMembers"> ''' The value for the InterfaceMembers property. ''' </param> Public Function Update(implementsKeyword As SyntaxToken, interfaceMembers As SeparatedSyntaxList(Of QualifiedNameSyntax)) As ImplementsClauseSyntax If implementsKeyword <> Me.ImplementsKeyword OrElse interfaceMembers <> Me.InterfaceMembers Then Dim newNode = SyntaxFactory.ImplementsClause(implementsKeyword, interfaceMembers) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Handles ..." clause on a method declaration that describes ''' which events this method handles. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.HandlesClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class HandlesClauseSyntax Inherits VisualBasicSyntaxNode Friend _events as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), handlesKeyword As InternalSyntax.KeywordSyntax, events As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.HandlesClauseSyntax(kind, errors, annotations, handlesKeyword, if(events IsNot Nothing, events.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Handles" keyword. ''' </summary> Public ReadOnly Property HandlesKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.HandlesClauseSyntax)._handlesKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the HandlesKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithHandlesKeyword(handlesKeyword as SyntaxToken) As HandlesClauseSyntax return Update(handlesKeyword, Me.Events) End Function ''' <summary> ''' The list of event members being handled. ''' </summary> Public ReadOnly Property Events As SeparatedSyntaxList(Of HandlesClauseItemSyntax) Get Dim listNode = GetRed(_events, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of HandlesClauseItemSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Events property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function [WithEvents](events as SeparatedSyntaxList(Of HandlesClauseItemSyntax)) As HandlesClauseSyntax return Update(Me.HandlesKeyword, events) End Function Public Shadows Function AddEvents(ParamArray items As HandlesClauseItemSyntax()) As HandlesClauseSyntax Return Me.WithEvents(Me.Events.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._events Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_events, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitHandlesClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitHandlesClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="handlesKeyword"> ''' The value for the HandlesKeyword property. ''' </param> ''' <param name="events"> ''' The value for the Events property. ''' </param> Public Function Update(handlesKeyword As SyntaxToken, events As SeparatedSyntaxList(Of HandlesClauseItemSyntax)) As HandlesClauseSyntax If handlesKeyword <> Me.HandlesKeyword OrElse events <> Me.Events Then Dim newNode = SyntaxFactory.HandlesClause(handlesKeyword, events) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents container of an event in a Handles clause item. ''' </summary> Public MustInherit Class EventContainerSyntax Inherits ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents event container specified through special keywords "Me", "MyBase" or ''' "MyClass".. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.KeywordEventContainer"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class KeywordEventContainerSyntax Inherits EventContainerSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), keyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.KeywordEventContainerSyntax(kind, errors, annotations, keyword), Nothing, 0) End Sub ''' <summary> ''' The container of the event. This can be one of the special keywords: "Me", ''' "MyBase" or "MyClass". ''' </summary> Public ReadOnly Property Keyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.KeywordEventContainerSyntax)._keyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Keyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithKeyword(keyword as SyntaxToken) As KeywordEventContainerSyntax return Update(keyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitKeywordEventContainer(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitKeywordEventContainer(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="keyword"> ''' The value for the Keyword property. ''' </param> Public Function Update(keyword As SyntaxToken) As KeywordEventContainerSyntax If keyword <> Me.Keyword Then Dim newNode = SyntaxFactory.KeywordEventContainer(keyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents event container that refers to a WithEvents member. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.WithEventsEventContainer"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class WithEventsEventContainerSyntax Inherits EventContainerSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), identifier As InternalSyntax.IdentifierTokenSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WithEventsEventContainerSyntax(kind, errors, annotations, identifier), Nothing, 0) End Sub ''' <summary> ''' The container of the event. It is a simple identifier that refers to a ''' WithEvents member of the containing type. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WithEventsEventContainerSyntax)._identifier, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As WithEventsEventContainerSyntax return Update(identifier) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitWithEventsEventContainer(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitWithEventsEventContainer(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> Public Function Update(identifier As SyntaxToken) As WithEventsEventContainerSyntax If identifier <> Me.Identifier Then Dim newNode = SyntaxFactory.WithEventsEventContainer(identifier) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents event container that refers to a WithEvents member's property. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.WithEventsPropertyEventContainer"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class WithEventsPropertyEventContainerSyntax Inherits EventContainerSyntax Friend _withEventsContainer as WithEventsEventContainerSyntax Friend _property as IdentifierNameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), withEventsContainer As WithEventsEventContainerSyntax, dotToken As InternalSyntax.PunctuationSyntax, [property] As IdentifierNameSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WithEventsPropertyEventContainerSyntax(kind, errors, annotations, DirectCast(withEventsContainer.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WithEventsEventContainerSyntax), dotToken, DirectCast([property].Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IdentifierNameSyntax)), Nothing, 0) End Sub ''' <summary> ''' The container of the event. ''' </summary> Public ReadOnly Property WithEventsContainer As WithEventsEventContainerSyntax Get Return GetRedAtZero(_withEventsContainer) End Get End Property ''' <summary> ''' Returns a copy of this with the WithEventsContainer property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithWithEventsContainer(withEventsContainer as WithEventsEventContainerSyntax) As WithEventsPropertyEventContainerSyntax return Update(withEventsContainer, Me.DotToken, Me.Property) End Function ''' <summary> ''' The "." token. ''' </summary> Public ReadOnly Property DotToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WithEventsPropertyEventContainerSyntax)._dotToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the DotToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithDotToken(dotToken as SyntaxToken) As WithEventsPropertyEventContainerSyntax return Update(Me.WithEventsContainer, dotToken, Me.Property) End Function ''' <summary> ''' The provider of the event. It is a property of a WithEvents member of the ''' containing type. ''' </summary> Public ReadOnly Property [Property] As IdentifierNameSyntax Get Return GetRed(_property, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the [Property] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithProperty([property] as IdentifierNameSyntax) As WithEventsPropertyEventContainerSyntax return Update(Me.WithEventsContainer, Me.DotToken, [property]) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._withEventsContainer Case 2 Return Me._property Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.WithEventsContainer Case 2 Return Me.[Property] Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitWithEventsPropertyEventContainer(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitWithEventsPropertyEventContainer(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="withEventsContainer"> ''' The value for the WithEventsContainer property. ''' </param> ''' <param name="dotToken"> ''' The value for the DotToken property. ''' </param> ''' <param name="property"> ''' The value for the Property property. ''' </param> Public Function Update(withEventsContainer As WithEventsEventContainerSyntax, dotToken As SyntaxToken, [property] As IdentifierNameSyntax) As WithEventsPropertyEventContainerSyntax If withEventsContainer IsNot Me.WithEventsContainer OrElse dotToken <> Me.DotToken OrElse [property] IsNot Me.[Property] Then Dim newNode = SyntaxFactory.WithEventsPropertyEventContainer(withEventsContainer, dotToken, [property]) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a single handled event in a "Handles ..." clause. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.HandlesClauseItem"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class HandlesClauseItemSyntax Inherits VisualBasicSyntaxNode Friend _eventContainer as EventContainerSyntax Friend _eventMember as IdentifierNameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), eventContainer As EventContainerSyntax, dotToken As InternalSyntax.PunctuationSyntax, eventMember As IdentifierNameSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.HandlesClauseItemSyntax(kind, errors, annotations, DirectCast(eventContainer.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EventContainerSyntax), dotToken, DirectCast(eventMember.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IdentifierNameSyntax)), Nothing, 0) End Sub ''' <summary> ''' The container of the event. This can either be a simple identifier (identifying ''' a members of the containing type) or one of the special keywords "Me", "MyBase" ''' or "MyClass". ''' </summary> Public ReadOnly Property EventContainer As EventContainerSyntax Get Return GetRedAtZero(_eventContainer) End Get End Property ''' <summary> ''' Returns a copy of this with the EventContainer property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEventContainer(eventContainer as EventContainerSyntax) As HandlesClauseItemSyntax return Update(eventContainer, Me.DotToken, Me.EventMember) End Function ''' <summary> ''' The "." token. ''' </summary> Public ReadOnly Property DotToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.HandlesClauseItemSyntax)._dotToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the DotToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithDotToken(dotToken as SyntaxToken) As HandlesClauseItemSyntax return Update(Me.EventContainer, dotToken, Me.EventMember) End Function ''' <summary> ''' The event being handled. This must be a simple identifier. ''' </summary> Public ReadOnly Property EventMember As IdentifierNameSyntax Get Return GetRed(_eventMember, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EventMember property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEventMember(eventMember as IdentifierNameSyntax) As HandlesClauseItemSyntax return Update(Me.EventContainer, Me.DotToken, eventMember) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._eventContainer Case 2 Return Me._eventMember Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.EventContainer Case 2 Return Me.EventMember Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitHandlesClauseItem(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitHandlesClauseItem(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="eventContainer"> ''' The value for the EventContainer property. ''' </param> ''' <param name="dotToken"> ''' The value for the DotToken property. ''' </param> ''' <param name="eventMember"> ''' The value for the EventMember property. ''' </param> Public Function Update(eventContainer As EventContainerSyntax, dotToken As SyntaxToken, eventMember As IdentifierNameSyntax) As HandlesClauseItemSyntax If eventContainer IsNot Me.EventContainer OrElse dotToken <> Me.DotToken OrElse eventMember IsNot Me.EventMember Then Dim newNode = SyntaxFactory.HandlesClauseItem(eventContainer, dotToken, eventMember) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the beginning of a declaration. However, not enough syntax is ''' detected to classify this as a field, method, property or event. This is node ''' always represents a syntax error. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.IncompleteMember"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class IncompleteMemberSyntax Inherits DeclarationStatementSyntax Friend _attributeLists as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, missingIdentifier As InternalSyntax.IdentifierTokenSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IncompleteMemberSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, missingIdentifier), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As IncompleteMemberSyntax return Update(attributeLists, Me.Modifiers, Me.MissingIdentifier) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As IncompleteMemberSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IncompleteMemberSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As IncompleteMemberSyntax return Update(Me.AttributeLists, modifiers, Me.MissingIdentifier) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As IncompleteMemberSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function ''' <summary> ''' The missing identifier token for this incomplete member. Should only be used to ''' have a location for error reporting. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property MissingIdentifier As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IncompleteMemberSyntax)._missingIdentifier If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(2), Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the MissingIdentifier property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithMissingIdentifier(missingIdentifier as SyntaxToken) As IncompleteMemberSyntax return Update(Me.AttributeLists, Me.Modifiers, missingIdentifier) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitIncompleteMember(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitIncompleteMember(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="missingIdentifier"> ''' The value for the MissingIdentifier property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, missingIdentifier As SyntaxToken) As IncompleteMemberSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse missingIdentifier <> Me.MissingIdentifier Then Dim newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, missingIdentifier) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the declaration of one or more variables or constants, either as ''' local variables or as class/structure members. In the case of a constant, it is ''' represented by having "Const" in the Modifiers (although technically "Const" is ''' not a modifier, it is represented as one in the parse trees.) ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.FieldDeclaration"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class FieldDeclarationSyntax Inherits DeclarationStatementSyntax Friend _attributeLists as SyntaxNode Friend _declarators as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, declarators As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FieldDeclarationSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, if(declarators IsNot Nothing, declarators.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As FieldDeclarationSyntax return Update(attributeLists, Me.Modifiers, Me.Declarators) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As FieldDeclarationSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FieldDeclarationSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As FieldDeclarationSyntax return Update(Me.AttributeLists, modifiers, Me.Declarators) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As FieldDeclarationSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function ''' <summary> ''' The list of variable declarator. Each declarator specifies one or more variable ''' names along with a type and/or initializer. ''' </summary> Public ReadOnly Property Declarators As SeparatedSyntaxList(Of VariableDeclaratorSyntax) Get Dim listNode = GetRed(_declarators, 2) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of VariableDeclaratorSyntax)(listNode, Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Declarators property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithDeclarators(declarators as SeparatedSyntaxList(Of VariableDeclaratorSyntax)) As FieldDeclarationSyntax return Update(Me.AttributeLists, Me.Modifiers, declarators) End Function Public Shadows Function AddDeclarators(ParamArray items As VariableDeclaratorSyntax()) As FieldDeclarationSyntax Return Me.WithDeclarators(Me.Declarators.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 2 Return Me._declarators Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 2 Return GetRed(_declarators, 2) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitFieldDeclaration(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitFieldDeclaration(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="declarators"> ''' The value for the Declarators property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, declarators As SeparatedSyntaxList(Of VariableDeclaratorSyntax)) As FieldDeclarationSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse declarators <> Me.Declarators Then Dim newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declarators) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the part of a variable or constant declaration statement that ''' associated one or more variable names with a type. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.VariableDeclarator"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class VariableDeclaratorSyntax Inherits VisualBasicSyntaxNode Friend _names as SyntaxNode Friend _asClause as AsClauseSyntax Friend _initializer as EqualsValueSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), names As SyntaxNode, asClause As AsClauseSyntax, initializer As EqualsValueSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.VariableDeclaratorSyntax(kind, errors, annotations, if(names IsNot Nothing, names.Green, Nothing), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AsClauseSyntax), Nothing), if(initializer IsNot Nothing, DirectCast(initializer.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EqualsValueSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The names of the variables being declared. Each name might have a "?" or "()" ''' modifier(s) attached. ''' </summary> Public ReadOnly Property Names As SeparatedSyntaxList(Of ModifiedIdentifierSyntax) Get Dim listNode = GetRedAtZero(_names) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ModifiedIdentifierSyntax)(listNode, 0) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Names property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithNames(names as SeparatedSyntaxList(Of ModifiedIdentifierSyntax)) As VariableDeclaratorSyntax return Update(names, Me.AsClause, Me.Initializer) End Function Public Shadows Function AddNames(ParamArray items As ModifiedIdentifierSyntax()) As VariableDeclaratorSyntax Return Me.WithNames(Me.Names.AddRange(items)) End Function ''' <summary> ''' The "As" clause that describes the return type, and possibly includes "New", ''' "With" or "From". If no As clause was present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As AsClauseSyntax Get Return GetRed(_asClause, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as AsClauseSyntax) As VariableDeclaratorSyntax return Update(Me.Names, asClause, Me.Initializer) End Function ''' <summary> ''' If present, an "= initial-value" clause describing the initial value of the ''' variable or the value of the constant. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Initializer As EqualsValueSyntax Get Return GetRed(_initializer, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Initializer property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInitializer(initializer as EqualsValueSyntax) As VariableDeclaratorSyntax return Update(Me.Names, Me.AsClause, initializer) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._names Case 1 Return Me._asClause Case 2 Return Me._initializer Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_names) Case 1 Return Me.AsClause Case 2 Return Me.Initializer Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitVariableDeclarator(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitVariableDeclarator(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="names"> ''' The value for the Names property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> ''' <param name="initializer"> ''' The value for the Initializer property. ''' </param> Public Function Update(names As SeparatedSyntaxList(Of ModifiedIdentifierSyntax), asClause As AsClauseSyntax, initializer As EqualsValueSyntax) As VariableDeclaratorSyntax If names <> Me.Names OrElse asClause IsNot Me.AsClause OrElse initializer IsNot Me.Initializer Then Dim newNode = SyntaxFactory.VariableDeclarator(names, asClause, initializer) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Abstract node class that represents the different kinds of "As {type-name}" ''' clauses in a declaration: simple "As" clauses and "As New" clauses. The type ''' has optional attributes associated with it, although attributes are not ''' permitted in all possible places where this node occurs. ''' </summary> Public MustInherit Class AsClauseSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The "As" keyword. ''' </summary> Public ReadOnly Property AsKeyword As SyntaxToken Get Return Me.GetAsKeywordCore() End Get End Property Friend Overridable Function GetAsKeywordCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AsClauseSyntax)._asKeyword, Me.Position, 0) End Function ''' <summary> ''' Returns a copy of this with the AsKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithAsKeyword(asKeyword As SyntaxToken) As AsClauseSyntax Return WithAsKeywordCore(asKeyword) End Function Friend MustOverride Function WithAsKeywordCore(asKeyword As SyntaxToken) As AsClauseSyntax End Class ''' <summary> ''' Represents an "As {type-name}" clause that does not have an initializer or ''' "New". The type has optional attributes associated with it, although attributes ''' are not permitted in all possible places where this node occurs. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SimpleAsClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SimpleAsClauseSyntax Inherits AsClauseSyntax Friend _attributeLists as SyntaxNode Friend _type as TypeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), asKeyword As InternalSyntax.KeywordSyntax, attributeLists As SyntaxNode, type As TypeSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax(kind, errors, annotations, asKeyword, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), DirectCast(type.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "As" keyword. ''' </summary> Public Shadows ReadOnly Property AsKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax)._asKeyword, Me.Position, 0) End Get End Property Friend Overrides Function GetAsKeywordCore() As SyntaxToken Return Me.AsKeyword End Function Friend Overrides Function WithAsKeywordCore(asKeyword As SyntaxToken) As AsClauseSyntax Return WithAsKeyword(asKeyword) End Function ''' <summary> ''' Returns a copy of this with the AsKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsKeyword(asKeyword as SyntaxToken) As SimpleAsClauseSyntax return Update(asKeyword, Me.AttributeLists, Me.Type) End Function ''' <summary> ''' A list of all attribute lists on the type. If no attributes were specified, an ''' empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRed(_attributeLists, 1) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As SimpleAsClauseSyntax return Update(Me.AsKeyword, attributeLists, Me.Type) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As SimpleAsClauseSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function ''' <summary> ''' The type-name part of the As clause. ''' </summary> Public ReadOnly Property Type As TypeSyntax Get Return GetRed(_type, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithType(type as TypeSyntax) As SimpleAsClauseSyntax return Update(Me.AsKeyword, Me.AttributeLists, type) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._attributeLists Case 2 Return Me._type Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_attributeLists, 1) Case 2 Return Me.Type Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSimpleAsClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSimpleAsClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="asKeyword"> ''' The value for the AsKeyword property. ''' </param> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="type"> ''' The value for the Type property. ''' </param> Public Function Update(asKeyword As SyntaxToken, attributeLists As SyntaxList(of AttributeListSyntax), type As TypeSyntax) As SimpleAsClauseSyntax If asKeyword <> Me.AsKeyword OrElse attributeLists <> Me.AttributeLists OrElse type IsNot Me.Type Then Dim newNode = SyntaxFactory.SimpleAsClause(asKeyword, attributeLists, type) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an "As New {type-name} [arguments] [initializers]" clause in a ''' declaration. The type has optional attributes associated with it, although ''' attributes are not permitted in many places where this node occurs (they are ''' permitted, for example, on automatically implemented properties.) ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.AsNewClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AsNewClauseSyntax Inherits AsClauseSyntax Friend _newExpression as NewExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), asKeyword As InternalSyntax.KeywordSyntax, newExpression As NewExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AsNewClauseSyntax(kind, errors, annotations, asKeyword, DirectCast(newExpression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NewExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "As" keyword. ''' </summary> Public Shadows ReadOnly Property AsKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AsNewClauseSyntax)._asKeyword, Me.Position, 0) End Get End Property Friend Overrides Function GetAsKeywordCore() As SyntaxToken Return Me.AsKeyword End Function Friend Overrides Function WithAsKeywordCore(asKeyword As SyntaxToken) As AsClauseSyntax Return WithAsKeyword(asKeyword) End Function ''' <summary> ''' Returns a copy of this with the AsKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsKeyword(asKeyword as SyntaxToken) As AsNewClauseSyntax return Update(asKeyword, Me.NewExpression) End Function ''' <summary> ''' The New expression ''' </summary> Public ReadOnly Property NewExpression As NewExpressionSyntax Get Return GetRed(_newExpression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the NewExpression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNewExpression(newExpression as NewExpressionSyntax) As AsNewClauseSyntax return Update(Me.AsKeyword, newExpression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._newExpression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.NewExpression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAsNewClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAsNewClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="asKeyword"> ''' The value for the AsKeyword property. ''' </param> ''' <param name="newExpression"> ''' The value for the NewExpression property. ''' </param> Public Function Update(asKeyword As SyntaxToken, newExpression As NewExpressionSyntax) As AsNewClauseSyntax If asKeyword <> Me.AsKeyword OrElse newExpression IsNot Me.NewExpression Then Dim newNode = SyntaxFactory.AsNewClause(asKeyword, newExpression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' An abstract node class that represents a "With" or "From" clause used to ''' initialize a new object. ''' </summary> Public MustInherit Class ObjectCreationInitializerSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents a "With {...} clause used to initialize a new object's members. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ObjectMemberInitializer"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ObjectMemberInitializerSyntax Inherits ObjectCreationInitializerSyntax Friend _initializers as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), withKeyword As InternalSyntax.KeywordSyntax, openBraceToken As InternalSyntax.PunctuationSyntax, initializers As SyntaxNode, closeBraceToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ObjectMemberInitializerSyntax(kind, errors, annotations, withKeyword, openBraceToken, if(initializers IsNot Nothing, initializers.Green, Nothing), closeBraceToken), Nothing, 0) End Sub ''' <summary> ''' The "With" keyword. ''' </summary> Public ReadOnly Property WithKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ObjectMemberInitializerSyntax)._withKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the WithKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithWithKeyword(withKeyword as SyntaxToken) As ObjectMemberInitializerSyntax return Update(withKeyword, Me.OpenBraceToken, Me.Initializers, Me.CloseBraceToken) End Function ''' <summary> ''' The "{" token. ''' </summary> Public ReadOnly Property OpenBraceToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ObjectMemberInitializerSyntax)._openBraceToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenBraceToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenBraceToken(openBraceToken as SyntaxToken) As ObjectMemberInitializerSyntax return Update(Me.WithKeyword, openBraceToken, Me.Initializers, Me.CloseBraceToken) End Function ''' <summary> ''' The comma-separated list of field initializers. ''' </summary> Public ReadOnly Property Initializers As SeparatedSyntaxList(Of FieldInitializerSyntax) Get Dim listNode = GetRed(_initializers, 2) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of FieldInitializerSyntax)(listNode, Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Initializers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInitializers(initializers as SeparatedSyntaxList(Of FieldInitializerSyntax)) As ObjectMemberInitializerSyntax return Update(Me.WithKeyword, Me.OpenBraceToken, initializers, Me.CloseBraceToken) End Function Public Shadows Function AddInitializers(ParamArray items As FieldInitializerSyntax()) As ObjectMemberInitializerSyntax Return Me.WithInitializers(Me.Initializers.AddRange(items)) End Function ''' <summary> ''' The "}" token. ''' </summary> Public ReadOnly Property CloseBraceToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ObjectMemberInitializerSyntax)._closeBraceToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseBraceToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseBraceToken(closeBraceToken as SyntaxToken) As ObjectMemberInitializerSyntax return Update(Me.WithKeyword, Me.OpenBraceToken, Me.Initializers, closeBraceToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._initializers Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return GetRed(_initializers, 2) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitObjectMemberInitializer(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitObjectMemberInitializer(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="withKeyword"> ''' The value for the WithKeyword property. ''' </param> ''' <param name="openBraceToken"> ''' The value for the OpenBraceToken property. ''' </param> ''' <param name="initializers"> ''' The value for the Initializers property. ''' </param> ''' <param name="closeBraceToken"> ''' The value for the CloseBraceToken property. ''' </param> Public Function Update(withKeyword As SyntaxToken, openBraceToken As SyntaxToken, initializers As SeparatedSyntaxList(Of FieldInitializerSyntax), closeBraceToken As SyntaxToken) As ObjectMemberInitializerSyntax If withKeyword <> Me.WithKeyword OrElse openBraceToken <> Me.OpenBraceToken OrElse initializers <> Me.Initializers OrElse closeBraceToken <> Me.CloseBraceToken Then Dim newNode = SyntaxFactory.ObjectMemberInitializer(withKeyword, openBraceToken, initializers, closeBraceToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "From {...} clause used to initialize a new collection object's ''' elements. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ObjectCollectionInitializer"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ObjectCollectionInitializerSyntax Inherits ObjectCreationInitializerSyntax Friend _initializer as CollectionInitializerSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), fromKeyword As InternalSyntax.KeywordSyntax, initializer As CollectionInitializerSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ObjectCollectionInitializerSyntax(kind, errors, annotations, fromKeyword, DirectCast(initializer.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CollectionInitializerSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "From" keyword. ''' </summary> Public ReadOnly Property FromKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ObjectCollectionInitializerSyntax)._fromKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the FromKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithFromKeyword(fromKeyword as SyntaxToken) As ObjectCollectionInitializerSyntax return Update(fromKeyword, Me.Initializer) End Function ''' <summary> ''' The initializer including the braces. ''' </summary> Public ReadOnly Property Initializer As CollectionInitializerSyntax Get Return GetRed(_initializer, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Initializer property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInitializer(initializer as CollectionInitializerSyntax) As ObjectCollectionInitializerSyntax return Update(Me.FromKeyword, initializer) End Function Public Shadows Function AddInitializerInitializers(ParamArray items As ExpressionSyntax()) As ObjectCollectionInitializerSyntax Dim _child = If(Me.Initializer IsNot Nothing, Me.Initializer, SyntaxFactory.CollectionInitializer()) Return Me.WithInitializer(_child.AddInitializers(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._initializer Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Initializer Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitObjectCollectionInitializer(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitObjectCollectionInitializer(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="fromKeyword"> ''' The value for the FromKeyword property. ''' </param> ''' <param name="initializer"> ''' The value for the Initializer property. ''' </param> Public Function Update(fromKeyword As SyntaxToken, initializer As CollectionInitializerSyntax) As ObjectCollectionInitializerSyntax If fromKeyword <> Me.FromKeyword OrElse initializer IsNot Me.Initializer Then Dim newNode = SyntaxFactory.ObjectCollectionInitializer(fromKeyword, initializer) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Abstract class that represent a single field initializer used in a "With {...}" ''' field initializer list. ''' </summary> Public MustInherit Class FieldInitializerSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The optional "Key" keyword. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property KeyKeyword As SyntaxToken Get Return Me.GetKeyKeywordCore() End Get End Property Friend Overridable Function GetKeyKeywordCore() As SyntaxToken Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FieldInitializerSyntax)._keyKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.Position, 0) End If Return Nothing End Function ''' <summary> ''' Returns a copy of this with the KeyKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithKeyKeyword(keyKeyword As SyntaxToken) As FieldInitializerSyntax Return WithKeyKeywordCore(keyKeyword) End Function Friend MustOverride Function WithKeyKeywordCore(keyKeyword As SyntaxToken) As FieldInitializerSyntax End Class ''' <summary> ''' Represent a field initializer in a With {...} initializer where the field name ''' is inferred from the initializer expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.InferredFieldInitializer"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class InferredFieldInitializerSyntax Inherits FieldInitializerSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), keyKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InferredFieldInitializerSyntax(kind, errors, annotations, keyKeyword, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The optional "Key" keyword. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property KeyKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InferredFieldInitializerSyntax)._keyKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.Position, 0) End If Return Nothing End Get End Property Friend Overrides Function GetKeyKeywordCore() As SyntaxToken Return Me.KeyKeyword End Function Friend Overrides Function WithKeyKeywordCore(keyKeyword As SyntaxToken) As FieldInitializerSyntax Return WithKeyKeyword(keyKeyword) End Function ''' <summary> ''' Returns a copy of this with the KeyKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithKeyKeyword(keyKeyword as SyntaxToken) As InferredFieldInitializerSyntax return Update(keyKeyword, Me.Expression) End Function ''' <summary> ''' The value being assigned. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As InferredFieldInitializerSyntax return Update(Me.KeyKeyword, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitInferredFieldInitializer(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitInferredFieldInitializer(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="keyKeyword"> ''' The value for the KeyKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(keyKeyword As SyntaxToken, expression As ExpressionSyntax) As InferredFieldInitializerSyntax If keyKeyword <> Me.KeyKeyword OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.InferredFieldInitializer(keyKeyword, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represent a named field initializer in a With {...} initializer, such as ".x = ''' expr". ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.NamedFieldInitializer"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class NamedFieldInitializerSyntax Inherits FieldInitializerSyntax Friend _name as IdentifierNameSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), keyKeyword As InternalSyntax.KeywordSyntax, dotToken As InternalSyntax.PunctuationSyntax, name As IdentifierNameSyntax, equalsToken As InternalSyntax.PunctuationSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NamedFieldInitializerSyntax(kind, errors, annotations, keyKeyword, dotToken, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IdentifierNameSyntax), equalsToken, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The optional "Key" keyword. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property KeyKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NamedFieldInitializerSyntax)._keyKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.Position, 0) End If Return Nothing End Get End Property Friend Overrides Function GetKeyKeywordCore() As SyntaxToken Return Me.KeyKeyword End Function Friend Overrides Function WithKeyKeywordCore(keyKeyword As SyntaxToken) As FieldInitializerSyntax Return WithKeyKeyword(keyKeyword) End Function ''' <summary> ''' Returns a copy of this with the KeyKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithKeyKeyword(keyKeyword as SyntaxToken) As NamedFieldInitializerSyntax return Update(keyKeyword, Me.DotToken, Me.Name, Me.EqualsToken, Me.Expression) End Function ''' <summary> ''' The "." token. ''' </summary> Public ReadOnly Property DotToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NamedFieldInitializerSyntax)._dotToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the DotToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithDotToken(dotToken as SyntaxToken) As NamedFieldInitializerSyntax return Update(Me.KeyKeyword, dotToken, Me.Name, Me.EqualsToken, Me.Expression) End Function ''' <summary> ''' The name of the field being initialized. ''' </summary> Public ReadOnly Property Name As IdentifierNameSyntax Get Return GetRed(_name, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as IdentifierNameSyntax) As NamedFieldInitializerSyntax return Update(Me.KeyKeyword, Me.DotToken, name, Me.EqualsToken, Me.Expression) End Function ''' <summary> ''' The "=" token. ''' </summary> Public ReadOnly Property EqualsToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NamedFieldInitializerSyntax)._equalsToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the EqualsToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEqualsToken(equalsToken as SyntaxToken) As NamedFieldInitializerSyntax return Update(Me.KeyKeyword, Me.DotToken, Me.Name, equalsToken, Me.Expression) End Function ''' <summary> ''' The value being assigned to the field. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As NamedFieldInitializerSyntax return Update(Me.KeyKeyword, Me.DotToken, Me.Name, Me.EqualsToken, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._name Case 4 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Name Case 4 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitNamedFieldInitializer(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitNamedFieldInitializer(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="keyKeyword"> ''' The value for the KeyKeyword property. ''' </param> ''' <param name="dotToken"> ''' The value for the DotToken property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="equalsToken"> ''' The value for the EqualsToken property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(keyKeyword As SyntaxToken, dotToken As SyntaxToken, name As IdentifierNameSyntax, equalsToken As SyntaxToken, expression As ExpressionSyntax) As NamedFieldInitializerSyntax If keyKeyword <> Me.KeyKeyword OrElse dotToken <> Me.DotToken OrElse name IsNot Me.Name OrElse equalsToken <> Me.EqualsToken OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.NamedFieldInitializer(keyKeyword, dotToken, name, equalsToken, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an "= initializer" clause in a declaration for a variable, parameter ''' or automatic property. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EqualsValue"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EqualsValueSyntax Inherits VisualBasicSyntaxNode Friend _value as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), equalsToken As InternalSyntax.PunctuationSyntax, value As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EqualsValueSyntax(kind, errors, annotations, equalsToken, DirectCast(value.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "=" token. ''' </summary> Public ReadOnly Property EqualsToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EqualsValueSyntax)._equalsToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the EqualsToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEqualsToken(equalsToken as SyntaxToken) As EqualsValueSyntax return Update(equalsToken, Me.Value) End Function ''' <summary> ''' The expression used as the initial value. ''' </summary> Public ReadOnly Property Value As ExpressionSyntax Get Return GetRed(_value, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Value property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithValue(value as ExpressionSyntax) As EqualsValueSyntax return Update(Me.EqualsToken, value) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._value Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Value Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEqualsValue(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEqualsValue(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="equalsToken"> ''' The value for the EqualsToken property. ''' </param> ''' <param name="value"> ''' The value for the Value property. ''' </param> Public Function Update(equalsToken As SyntaxToken, value As ExpressionSyntax) As EqualsValueSyntax If equalsToken <> Me.EqualsToken OrElse value IsNot Me.Value Then Dim newNode = SyntaxFactory.EqualsValue(equalsToken, value) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represent a parameter to a method, property, constructor, etc. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.Parameter"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ParameterSyntax Inherits VisualBasicSyntaxNode Friend _attributeLists as SyntaxNode Friend _identifier as ModifiedIdentifierSyntax Friend _asClause as SimpleAsClauseSyntax Friend _default as EqualsValueSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, identifier As ModifiedIdentifierSyntax, asClause As SimpleAsClauseSyntax, [default] As EqualsValueSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, DirectCast(identifier.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModifiedIdentifierSyntax), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing), if([default] IsNot Nothing, DirectCast([default].Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EqualsValueSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this parameter. If no attributes were ''' specified, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As ParameterSyntax return Update(attributeLists, Me.Modifiers, Me.Identifier, Me.AsClause, Me.Default) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As ParameterSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function ''' <summary> ''' A list of the modifier tokens "ByVal", "ByRef", "Optional" or "ParamArray" that ''' modify this parameter. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As ParameterSyntax return Update(Me.AttributeLists, modifiers, Me.Identifier, Me.AsClause, Me.Default) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As ParameterSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function ''' <summary> ''' The name of the parameter, including any "?" or "()" modifiers. ''' </summary> Public ReadOnly Property Identifier As ModifiedIdentifierSyntax Get Return GetRed(_identifier, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as ModifiedIdentifierSyntax) As ParameterSyntax return Update(Me.AttributeLists, Me.Modifiers, identifier, Me.AsClause, Me.Default) End Function ''' <summary> ''' If present, the "As type-name" clause describing the type of the parameter. If ''' no As clause is present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As ParameterSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.Identifier, asClause, Me.Default) End Function ''' <summary> ''' If present, an initializer with the default value of the parameter. If no ''' default value is present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property [Default] As EqualsValueSyntax Get Return GetRed(_default, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the [Default] property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithDefault([default] as EqualsValueSyntax) As ParameterSyntax return Update(Me.AttributeLists, Me.Modifiers, Me.Identifier, Me.AsClause, [default]) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 2 Return Me._identifier Case 3 Return Me._asClause Case 4 Return Me._default Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 2 Return Me.Identifier Case 3 Return Me.AsClause Case 4 Return Me.[Default] Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitParameter(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitParameter(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> ''' <param name="default"> ''' The value for the Default property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, identifier As ModifiedIdentifierSyntax, asClause As SimpleAsClauseSyntax, [default] As EqualsValueSyntax) As ParameterSyntax If attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse identifier IsNot Me.Identifier OrElse asClause IsNot Me.AsClause OrElse [default] IsNot Me.[Default] Then Dim newNode = SyntaxFactory.Parameter(attributeLists, modifiers, identifier, asClause, [default]) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an identifier with optional "?" or "()" or "(,,,)" modifiers, as ''' used in parameter declarations and variable declarations. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ModifiedIdentifier"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ModifiedIdentifierSyntax Inherits VisualBasicSyntaxNode Friend _arrayBounds as ArgumentListSyntax Friend _arrayRankSpecifiers as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), identifier As InternalSyntax.IdentifierTokenSyntax, nullable As InternalSyntax.PunctuationSyntax, arrayBounds As ArgumentListSyntax, arrayRankSpecifiers As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModifiedIdentifierSyntax(kind, errors, annotations, identifier, nullable, if(arrayBounds IsNot Nothing, DirectCast(arrayBounds.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArgumentListSyntax), Nothing), if(arrayRankSpecifiers IsNot Nothing, arrayRankSpecifiers.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The identifier that names the item being declared. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModifiedIdentifierSyntax)._identifier, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As ModifiedIdentifierSyntax return Update(identifier, Me.Nullable, Me.ArrayBounds, Me.ArrayRankSpecifiers) End Function ''' <summary> ''' The "?" token that indicates a nullable type. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Nullable As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModifiedIdentifierSyntax)._nullable If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Nullable property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNullable(nullable as SyntaxToken) As ModifiedIdentifierSyntax return Update(Me.Identifier, nullable, Me.ArrayBounds, Me.ArrayRankSpecifiers) End Function ''' <summary> ''' The optional array bounds, such as "(4)" or "(0 to 5, 0 To 6)". ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ArrayBounds As ArgumentListSyntax Get Return GetRed(_arrayBounds, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the ArrayBounds property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArrayBounds(arrayBounds as ArgumentListSyntax) As ModifiedIdentifierSyntax return Update(Me.Identifier, Me.Nullable, arrayBounds, Me.ArrayRankSpecifiers) End Function Public Shadows Function AddArrayBoundsArguments(ParamArray items As ArgumentSyntax()) As ModifiedIdentifierSyntax Dim _child = If(Me.ArrayBounds IsNot Nothing, Me.ArrayBounds, SyntaxFactory.ArgumentList()) Return Me.WithArrayBounds(_child.AddArguments(items)) End Function ''' <summary> ''' A list of array modifiers for the type. If no array modifiers were present, an ''' empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property ArrayRankSpecifiers As SyntaxList(Of ArrayRankSpecifierSyntax) Get Dim listNode = GetRed(_arrayRankSpecifiers, 3) Return new SyntaxList(Of ArrayRankSpecifierSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the ArrayRankSpecifiers property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithArrayRankSpecifiers(arrayRankSpecifiers as SyntaxList(Of ArrayRankSpecifierSyntax)) As ModifiedIdentifierSyntax return Update(Me.Identifier, Me.Nullable, Me.ArrayBounds, arrayRankSpecifiers) End Function Public Shadows Function AddArrayRankSpecifiers(ParamArray items As ArrayRankSpecifierSyntax()) As ModifiedIdentifierSyntax Return Me.WithArrayRankSpecifiers(Me.ArrayRankSpecifiers.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._arrayBounds Case 3 Return Me._arrayRankSpecifiers Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.ArrayBounds Case 3 Return GetRed(_arrayRankSpecifiers, 3) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitModifiedIdentifier(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitModifiedIdentifier(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="nullable"> ''' The value for the Nullable property. ''' </param> ''' <param name="arrayBounds"> ''' The value for the ArrayBounds property. ''' </param> ''' <param name="arrayRankSpecifiers"> ''' The value for the ArrayRankSpecifiers property. ''' </param> Public Function Update(identifier As SyntaxToken, nullable As SyntaxToken, arrayBounds As ArgumentListSyntax, arrayRankSpecifiers As SyntaxList(of ArrayRankSpecifierSyntax)) As ModifiedIdentifierSyntax If identifier <> Me.Identifier OrElse nullable <> Me.Nullable OrElse arrayBounds IsNot Me.ArrayBounds OrElse arrayRankSpecifiers <> Me.ArrayRankSpecifiers Then Dim newNode = SyntaxFactory.ModifiedIdentifier(identifier, nullable, arrayBounds, arrayRankSpecifiers) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a modifier that describes an array type, without bounds, such as ''' "()" or "(,)". ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ArrayRankSpecifier"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ArrayRankSpecifierSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), openParenToken As InternalSyntax.PunctuationSyntax, commaTokens As GreenNode, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArrayRankSpecifierSyntax(kind, errors, annotations, openParenToken, commaTokens, closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "(" token. ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArrayRankSpecifierSyntax)._openParenToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As ArrayRankSpecifierSyntax return Update(openParenToken, Me.CommaTokens, Me.CloseParenToken) End Function ''' <summary> ''' The comma tokens in the array type. There is one less comma than the rank. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property CommaTokens As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArrayRankSpecifierSyntax)._commaTokens If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the CommaTokens property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCommaTokens(commaTokens as SyntaxTokenList) As ArrayRankSpecifierSyntax return Update(Me.OpenParenToken, commaTokens, Me.CloseParenToken) End Function Public Shadows Function AddCommaTokens(ParamArray items As SyntaxToken()) As ArrayRankSpecifierSyntax Return Me.WithCommaTokens(Me.CommaTokens.AddRange(items)) End Function ''' <summary> ''' The ")" token. ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArrayRankSpecifierSyntax)._closeParenToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As ArrayRankSpecifierSyntax return Update(Me.OpenParenToken, Me.CommaTokens, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitArrayRankSpecifier(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitArrayRankSpecifier(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="commaTokens"> ''' The value for the CommaTokens property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(openParenToken As SyntaxToken, commaTokens As SyntaxTokenList, closeParenToken As SyntaxToken) As ArrayRankSpecifierSyntax If openParenToken <> Me.OpenParenToken OrElse commaTokens <> Me.CommaTokens OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.ArrayRankSpecifier(openParenToken, commaTokens, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a group of attributes within "<" and ">" brackets. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.AttributeList"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AttributeListSyntax Inherits VisualBasicSyntaxNode Friend _attributes as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lessThanToken As InternalSyntax.PunctuationSyntax, attributes As SyntaxNode, greaterThanToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AttributeListSyntax(kind, errors, annotations, lessThanToken, if(attributes IsNot Nothing, attributes.Green, Nothing), greaterThanToken), Nothing, 0) End Sub ''' <summary> ''' The "<" token. ''' </summary> Public ReadOnly Property LessThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AttributeListSyntax)._lessThanToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LessThanToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLessThanToken(lessThanToken as SyntaxToken) As AttributeListSyntax return Update(lessThanToken, Me.Attributes, Me.GreaterThanToken) End Function ''' <summary> ''' A comma separated list of attribute declarations in this attribute list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Attributes As SeparatedSyntaxList(Of AttributeSyntax) Get Dim listNode = GetRed(_attributes, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of AttributeSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Attributes property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAttributes(attributes as SeparatedSyntaxList(Of AttributeSyntax)) As AttributeListSyntax return Update(Me.LessThanToken, attributes, Me.GreaterThanToken) End Function Public Shadows Function AddAttributes(ParamArray items As AttributeSyntax()) As AttributeListSyntax Return Me.WithAttributes(Me.Attributes.AddRange(items)) End Function ''' <summary> ''' The ">" token. ''' </summary> Public ReadOnly Property GreaterThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AttributeListSyntax)._greaterThanToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the GreaterThanToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithGreaterThanToken(greaterThanToken as SyntaxToken) As AttributeListSyntax return Update(Me.LessThanToken, Me.Attributes, greaterThanToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._attributes Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_attributes, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAttributeList(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAttributeList(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lessThanToken"> ''' The value for the LessThanToken property. ''' </param> ''' <param name="attributes"> ''' The value for the Attributes property. ''' </param> ''' <param name="greaterThanToken"> ''' The value for the GreaterThanToken property. ''' </param> Public Function Update(lessThanToken As SyntaxToken, attributes As SeparatedSyntaxList(Of AttributeSyntax), greaterThanToken As SyntaxToken) As AttributeListSyntax If lessThanToken <> Me.LessThanToken OrElse attributes <> Me.Attributes OrElse greaterThanToken <> Me.GreaterThanToken Then Dim newNode = SyntaxFactory.AttributeList(lessThanToken, attributes, greaterThanToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a single attribute declaration within an attribute list. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.Attribute"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AttributeSyntax Inherits VisualBasicSyntaxNode Friend _target as AttributeTargetSyntax Friend _name as TypeSyntax Friend _argumentList as ArgumentListSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), target As AttributeTargetSyntax, name As TypeSyntax, argumentList As ArgumentListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AttributeSyntax(kind, errors, annotations, if(target IsNot Nothing, DirectCast(target.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AttributeTargetSyntax), Nothing), DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax), if(argumentList IsNot Nothing, DirectCast(argumentList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArgumentListSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' Optional attribute target. Assembly|Module : ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Target As AttributeTargetSyntax Get Return GetRedAtZero(_target) End Get End Property ''' <summary> ''' Returns a copy of this with the Target property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithTarget(target as AttributeTargetSyntax) As AttributeSyntax return Update(target, Me.Name, Me.ArgumentList) End Function ''' <summary> ''' The name of the attribute. ''' </summary> Public ReadOnly Property Name As TypeSyntax Get Return GetRed(_name, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as TypeSyntax) As AttributeSyntax return Update(Me.Target, name, Me.ArgumentList) End Function ''' <summary> ''' The argument list, if present. If no argument list was supplied, Nothing is ''' returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ArgumentList As ArgumentListSyntax Get Return GetRed(_argumentList, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the ArgumentList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArgumentList(argumentList as ArgumentListSyntax) As AttributeSyntax return Update(Me.Target, Me.Name, argumentList) End Function Public Shadows Function AddArgumentListArguments(ParamArray items As ArgumentSyntax()) As AttributeSyntax Dim _child = If(Me.ArgumentList IsNot Nothing, Me.ArgumentList, SyntaxFactory.ArgumentList()) Return Me.WithArgumentList(_child.AddArguments(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._target Case 1 Return Me._name Case 2 Return Me._argumentList Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Target Case 1 Return Me.Name Case 2 Return Me.ArgumentList Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAttribute(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAttribute(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="target"> ''' The value for the Target property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="argumentList"> ''' The value for the ArgumentList property. ''' </param> Public Function Update(target As AttributeTargetSyntax, name As TypeSyntax, argumentList As ArgumentListSyntax) As AttributeSyntax If target IsNot Me.Target OrElse name IsNot Me.Name OrElse argumentList IsNot Me.ArgumentList Then Dim newNode = SyntaxFactory.Attribute(target, name, argumentList) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a single attribute declaration within an attribute list. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.AttributeTarget"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AttributeTargetSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeModifier As InternalSyntax.KeywordSyntax, colonToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AttributeTargetSyntax(kind, errors, annotations, attributeModifier, colonToken), Nothing, 0) End Sub ''' <summary> ''' The "Assembly" or "Module" attribute modifier, is present. If no attribute ''' modifier is present, Nothing is returned. ''' </summary> Public ReadOnly Property AttributeModifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AttributeTargetSyntax)._attributeModifier, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the AttributeModifier property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeModifier(attributeModifier as SyntaxToken) As AttributeTargetSyntax return Update(attributeModifier, Me.ColonToken) End Function ''' <summary> ''' The ":" token, if an attribute modifier is present. If no attribute modifier is ''' present, Nothing is returned. ''' </summary> Public ReadOnly Property ColonToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AttributeTargetSyntax)._colonToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ColonToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithColonToken(colonToken as SyntaxToken) As AttributeTargetSyntax return Update(Me.AttributeModifier, colonToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAttributeTarget(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAttributeTarget(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeModifier"> ''' The value for the AttributeModifier property. ''' </param> ''' <param name="colonToken"> ''' The value for the ColonToken property. ''' </param> Public Function Update(attributeModifier As SyntaxToken, colonToken As SyntaxToken) As AttributeTargetSyntax If attributeModifier <> Me.AttributeModifier OrElse colonToken <> Me.ColonToken Then Dim newNode = SyntaxFactory.AttributeTarget(attributeModifier, colonToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a file-level attribute, in which the attributes have no other ''' syntactic element they are attached to. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.AttributesStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AttributesStatementSyntax Inherits DeclarationStatementSyntax Friend _attributeLists as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AttributesStatementSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The list of attribute lists. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As AttributesStatementSyntax return Update(attributeLists) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As AttributesStatementSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Me._attributeLists Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode If i = 0 Then Return GetRedAtZero(_attributeLists) Else Return Nothing End If End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAttributesStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAttributesStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> Public Function Update(attributeLists As SyntaxList(of AttributeListSyntax)) As AttributesStatementSyntax If attributeLists <> Me.AttributeLists Then Dim newNode = SyntaxFactory.AttributesStatement(attributeLists) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represent an expression in a statement context. This may only be a invocation ''' or await expression in standard code but may be any expression in VB ''' Interactive code. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ExpressionStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ExpressionStatementSyntax Inherits ExecutableStatementSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionStatementSyntax(kind, errors, annotations, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The expression. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRedAtZero(_expression) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As ExpressionStatementSyntax return Update(expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Me._expression Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode If i = 0 Then Return Me.Expression Else Return Nothing End If End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitExpressionStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitExpressionStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(expression As ExpressionSyntax) As ExpressionStatementSyntax If expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.ExpressionStatement(expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represent a "? expression" "Print" statement in VB Interactive code. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.PrintStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class PrintStatementSyntax Inherits ExecutableStatementSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), questionToken As InternalSyntax.PunctuationSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PrintStatementSyntax(kind, errors, annotations, questionToken, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' "?" token. ''' </summary> Public ReadOnly Property QuestionToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PrintStatementSyntax)._questionToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the QuestionToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithQuestionToken(questionToken as SyntaxToken) As PrintStatementSyntax return Update(questionToken, Me.Expression) End Function ''' <summary> ''' The expression whose value is being output. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As PrintStatementSyntax return Update(Me.QuestionToken, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitPrintStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitPrintStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="questionToken"> ''' The value for the QuestionToken property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(questionToken As SyntaxToken, expression As ExpressionSyntax) As PrintStatementSyntax If questionToken <> Me.QuestionToken OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.PrintStatement(questionToken, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a While...End While statement, including the While, body and End ''' While. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.WhileBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class WhileBlockSyntax Inherits ExecutableStatementSyntax Friend _whileStatement as WhileStatementSyntax Friend _statements as SyntaxNode Friend _endWhileStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), whileStatement As WhileStatementSyntax, statements As SyntaxNode, endWhileStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WhileBlockSyntax(kind, errors, annotations, DirectCast(whileStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WhileStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), DirectCast(endWhileStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The While statement that begins the block. ''' </summary> Public ReadOnly Property WhileStatement As WhileStatementSyntax Get Return GetRedAtZero(_whileStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the WhileStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithWhileStatement(whileStatement as WhileStatementSyntax) As WhileBlockSyntax return Update(whileStatement, Me.Statements, Me.EndWhileStatement) End Function ''' <summary> ''' The statements contained in the While...End While. This might be an empty list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As WhileBlockSyntax return Update(Me.WhileStatement, statements, Me.EndWhileStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As WhileBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function ''' <summary> ''' The End While statement that ends the block. ''' </summary> Public ReadOnly Property EndWhileStatement As EndBlockStatementSyntax Get Return GetRed(_endWhileStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndWhileStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndWhileStatement(endWhileStatement as EndBlockStatementSyntax) As WhileBlockSyntax return Update(Me.WhileStatement, Me.Statements, endWhileStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._whileStatement Case 1 Return Me._statements Case 2 Return Me._endWhileStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.WhileStatement Case 1 Return GetRed(_statements, 1) Case 2 Return Me.EndWhileStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitWhileBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitWhileBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="whileStatement"> ''' The value for the WhileStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="endWhileStatement"> ''' The value for the EndWhileStatement property. ''' </param> Public Function Update(whileStatement As WhileStatementSyntax, statements As SyntaxList(of StatementSyntax), endWhileStatement As EndBlockStatementSyntax) As WhileBlockSyntax If whileStatement IsNot Me.WhileStatement OrElse statements <> Me.Statements OrElse endWhileStatement IsNot Me.EndWhileStatement Then Dim newNode = SyntaxFactory.WhileBlock(whileStatement, statements, endWhileStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an entire Using...End Using statement, including the Using, body and ''' End Using statements. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.UsingBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class UsingBlockSyntax Inherits ExecutableStatementSyntax Friend _usingStatement as UsingStatementSyntax Friend _statements as SyntaxNode Friend _endUsingStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), usingStatement As UsingStatementSyntax, statements As SyntaxNode, endUsingStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.UsingBlockSyntax(kind, errors, annotations, DirectCast(usingStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.UsingStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), DirectCast(endUsingStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The UsingStatement that begins the Using...End Using block. ''' </summary> Public ReadOnly Property UsingStatement As UsingStatementSyntax Get Return GetRedAtZero(_usingStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the UsingStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithUsingStatement(usingStatement as UsingStatementSyntax) As UsingBlockSyntax return Update(usingStatement, Me.Statements, Me.EndUsingStatement) End Function ''' <summary> ''' The statements contained in the Using...End Using block. This might be an empty ''' list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As UsingBlockSyntax return Update(Me.UsingStatement, statements, Me.EndUsingStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As UsingBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function ''' <summary> ''' The End Using statement that ends the block. ''' </summary> Public ReadOnly Property EndUsingStatement As EndBlockStatementSyntax Get Return GetRed(_endUsingStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndUsingStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndUsingStatement(endUsingStatement as EndBlockStatementSyntax) As UsingBlockSyntax return Update(Me.UsingStatement, Me.Statements, endUsingStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._usingStatement Case 1 Return Me._statements Case 2 Return Me._endUsingStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.UsingStatement Case 1 Return GetRed(_statements, 1) Case 2 Return Me.EndUsingStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitUsingBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitUsingBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="usingStatement"> ''' The value for the UsingStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="endUsingStatement"> ''' The value for the EndUsingStatement property. ''' </param> Public Function Update(usingStatement As UsingStatementSyntax, statements As SyntaxList(of StatementSyntax), endUsingStatement As EndBlockStatementSyntax) As UsingBlockSyntax If usingStatement IsNot Me.UsingStatement OrElse statements <> Me.Statements OrElse endUsingStatement IsNot Me.EndUsingStatement Then Dim newNode = SyntaxFactory.UsingBlock(usingStatement, statements, endUsingStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a entire SyncLock...End SyncLock block, including the SyncLock ''' statement, the enclosed statements, and the End SyncLock statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SyncLockBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SyncLockBlockSyntax Inherits ExecutableStatementSyntax Friend _syncLockStatement as SyncLockStatementSyntax Friend _statements as SyntaxNode Friend _endSyncLockStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), syncLockStatement As SyncLockStatementSyntax, statements As SyntaxNode, endSyncLockStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SyncLockBlockSyntax(kind, errors, annotations, DirectCast(syncLockStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SyncLockStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), DirectCast(endSyncLockStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The SyncLock statement that begins the block. ''' </summary> Public ReadOnly Property SyncLockStatement As SyncLockStatementSyntax Get Return GetRedAtZero(_syncLockStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the SyncLockStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSyncLockStatement(syncLockStatement as SyncLockStatementSyntax) As SyncLockBlockSyntax return Update(syncLockStatement, Me.Statements, Me.EndSyncLockStatement) End Function ''' <summary> ''' The statements contained in the SyncLock...End SyncLock statement. This might ''' be an empty list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As SyncLockBlockSyntax return Update(Me.SyncLockStatement, statements, Me.EndSyncLockStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As SyncLockBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function ''' <summary> ''' The End SyncLock statement that ends the block. ''' </summary> Public ReadOnly Property EndSyncLockStatement As EndBlockStatementSyntax Get Return GetRed(_endSyncLockStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndSyncLockStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndSyncLockStatement(endSyncLockStatement as EndBlockStatementSyntax) As SyncLockBlockSyntax return Update(Me.SyncLockStatement, Me.Statements, endSyncLockStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._syncLockStatement Case 1 Return Me._statements Case 2 Return Me._endSyncLockStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.SyncLockStatement Case 1 Return GetRed(_statements, 1) Case 2 Return Me.EndSyncLockStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSyncLockBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSyncLockBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="syncLockStatement"> ''' The value for the SyncLockStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="endSyncLockStatement"> ''' The value for the EndSyncLockStatement property. ''' </param> Public Function Update(syncLockStatement As SyncLockStatementSyntax, statements As SyntaxList(of StatementSyntax), endSyncLockStatement As EndBlockStatementSyntax) As SyncLockBlockSyntax If syncLockStatement IsNot Me.SyncLockStatement OrElse statements <> Me.Statements OrElse endSyncLockStatement IsNot Me.EndSyncLockStatement Then Dim newNode = SyntaxFactory.SyncLockBlock(syncLockStatement, statements, endSyncLockStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a With...End With block, include the With statement, the body of the ''' block and the End With statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.WithBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class WithBlockSyntax Inherits ExecutableStatementSyntax Friend _withStatement as WithStatementSyntax Friend _statements as SyntaxNode Friend _endWithStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), withStatement As WithStatementSyntax, statements As SyntaxNode, endWithStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WithBlockSyntax(kind, errors, annotations, DirectCast(withStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WithStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), DirectCast(endWithStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The WithStatement that begins the With...End With block. ''' </summary> Public ReadOnly Property WithStatement As WithStatementSyntax Get Return GetRedAtZero(_withStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the WithStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithWithStatement(withStatement as WithStatementSyntax) As WithBlockSyntax return Update(withStatement, Me.Statements, Me.EndWithStatement) End Function ''' <summary> ''' The statements contained in the With...End With block. This might be an empty ''' list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As WithBlockSyntax return Update(Me.WithStatement, statements, Me.EndWithStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As WithBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function ''' <summary> ''' The End With statement that ends the block. ''' </summary> Public ReadOnly Property EndWithStatement As EndBlockStatementSyntax Get Return GetRed(_endWithStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndWithStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndWithStatement(endWithStatement as EndBlockStatementSyntax) As WithBlockSyntax return Update(Me.WithStatement, Me.Statements, endWithStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._withStatement Case 1 Return Me._statements Case 2 Return Me._endWithStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.WithStatement Case 1 Return GetRed(_statements, 1) Case 2 Return Me.EndWithStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitWithBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitWithBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="withStatement"> ''' The value for the WithStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="endWithStatement"> ''' The value for the EndWithStatement property. ''' </param> Public Function Update(withStatement As WithStatementSyntax, statements As SyntaxList(of StatementSyntax), endWithStatement As EndBlockStatementSyntax) As WithBlockSyntax If withStatement IsNot Me.WithStatement OrElse statements <> Me.Statements OrElse endWithStatement IsNot Me.EndWithStatement Then Dim newNode = SyntaxFactory.WithBlock(withStatement, statements, endWithStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the declaration of one or more local variables or constants. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.LocalDeclarationStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class LocalDeclarationStatementSyntax Inherits ExecutableStatementSyntax Friend _declarators as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), modifiers As GreenNode, declarators As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LocalDeclarationStatementSyntax(kind, errors, annotations, modifiers, if(declarators IsNot Nothing, declarators.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The modifier token (Static, Dim or Const) that introduces this local variable ''' declaration. ''' </summary> Public ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LocalDeclarationStatementSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.Position, 0) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As LocalDeclarationStatementSyntax return Update(modifiers, Me.Declarators) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As LocalDeclarationStatementSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function ''' <summary> ''' The list of variable declarator. Each declarator specifies one or more variable ''' names along with a type and/or initializer. ''' </summary> Public ReadOnly Property Declarators As SeparatedSyntaxList(Of VariableDeclaratorSyntax) Get Dim listNode = GetRed(_declarators, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of VariableDeclaratorSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Declarators property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithDeclarators(declarators as SeparatedSyntaxList(Of VariableDeclaratorSyntax)) As LocalDeclarationStatementSyntax return Update(Me.Modifiers, declarators) End Function Public Shadows Function AddDeclarators(ParamArray items As VariableDeclaratorSyntax()) As LocalDeclarationStatementSyntax Return Me.WithDeclarators(Me.Declarators.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._declarators Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_declarators, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitLocalDeclarationStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitLocalDeclarationStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="declarators"> ''' The value for the Declarators property. ''' </param> Public Function Update(modifiers As SyntaxTokenList, declarators As SeparatedSyntaxList(Of VariableDeclaratorSyntax)) As LocalDeclarationStatementSyntax If modifiers <> Me.Modifiers OrElse declarators <> Me.Declarators Then Dim newNode = SyntaxFactory.LocalDeclarationStatement(modifiers, declarators) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a label statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.LabelStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class LabelStatementSyntax Inherits ExecutableStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), labelToken As InternalSyntax.SyntaxToken, colonToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LabelStatementSyntax(kind, errors, annotations, labelToken, colonToken), Nothing, 0) End Sub ''' <summary> ''' The name of the label. If the label is a line number, returns an IntegerLiteral ''' that is the line number, otherwise, returns an Identifier. ''' </summary> Public ReadOnly Property LabelToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LabelStatementSyntax)._labelToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LabelToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLabelToken(labelToken as SyntaxToken) As LabelStatementSyntax return Update(labelToken, Me.ColonToken) End Function ''' <summary> ''' The ":" token of the label statement. ''' </summary> Public ReadOnly Property ColonToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LabelStatementSyntax)._colonToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ColonToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithColonToken(colonToken as SyntaxToken) As LabelStatementSyntax return Update(Me.LabelToken, colonToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitLabelStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitLabelStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="labelToken"> ''' The value for the LabelToken property. ''' </param> ''' <param name="colonToken"> ''' The value for the ColonToken property. ''' </param> Public Function Update(labelToken As SyntaxToken, colonToken As SyntaxToken) As LabelStatementSyntax If labelToken <> Me.LabelToken OrElse colonToken <> Me.ColonToken Then Dim newNode = SyntaxFactory.LabelStatement(labelToken, colonToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "GoTo" statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.GoToStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class GoToStatementSyntax Inherits ExecutableStatementSyntax Friend _label as LabelSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), goToKeyword As InternalSyntax.KeywordSyntax, label As LabelSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GoToStatementSyntax(kind, errors, annotations, goToKeyword, DirectCast(label.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LabelSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "GoTo" keyword. ''' </summary> Public ReadOnly Property GoToKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GoToStatementSyntax)._goToKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the GoToKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithGoToKeyword(goToKeyword as SyntaxToken) As GoToStatementSyntax return Update(goToKeyword, Me.Label) End Function ''' <summary> ''' The name of the label. If the label is a line number, wraps an IntegerLiteral ''' that is the line number, otherwise, wraps an Identifier. ''' </summary> Public ReadOnly Property Label As LabelSyntax Get Return GetRed(_label, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Label property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithLabel(label as LabelSyntax) As GoToStatementSyntax return Update(Me.GoToKeyword, label) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._label Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Label Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitGoToStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitGoToStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="goToKeyword"> ''' The value for the GoToKeyword property. ''' </param> ''' <param name="label"> ''' The value for the Label property. ''' </param> Public Function Update(goToKeyword As SyntaxToken, label As LabelSyntax) As GoToStatementSyntax If goToKeyword <> Me.GoToKeyword OrElse label IsNot Me.Label Then Dim newNode = SyntaxFactory.GoToStatement(goToKeyword, label) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' A label for a GoTo, Resume, or On Error statement. An identifier, line number, ''' or next keyword. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.IdentifierLabel"/></description></item> ''' <item><description><see cref="SyntaxKind.NumericLabel"/></description></item> ''' <item><description><see cref="SyntaxKind.NextLabel"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class LabelSyntax Inherits ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), labelToken As InternalSyntax.SyntaxToken) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LabelSyntax(kind, errors, annotations, labelToken), Nothing, 0) End Sub ''' <summary> ''' The label name (identifier), line number (integer literal), or next keyword ''' token. ''' </summary> Public ReadOnly Property LabelToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LabelSyntax)._labelToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LabelToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLabelToken(labelToken as SyntaxToken) As LabelSyntax return Update(Me.Kind, labelToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitLabel(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitLabel(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="labelToken"> ''' The value for the LabelToken property. ''' </param> Public Function Update(kind As SyntaxKind, labelToken As SyntaxToken) As LabelSyntax If kind <> Me.Kind OrElse labelToken <> Me.LabelToken Then Dim newNode = SyntaxFactory.Label(kind, labelToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "Stop" or "End" statement. The Kind can be used to determine which ''' kind of statement this is. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.StopStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.EndStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class StopOrEndStatementSyntax Inherits ExecutableStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), stopOrEndKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.StopOrEndStatementSyntax(kind, errors, annotations, stopOrEndKeyword), Nothing, 0) End Sub ''' <summary> ''' The "Stop" or "End" keyword. ''' </summary> Public ReadOnly Property StopOrEndKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.StopOrEndStatementSyntax)._stopOrEndKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the StopOrEndKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithStopOrEndKeyword(stopOrEndKeyword as SyntaxToken) As StopOrEndStatementSyntax return Update(Me.Kind, stopOrEndKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitStopOrEndStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitStopOrEndStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="stopOrEndKeyword"> ''' The value for the StopOrEndKeyword property. ''' </param> Public Function Update(kind As SyntaxKind, stopOrEndKeyword As SyntaxToken) As StopOrEndStatementSyntax If kind <> Me.Kind OrElse stopOrEndKeyword <> Me.StopOrEndKeyword Then Dim newNode = SyntaxFactory.StopOrEndStatement(kind, stopOrEndKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' An exit statement. The kind of block being exited can be found by examining the ''' Kind. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ExitDoStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ExitForStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ExitSubStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ExitFunctionStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ExitOperatorStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ExitPropertyStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ExitTryStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ExitSelectStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ExitWhileStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ExitStatementSyntax Inherits ExecutableStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), exitKeyword As InternalSyntax.KeywordSyntax, blockKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExitStatementSyntax(kind, errors, annotations, exitKeyword, blockKeyword), Nothing, 0) End Sub ''' <summary> ''' The "Exit" keyword. ''' </summary> Public ReadOnly Property ExitKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExitStatementSyntax)._exitKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ExitKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExitKeyword(exitKeyword as SyntaxToken) As ExitStatementSyntax return Update(Me.Kind, exitKeyword, Me.BlockKeyword) End Function ''' <summary> ''' The keyword describing the block to exit. ''' </summary> Public ReadOnly Property BlockKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExitStatementSyntax)._blockKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the BlockKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithBlockKeyword(blockKeyword as SyntaxToken) As ExitStatementSyntax return Update(Me.Kind, Me.ExitKeyword, blockKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitExitStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitExitStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="exitKeyword"> ''' The value for the ExitKeyword property. ''' </param> ''' <param name="blockKeyword"> ''' The value for the BlockKeyword property. ''' </param> Public Function Update(kind As SyntaxKind, exitKeyword As SyntaxToken, blockKeyword As SyntaxToken) As ExitStatementSyntax If kind <> Me.Kind OrElse exitKeyword <> Me.ExitKeyword OrElse blockKeyword <> Me.BlockKeyword Then Dim newNode = SyntaxFactory.ExitStatement(kind, exitKeyword, blockKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "Continue (block)" statement. THe kind of block referenced can be ''' determined by examining the Kind. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ContinueWhileStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ContinueDoStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ContinueForStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ContinueStatementSyntax Inherits ExecutableStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), continueKeyword As InternalSyntax.KeywordSyntax, blockKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ContinueStatementSyntax(kind, errors, annotations, continueKeyword, blockKeyword), Nothing, 0) End Sub ''' <summary> ''' The "Continue" keyword. ''' </summary> Public ReadOnly Property ContinueKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ContinueStatementSyntax)._continueKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ContinueKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithContinueKeyword(continueKeyword as SyntaxToken) As ContinueStatementSyntax return Update(Me.Kind, continueKeyword, Me.BlockKeyword) End Function ''' <summary> ''' The "Do", "For" or "While" keyword that identifies the kind of loop being ''' continued. ''' </summary> Public ReadOnly Property BlockKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ContinueStatementSyntax)._blockKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the BlockKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithBlockKeyword(blockKeyword as SyntaxToken) As ContinueStatementSyntax return Update(Me.Kind, Me.ContinueKeyword, blockKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitContinueStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitContinueStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="continueKeyword"> ''' The value for the ContinueKeyword property. ''' </param> ''' <param name="blockKeyword"> ''' The value for the BlockKeyword property. ''' </param> Public Function Update(kind As SyntaxKind, continueKeyword As SyntaxToken, blockKeyword As SyntaxToken) As ContinueStatementSyntax If kind <> Me.Kind OrElse continueKeyword <> Me.ContinueKeyword OrElse blockKeyword <> Me.BlockKeyword Then Dim newNode = SyntaxFactory.ContinueStatement(kind, continueKeyword, blockKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "Return" statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ReturnStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ReturnStatementSyntax Inherits ExecutableStatementSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), returnKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ReturnStatementSyntax(kind, errors, annotations, returnKeyword, if(expression IsNot Nothing, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Return" keyword. ''' </summary> Public ReadOnly Property ReturnKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ReturnStatementSyntax)._returnKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ReturnKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithReturnKeyword(returnKeyword as SyntaxToken) As ReturnStatementSyntax return Update(returnKeyword, Me.Expression) End Function ''' <summary> ''' The expression being returned, if present. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As ReturnStatementSyntax return Update(Me.ReturnKeyword, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitReturnStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitReturnStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="returnKeyword"> ''' The value for the ReturnKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(returnKeyword As SyntaxToken, expression As ExpressionSyntax) As ReturnStatementSyntax If returnKeyword <> Me.ReturnKeyword OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.ReturnStatement(returnKeyword, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a single-line "If ... Then ... Else ..." statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SingleLineIfStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SingleLineIfStatementSyntax Inherits ExecutableStatementSyntax Friend _condition as ExpressionSyntax Friend _statements as SyntaxNode Friend _elseClause as SingleLineElseClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), ifKeyword As InternalSyntax.KeywordSyntax, condition As ExpressionSyntax, thenKeyword As InternalSyntax.KeywordSyntax, statements As SyntaxNode, elseClause As SingleLineElseClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SingleLineIfStatementSyntax(kind, errors, annotations, ifKeyword, DirectCast(condition.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), thenKeyword, if(statements IsNot Nothing, statements.Green, Nothing), if(elseClause IsNot Nothing, DirectCast(elseClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SingleLineElseClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "If" keyword. ''' </summary> Public ReadOnly Property IfKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SingleLineIfStatementSyntax)._ifKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the IfKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIfKeyword(ifKeyword as SyntaxToken) As SingleLineIfStatementSyntax return Update(ifKeyword, Me.Condition, Me.ThenKeyword, Me.Statements, Me.ElseClause) End Function ''' <summary> ''' The condition expression to be evaluated. ''' </summary> Public ReadOnly Property Condition As ExpressionSyntax Get Return GetRed(_condition, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Condition property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCondition(condition as ExpressionSyntax) As SingleLineIfStatementSyntax return Update(Me.IfKeyword, condition, Me.ThenKeyword, Me.Statements, Me.ElseClause) End Function ''' <summary> ''' The "Then" keyword. ''' </summary> Public ReadOnly Property ThenKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SingleLineIfStatementSyntax)._thenKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the ThenKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithThenKeyword(thenKeyword as SyntaxToken) As SingleLineIfStatementSyntax return Update(Me.IfKeyword, Me.Condition, thenKeyword, Me.Statements, Me.ElseClause) End Function ''' <summary> ''' A list of statements to be executed if the condition expression evaluates as ''' true. Multiple statements must be separated by colons. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 3) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As SingleLineIfStatementSyntax return Update(Me.IfKeyword, Me.Condition, Me.ThenKeyword, statements, Me.ElseClause) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As SingleLineIfStatementSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function ''' <summary> ''' An "Else" clause to be executed if the condition expression evaluates as false. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ElseClause As SingleLineElseClauseSyntax Get Return GetRed(_elseClause, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the ElseClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElseClause(elseClause as SingleLineElseClauseSyntax) As SingleLineIfStatementSyntax return Update(Me.IfKeyword, Me.Condition, Me.ThenKeyword, Me.Statements, elseClause) End Function Public Shadows Function AddElseClauseStatements(ParamArray items As StatementSyntax()) As SingleLineIfStatementSyntax Dim _child = If(Me.ElseClause IsNot Nothing, Me.ElseClause, SyntaxFactory.SingleLineElseClause()) Return Me.WithElseClause(_child.AddStatements(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._condition Case 3 Return Me._statements Case 4 Return Me._elseClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Condition Case 3 Return GetRed(_statements, 3) Case 4 Return Me.ElseClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSingleLineIfStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSingleLineIfStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="ifKeyword"> ''' The value for the IfKeyword property. ''' </param> ''' <param name="condition"> ''' The value for the Condition property. ''' </param> ''' <param name="thenKeyword"> ''' The value for the ThenKeyword property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="elseClause"> ''' The value for the ElseClause property. ''' </param> Public Function Update(ifKeyword As SyntaxToken, condition As ExpressionSyntax, thenKeyword As SyntaxToken, statements As SyntaxList(of StatementSyntax), elseClause As SingleLineElseClauseSyntax) As SingleLineIfStatementSyntax If ifKeyword <> Me.IfKeyword OrElse condition IsNot Me.Condition OrElse thenKeyword <> Me.ThenKeyword OrElse statements <> Me.Statements OrElse elseClause IsNot Me.ElseClause Then Dim newNode = SyntaxFactory.SingleLineIfStatement(ifKeyword, condition, thenKeyword, statements, elseClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Else ..." clause of a single-line "If" statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SingleLineElseClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SingleLineElseClauseSyntax Inherits VisualBasicSyntaxNode Friend _statements as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), elseKeyword As InternalSyntax.KeywordSyntax, statements As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SingleLineElseClauseSyntax(kind, errors, annotations, elseKeyword, if(statements IsNot Nothing, statements.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Else" keyword. ''' </summary> Public ReadOnly Property ElseKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SingleLineElseClauseSyntax)._elseKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ElseKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElseKeyword(elseKeyword as SyntaxToken) As SingleLineElseClauseSyntax return Update(elseKeyword, Me.Statements) End Function ''' <summary> ''' A list of statements to be executed. Multiple statements must be separated by ''' colons. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As SingleLineElseClauseSyntax return Update(Me.ElseKeyword, statements) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As SingleLineElseClauseSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._statements Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_statements, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSingleLineElseClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSingleLineElseClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="elseKeyword"> ''' The value for the ElseKeyword property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> Public Function Update(elseKeyword As SyntaxToken, statements As SyntaxList(of StatementSyntax)) As SingleLineElseClauseSyntax If elseKeyword <> Me.ElseKeyword OrElse statements <> Me.Statements Then Dim newNode = SyntaxFactory.SingleLineElseClause(elseKeyword, statements) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a multi-line "If ... Then ... ElseIf ... Then ... Else ... End If" ''' block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.MultiLineIfBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class MultiLineIfBlockSyntax Inherits ExecutableStatementSyntax Friend _ifStatement as IfStatementSyntax Friend _statements as SyntaxNode Friend _elseIfBlocks as SyntaxNode Friend _elseBlock as ElseBlockSyntax Friend _endIfStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), ifStatement As IfStatementSyntax, statements As SyntaxNode, elseIfBlocks As SyntaxNode, elseBlock As ElseBlockSyntax, endIfStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MultiLineIfBlockSyntax(kind, errors, annotations, DirectCast(ifStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IfStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), if(elseIfBlocks IsNot Nothing, elseIfBlocks.Green, Nothing), if(elseBlock IsNot Nothing, DirectCast(elseBlock.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseBlockSyntax), Nothing), DirectCast(endIfStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "If" statement that begins the "If" block. ''' </summary> Public ReadOnly Property IfStatement As IfStatementSyntax Get Return GetRedAtZero(_ifStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the IfStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIfStatement(ifStatement as IfStatementSyntax) As MultiLineIfBlockSyntax return Update(ifStatement, Me.Statements, Me.ElseIfBlocks, Me.ElseBlock, Me.EndIfStatement) End Function ''' <summary> ''' A list of statements to be executed if the condition expression evaluates as ''' true. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As MultiLineIfBlockSyntax return Update(Me.IfStatement, statements, Me.ElseIfBlocks, Me.ElseBlock, Me.EndIfStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As MultiLineIfBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function ''' <summary> ''' A list of "ElseIf" blocks to be evaluated, in order, if the condition ''' expression of the "If" statement evaluates as false. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property ElseIfBlocks As SyntaxList(Of ElseIfBlockSyntax) Get Dim listNode = GetRed(_elseIfBlocks, 2) Return new SyntaxList(Of ElseIfBlockSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the ElseIfBlocks property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElseIfBlocks(elseIfBlocks as SyntaxList(Of ElseIfBlockSyntax)) As MultiLineIfBlockSyntax return Update(Me.IfStatement, Me.Statements, elseIfBlocks, Me.ElseBlock, Me.EndIfStatement) End Function Public Shadows Function AddElseIfBlocks(ParamArray items As ElseIfBlockSyntax()) As MultiLineIfBlockSyntax Return Me.WithElseIfBlocks(Me.ElseIfBlocks.AddRange(items)) End Function ''' <summary> ''' An "Else" block to be executed if the condition expression of the "If" ''' statement and all "ElseIf" blocks evaluate as false. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ElseBlock As ElseBlockSyntax Get Return GetRed(_elseBlock, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the ElseBlock property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElseBlock(elseBlock as ElseBlockSyntax) As MultiLineIfBlockSyntax return Update(Me.IfStatement, Me.Statements, Me.ElseIfBlocks, elseBlock, Me.EndIfStatement) End Function Public Shadows Function AddElseBlockStatements(ParamArray items As StatementSyntax()) As MultiLineIfBlockSyntax Dim _child = If(Me.ElseBlock IsNot Nothing, Me.ElseBlock, SyntaxFactory.ElseBlock()) Return Me.WithElseBlock(_child.AddStatements(items)) End Function ''' <summary> ''' Then "End If" statement. ''' </summary> Public ReadOnly Property EndIfStatement As EndBlockStatementSyntax Get Return GetRed(_endIfStatement, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the EndIfStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndIfStatement(endIfStatement as EndBlockStatementSyntax) As MultiLineIfBlockSyntax return Update(Me.IfStatement, Me.Statements, Me.ElseIfBlocks, Me.ElseBlock, endIfStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._ifStatement Case 1 Return Me._statements Case 2 Return Me._elseIfBlocks Case 3 Return Me._elseBlock Case 4 Return Me._endIfStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.IfStatement Case 1 Return GetRed(_statements, 1) Case 2 Return GetRed(_elseIfBlocks, 2) Case 3 Return Me.ElseBlock Case 4 Return Me.EndIfStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitMultiLineIfBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitMultiLineIfBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="ifStatement"> ''' The value for the IfStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="elseIfBlocks"> ''' The value for the ElseIfBlocks property. ''' </param> ''' <param name="elseBlock"> ''' The value for the ElseBlock property. ''' </param> ''' <param name="endIfStatement"> ''' The value for the EndIfStatement property. ''' </param> Public Function Update(ifStatement As IfStatementSyntax, statements As SyntaxList(of StatementSyntax), elseIfBlocks As SyntaxList(of ElseIfBlockSyntax), elseBlock As ElseBlockSyntax, endIfStatement As EndBlockStatementSyntax) As MultiLineIfBlockSyntax If ifStatement IsNot Me.IfStatement OrElse statements <> Me.Statements OrElse elseIfBlocks <> Me.ElseIfBlocks OrElse elseBlock IsNot Me.ElseBlock OrElse endIfStatement IsNot Me.EndIfStatement Then Dim newNode = SyntaxFactory.MultiLineIfBlock(ifStatement, statements, elseIfBlocks, elseBlock, endIfStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "If ... Then" statement that begins a multi-line "If" block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.IfStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class IfStatementSyntax Inherits StatementSyntax Friend _condition as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), ifKeyword As InternalSyntax.KeywordSyntax, condition As ExpressionSyntax, thenKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IfStatementSyntax(kind, errors, annotations, ifKeyword, DirectCast(condition.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), thenKeyword), Nothing, 0) End Sub ''' <summary> ''' The "If" keyword. ''' </summary> Public ReadOnly Property IfKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IfStatementSyntax)._ifKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the IfKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIfKeyword(ifKeyword as SyntaxToken) As IfStatementSyntax return Update(ifKeyword, Me.Condition, Me.ThenKeyword) End Function ''' <summary> ''' The condition expression to be evaluated. ''' </summary> Public ReadOnly Property Condition As ExpressionSyntax Get Return GetRed(_condition, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Condition property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCondition(condition as ExpressionSyntax) As IfStatementSyntax return Update(Me.IfKeyword, condition, Me.ThenKeyword) End Function ''' <summary> ''' The "Then" keyword. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ThenKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IfStatementSyntax)._thenKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(2), Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the ThenKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithThenKeyword(thenKeyword as SyntaxToken) As IfStatementSyntax return Update(Me.IfKeyword, Me.Condition, thenKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._condition Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Condition Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitIfStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitIfStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="ifKeyword"> ''' The value for the IfKeyword property. ''' </param> ''' <param name="condition"> ''' The value for the Condition property. ''' </param> ''' <param name="thenKeyword"> ''' The value for the ThenKeyword property. ''' </param> Public Function Update(ifKeyword As SyntaxToken, condition As ExpressionSyntax, thenKeyword As SyntaxToken) As IfStatementSyntax If ifKeyword <> Me.IfKeyword OrElse condition IsNot Me.Condition OrElse thenKeyword <> Me.ThenKeyword Then Dim newNode = SyntaxFactory.IfStatement(ifKeyword, condition, thenKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an "ElseIf ... Then ..." block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ElseIfBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ElseIfBlockSyntax Inherits VisualBasicSyntaxNode Friend _elseIfStatement as ElseIfStatementSyntax Friend _statements as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), elseIfStatement As ElseIfStatementSyntax, statements As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseIfBlockSyntax(kind, errors, annotations, DirectCast(elseIfStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseIfStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "ElseIf ... Then" statement the begins the "ElseIf" block. ''' </summary> Public ReadOnly Property ElseIfStatement As ElseIfStatementSyntax Get Return GetRedAtZero(_elseIfStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the ElseIfStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithElseIfStatement(elseIfStatement as ElseIfStatementSyntax) As ElseIfBlockSyntax return Update(elseIfStatement, Me.Statements) End Function ''' <summary> ''' A list of statements to be executed if the condition expression of the "ElseIf" ''' statement evaluates as true. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As ElseIfBlockSyntax return Update(Me.ElseIfStatement, statements) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As ElseIfBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._elseIfStatement Case 1 Return Me._statements Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.ElseIfStatement Case 1 Return GetRed(_statements, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitElseIfBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitElseIfBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="elseIfStatement"> ''' The value for the ElseIfStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> Public Function Update(elseIfStatement As ElseIfStatementSyntax, statements As SyntaxList(of StatementSyntax)) As ElseIfBlockSyntax If elseIfStatement IsNot Me.ElseIfStatement OrElse statements <> Me.Statements Then Dim newNode = SyntaxFactory.ElseIfBlock(elseIfStatement, statements) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "ElseIf ... Then" statement that begins an "ElseIf" block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ElseIfStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ElseIfStatementSyntax Inherits StatementSyntax Friend _condition as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), elseIfKeyword As InternalSyntax.KeywordSyntax, condition As ExpressionSyntax, thenKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseIfStatementSyntax(kind, errors, annotations, elseIfKeyword, DirectCast(condition.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), thenKeyword), Nothing, 0) End Sub ''' <summary> ''' The "ElseIf" keyword. ''' </summary> Public ReadOnly Property ElseIfKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseIfStatementSyntax)._elseIfKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ElseIfKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElseIfKeyword(elseIfKeyword as SyntaxToken) As ElseIfStatementSyntax return Update(elseIfKeyword, Me.Condition, Me.ThenKeyword) End Function ''' <summary> ''' The condition expression to be evaluated. ''' </summary> Public ReadOnly Property Condition As ExpressionSyntax Get Return GetRed(_condition, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Condition property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCondition(condition as ExpressionSyntax) As ElseIfStatementSyntax return Update(Me.ElseIfKeyword, condition, Me.ThenKeyword) End Function ''' <summary> ''' The "Then" keyword. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ThenKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseIfStatementSyntax)._thenKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(2), Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the ThenKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithThenKeyword(thenKeyword as SyntaxToken) As ElseIfStatementSyntax return Update(Me.ElseIfKeyword, Me.Condition, thenKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._condition Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Condition Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitElseIfStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitElseIfStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="elseIfKeyword"> ''' The value for the ElseIfKeyword property. ''' </param> ''' <param name="condition"> ''' The value for the Condition property. ''' </param> ''' <param name="thenKeyword"> ''' The value for the ThenKeyword property. ''' </param> Public Function Update(elseIfKeyword As SyntaxToken, condition As ExpressionSyntax, thenKeyword As SyntaxToken) As ElseIfStatementSyntax If elseIfKeyword <> Me.ElseIfKeyword OrElse condition IsNot Me.Condition OrElse thenKeyword <> Me.ThenKeyword Then Dim newNode = SyntaxFactory.ElseIfStatement(elseIfKeyword, condition, thenKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an "Else ..." block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ElseBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ElseBlockSyntax Inherits VisualBasicSyntaxNode Friend _elseStatement as ElseStatementSyntax Friend _statements as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), elseStatement As ElseStatementSyntax, statements As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseBlockSyntax(kind, errors, annotations, DirectCast(elseStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Else" statement that begins the "Else" block. ''' </summary> Public ReadOnly Property ElseStatement As ElseStatementSyntax Get Return GetRedAtZero(_elseStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the ElseStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElseStatement(elseStatement as ElseStatementSyntax) As ElseBlockSyntax return Update(elseStatement, Me.Statements) End Function ''' <summary> ''' A list of statements to be executed. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As ElseBlockSyntax return Update(Me.ElseStatement, statements) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As ElseBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._elseStatement Case 1 Return Me._statements Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.ElseStatement Case 1 Return GetRed(_statements, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitElseBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitElseBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="elseStatement"> ''' The value for the ElseStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> Public Function Update(elseStatement As ElseStatementSyntax, statements As SyntaxList(of StatementSyntax)) As ElseBlockSyntax If elseStatement IsNot Me.ElseStatement OrElse statements <> Me.Statements Then Dim newNode = SyntaxFactory.ElseBlock(elseStatement, statements) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Else" statement that begins an "Else" block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ElseStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ElseStatementSyntax Inherits StatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), elseKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseStatementSyntax(kind, errors, annotations, elseKeyword), Nothing, 0) End Sub ''' <summary> ''' The "Else" keyword. ''' </summary> Public ReadOnly Property ElseKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseStatementSyntax)._elseKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ElseKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElseKeyword(elseKeyword as SyntaxToken) As ElseStatementSyntax return Update(elseKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitElseStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitElseStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="elseKeyword"> ''' The value for the ElseKeyword property. ''' </param> Public Function Update(elseKeyword As SyntaxToken) As ElseStatementSyntax If elseKeyword <> Me.ElseKeyword Then Dim newNode = SyntaxFactory.ElseStatement(elseKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "Try ... Catch ... Finally ... End Try" block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TryBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TryBlockSyntax Inherits ExecutableStatementSyntax Friend _tryStatement as TryStatementSyntax Friend _statements as SyntaxNode Friend _catchBlocks as SyntaxNode Friend _finallyBlock as FinallyBlockSyntax Friend _endTryStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), tryStatement As TryStatementSyntax, statements As SyntaxNode, catchBlocks As SyntaxNode, finallyBlock As FinallyBlockSyntax, endTryStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TryBlockSyntax(kind, errors, annotations, DirectCast(tryStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TryStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), if(catchBlocks IsNot Nothing, catchBlocks.Green, Nothing), if(finallyBlock IsNot Nothing, DirectCast(finallyBlock.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FinallyBlockSyntax), Nothing), DirectCast(endTryStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Try" statement that begins the "Try" block. ''' </summary> Public ReadOnly Property TryStatement As TryStatementSyntax Get Return GetRedAtZero(_tryStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the TryStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithTryStatement(tryStatement as TryStatementSyntax) As TryBlockSyntax return Update(tryStatement, Me.Statements, Me.CatchBlocks, Me.FinallyBlock, Me.EndTryStatement) End Function ''' <summary> ''' A list of statements to be executed. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As TryBlockSyntax return Update(Me.TryStatement, statements, Me.CatchBlocks, Me.FinallyBlock, Me.EndTryStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As TryBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function ''' <summary> ''' A list of "Catch" blocks which may be executed if an exception is thrown while ''' executing the statements in the "Try" block. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property CatchBlocks As SyntaxList(Of CatchBlockSyntax) Get Dim listNode = GetRed(_catchBlocks, 2) Return new SyntaxList(Of CatchBlockSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the CatchBlocks property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCatchBlocks(catchBlocks as SyntaxList(Of CatchBlockSyntax)) As TryBlockSyntax return Update(Me.TryStatement, Me.Statements, catchBlocks, Me.FinallyBlock, Me.EndTryStatement) End Function Public Shadows Function AddCatchBlocks(ParamArray items As CatchBlockSyntax()) As TryBlockSyntax Return Me.WithCatchBlocks(Me.CatchBlocks.AddRange(items)) End Function ''' <summary> ''' A "Finally" block to be executed before execution leaves the "Try" block. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property FinallyBlock As FinallyBlockSyntax Get Return GetRed(_finallyBlock, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the FinallyBlock property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithFinallyBlock(finallyBlock as FinallyBlockSyntax) As TryBlockSyntax return Update(Me.TryStatement, Me.Statements, Me.CatchBlocks, finallyBlock, Me.EndTryStatement) End Function Public Shadows Function AddFinallyBlockStatements(ParamArray items As StatementSyntax()) As TryBlockSyntax Dim _child = If(Me.FinallyBlock IsNot Nothing, Me.FinallyBlock, SyntaxFactory.FinallyBlock()) Return Me.WithFinallyBlock(_child.AddStatements(items)) End Function ''' <summary> ''' The "End Try" statement. ''' </summary> Public ReadOnly Property EndTryStatement As EndBlockStatementSyntax Get Return GetRed(_endTryStatement, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the EndTryStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndTryStatement(endTryStatement as EndBlockStatementSyntax) As TryBlockSyntax return Update(Me.TryStatement, Me.Statements, Me.CatchBlocks, Me.FinallyBlock, endTryStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._tryStatement Case 1 Return Me._statements Case 2 Return Me._catchBlocks Case 3 Return Me._finallyBlock Case 4 Return Me._endTryStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.TryStatement Case 1 Return GetRed(_statements, 1) Case 2 Return GetRed(_catchBlocks, 2) Case 3 Return Me.FinallyBlock Case 4 Return Me.EndTryStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTryBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTryBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="tryStatement"> ''' The value for the TryStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="catchBlocks"> ''' The value for the CatchBlocks property. ''' </param> ''' <param name="finallyBlock"> ''' The value for the FinallyBlock property. ''' </param> ''' <param name="endTryStatement"> ''' The value for the EndTryStatement property. ''' </param> Public Function Update(tryStatement As TryStatementSyntax, statements As SyntaxList(of StatementSyntax), catchBlocks As SyntaxList(of CatchBlockSyntax), finallyBlock As FinallyBlockSyntax, endTryStatement As EndBlockStatementSyntax) As TryBlockSyntax If tryStatement IsNot Me.TryStatement OrElse statements <> Me.Statements OrElse catchBlocks <> Me.CatchBlocks OrElse finallyBlock IsNot Me.FinallyBlock OrElse endTryStatement IsNot Me.EndTryStatement Then Dim newNode = SyntaxFactory.TryBlock(tryStatement, statements, catchBlocks, finallyBlock, endTryStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Try" statement that begins a "Try" block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TryStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TryStatementSyntax Inherits StatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), tryKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TryStatementSyntax(kind, errors, annotations, tryKeyword), Nothing, 0) End Sub ''' <summary> ''' The "Try" keyword. ''' </summary> Public ReadOnly Property TryKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TryStatementSyntax)._tryKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the TryKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithTryKeyword(tryKeyword as SyntaxToken) As TryStatementSyntax return Update(tryKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTryStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTryStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="tryKeyword"> ''' The value for the TryKeyword property. ''' </param> Public Function Update(tryKeyword As SyntaxToken) As TryStatementSyntax If tryKeyword <> Me.TryKeyword Then Dim newNode = SyntaxFactory.TryStatement(tryKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "Catch ..." block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CatchBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CatchBlockSyntax Inherits VisualBasicSyntaxNode Friend _catchStatement as CatchStatementSyntax Friend _statements as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), catchStatement As CatchStatementSyntax, statements As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CatchBlockSyntax(kind, errors, annotations, DirectCast(catchStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CatchStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Catch" statement that begins the "Catch" block. ''' </summary> Public ReadOnly Property CatchStatement As CatchStatementSyntax Get Return GetRedAtZero(_catchStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the CatchStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCatchStatement(catchStatement as CatchStatementSyntax) As CatchBlockSyntax return Update(catchStatement, Me.Statements) End Function ''' <summary> ''' A list of statements to be executed if an exception is caught by the "Catch" ''' block. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As CatchBlockSyntax return Update(Me.CatchStatement, statements) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As CatchBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._catchStatement Case 1 Return Me._statements Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.CatchStatement Case 1 Return GetRed(_statements, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCatchBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCatchBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="catchStatement"> ''' The value for the CatchStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> Public Function Update(catchStatement As CatchStatementSyntax, statements As SyntaxList(of StatementSyntax)) As CatchBlockSyntax If catchStatement IsNot Me.CatchStatement OrElse statements <> Me.Statements Then Dim newNode = SyntaxFactory.CatchBlock(catchStatement, statements) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Catch ... When ..." statement that begins a "Catch" block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CatchStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CatchStatementSyntax Inherits StatementSyntax Friend _identifierName as IdentifierNameSyntax Friend _asClause as SimpleAsClauseSyntax Friend _whenClause as CatchFilterClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), catchKeyword As InternalSyntax.KeywordSyntax, identifierName As IdentifierNameSyntax, asClause As SimpleAsClauseSyntax, whenClause As CatchFilterClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CatchStatementSyntax(kind, errors, annotations, catchKeyword, if(identifierName IsNot Nothing, DirectCast(identifierName.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IdentifierNameSyntax), Nothing), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing), if(whenClause IsNot Nothing, DirectCast(whenClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CatchFilterClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Catch" keyword. ''' </summary> Public ReadOnly Property CatchKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CatchStatementSyntax)._catchKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the CatchKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCatchKeyword(catchKeyword as SyntaxToken) As CatchStatementSyntax return Update(catchKeyword, Me.IdentifierName, Me.AsClause, Me.WhenClause) End Function ''' <summary> ''' An identifier declaring a new variable or naming an existing variable to store ''' the exception caught by the "Catch" statement. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property IdentifierName As IdentifierNameSyntax Get Return GetRed(_identifierName, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the IdentifierName property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithIdentifierName(identifierName as IdentifierNameSyntax) As CatchStatementSyntax return Update(Me.CatchKeyword, identifierName, Me.AsClause, Me.WhenClause) End Function ''' <summary> ''' A simple "As" clause specifying the type of exception to catch. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As CatchStatementSyntax return Update(Me.CatchKeyword, Me.IdentifierName, asClause, Me.WhenClause) End Function ''' <summary> ''' A "When" clause to filter exceptions before catching. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property WhenClause As CatchFilterClauseSyntax Get Return GetRed(_whenClause, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the WhenClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithWhenClause(whenClause as CatchFilterClauseSyntax) As CatchStatementSyntax return Update(Me.CatchKeyword, Me.IdentifierName, Me.AsClause, whenClause) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._identifierName Case 2 Return Me._asClause Case 3 Return Me._whenClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.IdentifierName Case 2 Return Me.AsClause Case 3 Return Me.WhenClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCatchStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCatchStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="catchKeyword"> ''' The value for the CatchKeyword property. ''' </param> ''' <param name="identifierName"> ''' The value for the IdentifierName property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> ''' <param name="whenClause"> ''' The value for the WhenClause property. ''' </param> Public Function Update(catchKeyword As SyntaxToken, identifierName As IdentifierNameSyntax, asClause As SimpleAsClauseSyntax, whenClause As CatchFilterClauseSyntax) As CatchStatementSyntax If catchKeyword <> Me.CatchKeyword OrElse identifierName IsNot Me.IdentifierName OrElse asClause IsNot Me.AsClause OrElse whenClause IsNot Me.WhenClause Then Dim newNode = SyntaxFactory.CatchStatement(catchKeyword, identifierName, asClause, whenClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "When ..." clause of a "Catch" statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CatchFilterClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CatchFilterClauseSyntax Inherits VisualBasicSyntaxNode Friend _filter as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), whenKeyword As InternalSyntax.KeywordSyntax, filter As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CatchFilterClauseSyntax(kind, errors, annotations, whenKeyword, DirectCast(filter.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "When" keyword. ''' </summary> Public ReadOnly Property WhenKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CatchFilterClauseSyntax)._whenKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the WhenKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithWhenKeyword(whenKeyword as SyntaxToken) As CatchFilterClauseSyntax return Update(whenKeyword, Me.Filter) End Function ''' <summary> ''' The filter expression to be evaluated. ''' </summary> Public ReadOnly Property Filter As ExpressionSyntax Get Return GetRed(_filter, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Filter property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithFilter(filter as ExpressionSyntax) As CatchFilterClauseSyntax return Update(Me.WhenKeyword, filter) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._filter Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Filter Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCatchFilterClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCatchFilterClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="whenKeyword"> ''' The value for the WhenKeyword property. ''' </param> ''' <param name="filter"> ''' The value for the Filter property. ''' </param> Public Function Update(whenKeyword As SyntaxToken, filter As ExpressionSyntax) As CatchFilterClauseSyntax If whenKeyword <> Me.WhenKeyword OrElse filter IsNot Me.Filter Then Dim newNode = SyntaxFactory.CatchFilterClause(whenKeyword, filter) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "Finally ..." block of a "Try" block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.FinallyBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class FinallyBlockSyntax Inherits VisualBasicSyntaxNode Friend _finallyStatement as FinallyStatementSyntax Friend _statements as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), finallyStatement As FinallyStatementSyntax, statements As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FinallyBlockSyntax(kind, errors, annotations, DirectCast(finallyStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FinallyStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Finally" statement that begins the "Finally" block. ''' </summary> Public ReadOnly Property FinallyStatement As FinallyStatementSyntax Get Return GetRedAtZero(_finallyStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the FinallyStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithFinallyStatement(finallyStatement as FinallyStatementSyntax) As FinallyBlockSyntax return Update(finallyStatement, Me.Statements) End Function ''' <summary> ''' A list of statements to be executed. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As FinallyBlockSyntax return Update(Me.FinallyStatement, statements) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As FinallyBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._finallyStatement Case 1 Return Me._statements Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.FinallyStatement Case 1 Return GetRed(_statements, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitFinallyBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitFinallyBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="finallyStatement"> ''' The value for the FinallyStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> Public Function Update(finallyStatement As FinallyStatementSyntax, statements As SyntaxList(of StatementSyntax)) As FinallyBlockSyntax If finallyStatement IsNot Me.FinallyStatement OrElse statements <> Me.Statements Then Dim newNode = SyntaxFactory.FinallyBlock(finallyStatement, statements) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Finally" statement that begins a "Finally" block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.FinallyStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class FinallyStatementSyntax Inherits StatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), finallyKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FinallyStatementSyntax(kind, errors, annotations, finallyKeyword), Nothing, 0) End Sub ''' <summary> ''' The "Finally" keyword. ''' </summary> Public ReadOnly Property FinallyKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FinallyStatementSyntax)._finallyKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the FinallyKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithFinallyKeyword(finallyKeyword as SyntaxToken) As FinallyStatementSyntax return Update(finallyKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitFinallyStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitFinallyStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="finallyKeyword"> ''' The value for the FinallyKeyword property. ''' </param> Public Function Update(finallyKeyword As SyntaxToken) As FinallyStatementSyntax If finallyKeyword <> Me.FinallyKeyword Then Dim newNode = SyntaxFactory.FinallyStatement(finallyKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Error" statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ErrorStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ErrorStatementSyntax Inherits ExecutableStatementSyntax Friend _errorNumber as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), errorKeyword As InternalSyntax.KeywordSyntax, errorNumber As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ErrorStatementSyntax(kind, errors, annotations, errorKeyword, DirectCast(errorNumber.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Error" keyword. ''' </summary> Public ReadOnly Property ErrorKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ErrorStatementSyntax)._errorKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ErrorKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithErrorKeyword(errorKeyword as SyntaxToken) As ErrorStatementSyntax return Update(errorKeyword, Me.ErrorNumber) End Function ''' <summary> ''' The expression that represents the error number. ''' </summary> Public ReadOnly Property ErrorNumber As ExpressionSyntax Get Return GetRed(_errorNumber, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the ErrorNumber property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithErrorNumber(errorNumber as ExpressionSyntax) As ErrorStatementSyntax return Update(Me.ErrorKeyword, errorNumber) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._errorNumber Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.ErrorNumber Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitErrorStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitErrorStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="errorKeyword"> ''' The value for the ErrorKeyword property. ''' </param> ''' <param name="errorNumber"> ''' The value for the ErrorNumber property. ''' </param> Public Function Update(errorKeyword As SyntaxToken, errorNumber As ExpressionSyntax) As ErrorStatementSyntax If errorKeyword <> Me.ErrorKeyword OrElse errorNumber IsNot Me.ErrorNumber Then Dim newNode = SyntaxFactory.ErrorStatement(errorKeyword, errorNumber) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an OnError Goto statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.OnErrorGoToZeroStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.OnErrorGoToMinusOneStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.OnErrorGoToLabelStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class OnErrorGoToStatementSyntax Inherits ExecutableStatementSyntax Friend _label as LabelSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), onKeyword As InternalSyntax.KeywordSyntax, errorKeyword As InternalSyntax.KeywordSyntax, goToKeyword As InternalSyntax.KeywordSyntax, minus As InternalSyntax.PunctuationSyntax, label As LabelSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OnErrorGoToStatementSyntax(kind, errors, annotations, onKeyword, errorKeyword, goToKeyword, minus, DirectCast(label.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LabelSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "On" keyword ''' </summary> Public ReadOnly Property OnKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OnErrorGoToStatementSyntax)._onKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OnKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOnKeyword(onKeyword as SyntaxToken) As OnErrorGoToStatementSyntax return Update(Me.Kind, onKeyword, Me.ErrorKeyword, Me.GoToKeyword, Me.Minus, Me.Label) End Function ''' <summary> ''' The "Error" keyword. ''' </summary> Public ReadOnly Property ErrorKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OnErrorGoToStatementSyntax)._errorKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ErrorKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithErrorKeyword(errorKeyword as SyntaxToken) As OnErrorGoToStatementSyntax return Update(Me.Kind, Me.OnKeyword, errorKeyword, Me.GoToKeyword, Me.Minus, Me.Label) End Function ''' <summary> ''' The "GoTo" keyword ''' </summary> Public ReadOnly Property GoToKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OnErrorGoToStatementSyntax)._goToKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the GoToKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithGoToKeyword(goToKeyword as SyntaxToken) As OnErrorGoToStatementSyntax return Update(Me.Kind, Me.OnKeyword, Me.ErrorKeyword, goToKeyword, Me.Minus, Me.Label) End Function ''' <summary> ''' An optional minus for On Error Goto -1 ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Minus As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OnErrorGoToStatementSyntax)._minus If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(3), Me.GetChildIndex(3)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Minus property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithMinus(minus as SyntaxToken) As OnErrorGoToStatementSyntax return Update(Me.Kind, Me.OnKeyword, Me.ErrorKeyword, Me.GoToKeyword, minus, Me.Label) End Function ''' <summary> ''' The name of the label. If the label is a line number, 0 or -1, wraps an ''' IntegerLiteralToken that is the line number, otherwise, wraps an Identifier. ''' </summary> Public ReadOnly Property Label As LabelSyntax Get Return GetRed(_label, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the Label property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithLabel(label as LabelSyntax) As OnErrorGoToStatementSyntax return Update(Me.Kind, Me.OnKeyword, Me.ErrorKeyword, Me.GoToKeyword, Me.Minus, label) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 4 Return Me._label Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 4 Return Me.Label Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitOnErrorGoToStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitOnErrorGoToStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="onKeyword"> ''' The value for the OnKeyword property. ''' </param> ''' <param name="errorKeyword"> ''' The value for the ErrorKeyword property. ''' </param> ''' <param name="goToKeyword"> ''' The value for the GoToKeyword property. ''' </param> ''' <param name="minus"> ''' The value for the Minus property. ''' </param> ''' <param name="label"> ''' The value for the Label property. ''' </param> Public Function Update(kind As SyntaxKind, onKeyword As SyntaxToken, errorKeyword As SyntaxToken, goToKeyword As SyntaxToken, minus As SyntaxToken, label As LabelSyntax) As OnErrorGoToStatementSyntax If kind <> Me.Kind OrElse onKeyword <> Me.OnKeyword OrElse errorKeyword <> Me.ErrorKeyword OrElse goToKeyword <> Me.GoToKeyword OrElse minus <> Me.Minus OrElse label IsNot Me.Label Then Dim newNode = SyntaxFactory.OnErrorGoToStatement(kind, onKeyword, errorKeyword, goToKeyword, minus, label) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an OnError Resume Next statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.OnErrorResumeNextStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class OnErrorResumeNextStatementSyntax Inherits ExecutableStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), onKeyword As InternalSyntax.KeywordSyntax, errorKeyword As InternalSyntax.KeywordSyntax, resumeKeyword As InternalSyntax.KeywordSyntax, nextKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OnErrorResumeNextStatementSyntax(kind, errors, annotations, onKeyword, errorKeyword, resumeKeyword, nextKeyword), Nothing, 0) End Sub ''' <summary> ''' The "On" keyword ''' </summary> Public ReadOnly Property OnKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OnErrorResumeNextStatementSyntax)._onKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OnKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOnKeyword(onKeyword as SyntaxToken) As OnErrorResumeNextStatementSyntax return Update(onKeyword, Me.ErrorKeyword, Me.ResumeKeyword, Me.NextKeyword) End Function ''' <summary> ''' The "Error" keyword. ''' </summary> Public ReadOnly Property ErrorKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OnErrorResumeNextStatementSyntax)._errorKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ErrorKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithErrorKeyword(errorKeyword as SyntaxToken) As OnErrorResumeNextStatementSyntax return Update(Me.OnKeyword, errorKeyword, Me.ResumeKeyword, Me.NextKeyword) End Function ''' <summary> ''' The "Resume" keyword. ''' </summary> Public ReadOnly Property ResumeKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OnErrorResumeNextStatementSyntax)._resumeKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the ResumeKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithResumeKeyword(resumeKeyword as SyntaxToken) As OnErrorResumeNextStatementSyntax return Update(Me.OnKeyword, Me.ErrorKeyword, resumeKeyword, Me.NextKeyword) End Function ''' <summary> ''' The "Next" ''' </summary> Public ReadOnly Property NextKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OnErrorResumeNextStatementSyntax)._nextKeyword, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the NextKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNextKeyword(nextKeyword as SyntaxToken) As OnErrorResumeNextStatementSyntax return Update(Me.OnKeyword, Me.ErrorKeyword, Me.ResumeKeyword, nextKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitOnErrorResumeNextStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitOnErrorResumeNextStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="onKeyword"> ''' The value for the OnKeyword property. ''' </param> ''' <param name="errorKeyword"> ''' The value for the ErrorKeyword property. ''' </param> ''' <param name="resumeKeyword"> ''' The value for the ResumeKeyword property. ''' </param> ''' <param name="nextKeyword"> ''' The value for the NextKeyword property. ''' </param> Public Function Update(onKeyword As SyntaxToken, errorKeyword As SyntaxToken, resumeKeyword As SyntaxToken, nextKeyword As SyntaxToken) As OnErrorResumeNextStatementSyntax If onKeyword <> Me.OnKeyword OrElse errorKeyword <> Me.ErrorKeyword OrElse resumeKeyword <> Me.ResumeKeyword OrElse nextKeyword <> Me.NextKeyword Then Dim newNode = SyntaxFactory.OnErrorResumeNextStatement(onKeyword, errorKeyword, resumeKeyword, nextKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "Resume" statement. The Kind property can be used to determine if ''' this is a "Resume", "Resume Next" or "Resume label" statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ResumeStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ResumeLabelStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ResumeNextStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ResumeStatementSyntax Inherits ExecutableStatementSyntax Friend _label as LabelSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), resumeKeyword As InternalSyntax.KeywordSyntax, label As LabelSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ResumeStatementSyntax(kind, errors, annotations, resumeKeyword, if(label IsNot Nothing, DirectCast(label.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LabelSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Resume" keyword. ''' </summary> Public ReadOnly Property ResumeKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ResumeStatementSyntax)._resumeKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ResumeKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithResumeKeyword(resumeKeyword as SyntaxToken) As ResumeStatementSyntax return Update(Me.Kind, resumeKeyword, Me.Label) End Function ''' <summary> ''' The label. The value of this depends on the Kind. If Kind=Resume, returns ''' Nothing. If Kind=ResumeNext, wraps the keyword "Next", If Kind=ResumeLabel, ''' wraps an Identifier or IntegerLiteralToken with the label or line number. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Label As LabelSyntax Get Return GetRed(_label, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Label property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithLabel(label as LabelSyntax) As ResumeStatementSyntax return Update(Me.Kind, Me.ResumeKeyword, label) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._label Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Label Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitResumeStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitResumeStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="resumeKeyword"> ''' The value for the ResumeKeyword property. ''' </param> ''' <param name="label"> ''' The value for the Label property. ''' </param> Public Function Update(kind As SyntaxKind, resumeKeyword As SyntaxToken, label As LabelSyntax) As ResumeStatementSyntax If kind <> Me.Kind OrElse resumeKeyword <> Me.ResumeKeyword OrElse label IsNot Me.Label Then Dim newNode = SyntaxFactory.ResumeStatement(kind, resumeKeyword, label) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a Select Case block, including the Select Case that begins it, the ''' contains Case blocks and the End Select. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SelectBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SelectBlockSyntax Inherits ExecutableStatementSyntax Friend _selectStatement as SelectStatementSyntax Friend _caseBlocks as SyntaxNode Friend _endSelectStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), selectStatement As SelectStatementSyntax, caseBlocks As SyntaxNode, endSelectStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SelectBlockSyntax(kind, errors, annotations, DirectCast(selectStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SelectStatementSyntax), if(caseBlocks IsNot Nothing, caseBlocks.Green, Nothing), DirectCast(endSelectStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The Select Case statement that begins the block. ''' </summary> Public ReadOnly Property SelectStatement As SelectStatementSyntax Get Return GetRedAtZero(_selectStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the SelectStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSelectStatement(selectStatement as SelectStatementSyntax) As SelectBlockSyntax return Update(selectStatement, Me.CaseBlocks, Me.EndSelectStatement) End Function ''' <summary> ''' A list of the contained Case blocks. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property CaseBlocks As SyntaxList(Of CaseBlockSyntax) Get Dim listNode = GetRed(_caseBlocks, 1) Return new SyntaxList(Of CaseBlockSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the CaseBlocks property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCaseBlocks(caseBlocks as SyntaxList(Of CaseBlockSyntax)) As SelectBlockSyntax return Update(Me.SelectStatement, caseBlocks, Me.EndSelectStatement) End Function Public Shadows Function AddCaseBlocks(ParamArray items As CaseBlockSyntax()) As SelectBlockSyntax Return Me.WithCaseBlocks(Me.CaseBlocks.AddRange(items)) End Function ''' <summary> ''' The End Select statement that ends the block. ''' </summary> Public ReadOnly Property EndSelectStatement As EndBlockStatementSyntax Get Return GetRed(_endSelectStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndSelectStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEndSelectStatement(endSelectStatement as EndBlockStatementSyntax) As SelectBlockSyntax return Update(Me.SelectStatement, Me.CaseBlocks, endSelectStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._selectStatement Case 1 Return Me._caseBlocks Case 2 Return Me._endSelectStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.SelectStatement Case 1 Return GetRed(_caseBlocks, 1) Case 2 Return Me.EndSelectStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSelectBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSelectBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="selectStatement"> ''' The value for the SelectStatement property. ''' </param> ''' <param name="caseBlocks"> ''' The value for the CaseBlocks property. ''' </param> ''' <param name="endSelectStatement"> ''' The value for the EndSelectStatement property. ''' </param> Public Function Update(selectStatement As SelectStatementSyntax, caseBlocks As SyntaxList(of CaseBlockSyntax), endSelectStatement As EndBlockStatementSyntax) As SelectBlockSyntax If selectStatement IsNot Me.SelectStatement OrElse caseBlocks <> Me.CaseBlocks OrElse endSelectStatement IsNot Me.EndSelectStatement Then Dim newNode = SyntaxFactory.SelectBlock(selectStatement, caseBlocks, endSelectStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a Select Case statement. This statement always occurs as the Begin ''' of a SelectBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SelectStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SelectStatementSyntax Inherits StatementSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), selectKeyword As InternalSyntax.KeywordSyntax, caseKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SelectStatementSyntax(kind, errors, annotations, selectKeyword, caseKeyword, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Select" keyword. ''' </summary> Public ReadOnly Property SelectKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SelectStatementSyntax)._selectKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the SelectKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithSelectKeyword(selectKeyword as SyntaxToken) As SelectStatementSyntax return Update(selectKeyword, Me.CaseKeyword, Me.Expression) End Function ''' <summary> ''' The "Case" keyword, if present. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property CaseKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SelectStatementSyntax)._caseKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the CaseKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCaseKeyword(caseKeyword as SyntaxToken) As SelectStatementSyntax return Update(Me.SelectKeyword, caseKeyword, Me.Expression) End Function ''' <summary> ''' The value that branching is based on. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As SelectStatementSyntax return Update(Me.SelectKeyword, Me.CaseKeyword, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSelectStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSelectStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="selectKeyword"> ''' The value for the SelectKeyword property. ''' </param> ''' <param name="caseKeyword"> ''' The value for the CaseKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(selectKeyword As SyntaxToken, caseKeyword As SyntaxToken, expression As ExpressionSyntax) As SelectStatementSyntax If selectKeyword <> Me.SelectKeyword OrElse caseKeyword <> Me.CaseKeyword OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.SelectStatement(selectKeyword, caseKeyword, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a case statement and its subsequent block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CaseBlock"/></description></item> ''' <item><description><see cref="SyntaxKind.CaseElseBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CaseBlockSyntax Inherits VisualBasicSyntaxNode Friend _caseStatement as CaseStatementSyntax Friend _statements as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), caseStatement As CaseStatementSyntax, statements As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CaseBlockSyntax(kind, errors, annotations, DirectCast(caseStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CaseStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The statement that begins the case block. ''' </summary> Public ReadOnly Property CaseStatement As CaseStatementSyntax Get Return GetRedAtZero(_caseStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the CaseStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCaseStatement(caseStatement as CaseStatementSyntax) As CaseBlockSyntax return Update(Me.Kind, caseStatement, Me.Statements) End Function Public Shadows Function AddCaseStatementCases(ParamArray items As CaseClauseSyntax()) As CaseBlockSyntax Dim _child = If(Me.CaseStatement IsNot Nothing, Me.CaseStatement, SyntaxFactory.CaseStatement()) Return Me.WithCaseStatement(_child.AddCases(items)) End Function ''' <summary> ''' The statements contained in the case block. This might be an empty list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As CaseBlockSyntax return Update(Me.Kind, Me.CaseStatement, statements) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As CaseBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._caseStatement Case 1 Return Me._statements Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.CaseStatement Case 1 Return GetRed(_statements, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCaseBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCaseBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="caseStatement"> ''' The value for the CaseStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> Public Function Update(kind As SyntaxKind, caseStatement As CaseStatementSyntax, statements As SyntaxList(of StatementSyntax)) As CaseBlockSyntax If kind <> Me.Kind OrElse caseStatement IsNot Me.CaseStatement OrElse statements <> Me.Statements Then Dim newNode = SyntaxFactory.CaseBlock(kind, caseStatement, statements) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a Case or Case Else statement. This statement is always the Begin of ''' a CaseBlock. If this is a Case Else statement, the Kind=CaseElse, otherwise the ''' Kind=Case. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CaseStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.CaseElseStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CaseStatementSyntax Inherits StatementSyntax Friend _cases as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), caseKeyword As InternalSyntax.KeywordSyntax, cases As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CaseStatementSyntax(kind, errors, annotations, caseKeyword, if(cases IsNot Nothing, cases.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Case" keyword ''' </summary> Public ReadOnly Property CaseKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CaseStatementSyntax)._caseKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the CaseKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCaseKeyword(caseKeyword as SyntaxToken) As CaseStatementSyntax return Update(Me.Kind, caseKeyword, Me.Cases) End Function ''' <summary> ''' A list of clauses associated with this Case. If Kind=CaseElse, then this list ''' has exactly one child, which is a ElseCaseClause. ''' </summary> Public ReadOnly Property Cases As SeparatedSyntaxList(Of CaseClauseSyntax) Get Dim listNode = GetRed(_cases, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of CaseClauseSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Cases property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithCases(cases as SeparatedSyntaxList(Of CaseClauseSyntax)) As CaseStatementSyntax return Update(Me.Kind, Me.CaseKeyword, cases) End Function Public Shadows Function AddCases(ParamArray items As CaseClauseSyntax()) As CaseStatementSyntax Return Me.WithCases(Me.Cases.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._cases Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_cases, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCaseStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCaseStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="caseKeyword"> ''' The value for the CaseKeyword property. ''' </param> ''' <param name="cases"> ''' The value for the Cases property. ''' </param> Public Function Update(kind As SyntaxKind, caseKeyword As SyntaxToken, cases As SeparatedSyntaxList(Of CaseClauseSyntax)) As CaseStatementSyntax If kind <> Me.Kind OrElse caseKeyword <> Me.CaseKeyword OrElse cases <> Me.Cases Then Dim newNode = SyntaxFactory.CaseStatement(kind, caseKeyword, cases) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a single clause in a case statement. An abstract node that is the ''' parent of different kinds of Case clauses. ''' </summary> Public MustInherit Class CaseClauseSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' The "Else" part in a Case Else statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ElseCaseClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ElseCaseClauseSyntax Inherits CaseClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), elseKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseCaseClauseSyntax(kind, errors, annotations, elseKeyword), Nothing, 0) End Sub ''' <summary> ''' The "Else" keyword. ''' </summary> Public ReadOnly Property ElseKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseCaseClauseSyntax)._elseKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ElseKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElseKeyword(elseKeyword as SyntaxToken) As ElseCaseClauseSyntax return Update(elseKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitElseCaseClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitElseCaseClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="elseKeyword"> ''' The value for the ElseKeyword property. ''' </param> Public Function Update(elseKeyword As SyntaxToken) As ElseCaseClauseSyntax If elseKeyword <> Me.ElseKeyword Then Dim newNode = SyntaxFactory.ElseCaseClause(elseKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a single value in a Case. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SimpleCaseClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SimpleCaseClauseSyntax Inherits CaseClauseSyntax Friend _value as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), value As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleCaseClauseSyntax(kind, errors, annotations, DirectCast(value.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The expression that denotes the value being tested against. ''' </summary> Public ReadOnly Property Value As ExpressionSyntax Get Return GetRedAtZero(_value) End Get End Property ''' <summary> ''' Returns a copy of this with the Value property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithValue(value as ExpressionSyntax) As SimpleCaseClauseSyntax return Update(value) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Me._value Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode If i = 0 Then Return Me.Value Else Return Nothing End If End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSimpleCaseClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSimpleCaseClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="value"> ''' The value for the Value property. ''' </param> Public Function Update(value As ExpressionSyntax) As SimpleCaseClauseSyntax If value IsNot Me.Value Then Dim newNode = SyntaxFactory.SimpleCaseClause(value) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a range "expression To expression" in a Case. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.RangeCaseClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class RangeCaseClauseSyntax Inherits CaseClauseSyntax Friend _lowerBound as ExpressionSyntax Friend _upperBound as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lowerBound As ExpressionSyntax, toKeyword As InternalSyntax.KeywordSyntax, upperBound As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RangeCaseClauseSyntax(kind, errors, annotations, DirectCast(lowerBound.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), toKeyword, DirectCast(upperBound.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The lower bound of the range. ''' </summary> Public ReadOnly Property LowerBound As ExpressionSyntax Get Return GetRedAtZero(_lowerBound) End Get End Property ''' <summary> ''' Returns a copy of this with the LowerBound property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLowerBound(lowerBound as ExpressionSyntax) As RangeCaseClauseSyntax return Update(lowerBound, Me.ToKeyword, Me.UpperBound) End Function ''' <summary> ''' The "To" keyword ''' </summary> Public ReadOnly Property ToKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RangeCaseClauseSyntax)._toKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ToKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithToKeyword(toKeyword as SyntaxToken) As RangeCaseClauseSyntax return Update(Me.LowerBound, toKeyword, Me.UpperBound) End Function ''' <summary> ''' The upper bound of the range. ''' </summary> Public ReadOnly Property UpperBound As ExpressionSyntax Get Return GetRed(_upperBound, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the UpperBound property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithUpperBound(upperBound as ExpressionSyntax) As RangeCaseClauseSyntax return Update(Me.LowerBound, Me.ToKeyword, upperBound) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._lowerBound Case 2 Return Me._upperBound Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.LowerBound Case 2 Return Me.UpperBound Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitRangeCaseClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitRangeCaseClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lowerBound"> ''' The value for the LowerBound property. ''' </param> ''' <param name="toKeyword"> ''' The value for the ToKeyword property. ''' </param> ''' <param name="upperBound"> ''' The value for the UpperBound property. ''' </param> Public Function Update(lowerBound As ExpressionSyntax, toKeyword As SyntaxToken, upperBound As ExpressionSyntax) As RangeCaseClauseSyntax If lowerBound IsNot Me.LowerBound OrElse toKeyword <> Me.ToKeyword OrElse upperBound IsNot Me.UpperBound Then Dim newNode = SyntaxFactory.RangeCaseClause(lowerBound, toKeyword, upperBound) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a relation clause in a Case statement, such as "Is > expression". ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CaseEqualsClause"/></description></item> ''' <item><description><see cref="SyntaxKind.CaseNotEqualsClause"/></description></item> ''' <item><description><see cref="SyntaxKind.CaseLessThanClause"/></description></item> ''' <item><description><see cref="SyntaxKind.CaseLessThanOrEqualClause"/></description></item> ''' <item><description><see cref="SyntaxKind.CaseGreaterThanOrEqualClause"/></description></item> ''' <item><description><see cref="SyntaxKind.CaseGreaterThanClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class RelationalCaseClauseSyntax Inherits CaseClauseSyntax Friend _value as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), isKeyword As InternalSyntax.KeywordSyntax, operatorToken As InternalSyntax.PunctuationSyntax, value As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RelationalCaseClauseSyntax(kind, errors, annotations, isKeyword, operatorToken, DirectCast(value.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Is" keyword, if present. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property IsKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RelationalCaseClauseSyntax)._isKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.Position, 0) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the IsKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIsKeyword(isKeyword as SyntaxToken) As RelationalCaseClauseSyntax return Update(Me.Kind, isKeyword, Me.OperatorToken, Me.Value) End Function ''' <summary> ''' The operator in the relational clause. One of "=", "<", ">", "<=" or ''' ">=". ''' </summary> Public ReadOnly Property OperatorToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RelationalCaseClauseSyntax)._operatorToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OperatorToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOperatorToken(operatorToken as SyntaxToken) As RelationalCaseClauseSyntax return Update(Me.Kind, Me.IsKeyword, operatorToken, Me.Value) End Function ''' <summary> ''' The expression that denotes the value being tested against. ''' </summary> Public ReadOnly Property Value As ExpressionSyntax Get Return GetRed(_value, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Value property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithValue(value as ExpressionSyntax) As RelationalCaseClauseSyntax return Update(Me.Kind, Me.IsKeyword, Me.OperatorToken, value) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._value Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Value Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitRelationalCaseClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitRelationalCaseClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="isKeyword"> ''' The value for the IsKeyword property. ''' </param> ''' <param name="operatorToken"> ''' The value for the OperatorToken property. ''' </param> ''' <param name="value"> ''' The value for the Value property. ''' </param> Public Function Update(kind As SyntaxKind, isKeyword As SyntaxToken, operatorToken As SyntaxToken, value As ExpressionSyntax) As RelationalCaseClauseSyntax If kind <> Me.Kind OrElse isKeyword <> Me.IsKeyword OrElse operatorToken <> Me.OperatorToken OrElse value IsNot Me.Value Then Dim newNode = SyntaxFactory.RelationalCaseClause(kind, isKeyword, operatorToken, value) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "SyncLock" statement. This statement always occurs as the Begin ''' of a SyncLockBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SyncLockStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SyncLockStatementSyntax Inherits StatementSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), syncLockKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SyncLockStatementSyntax(kind, errors, annotations, syncLockKeyword, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "SyncLock" keyword. ''' </summary> Public ReadOnly Property SyncLockKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SyncLockStatementSyntax)._syncLockKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the SyncLockKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSyncLockKeyword(syncLockKeyword as SyntaxToken) As SyncLockStatementSyntax return Update(syncLockKeyword, Me.Expression) End Function ''' <summary> ''' The expression being synchronized on. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As SyncLockStatementSyntax return Update(Me.SyncLockKeyword, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSyncLockStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSyncLockStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="syncLockKeyword"> ''' The value for the SyncLockKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(syncLockKeyword As SyntaxToken, expression As ExpressionSyntax) As SyncLockStatementSyntax If syncLockKeyword <> Me.SyncLockKeyword OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.SyncLockStatement(syncLockKeyword, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a Do-Loop block. The Kind property can be used to determine if this ''' is a Do While, Do Until, Do Loop While, Do Loop Until, or infinite Do Loop. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SimpleDoLoopBlock"/></description></item> ''' <item><description><see cref="SyntaxKind.DoWhileLoopBlock"/></description></item> ''' <item><description><see cref="SyntaxKind.DoUntilLoopBlock"/></description></item> ''' <item><description><see cref="SyntaxKind.DoLoopWhileBlock"/></description></item> ''' <item><description><see cref="SyntaxKind.DoLoopUntilBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class DoLoopBlockSyntax Inherits ExecutableStatementSyntax Friend _doStatement as DoStatementSyntax Friend _statements as SyntaxNode Friend _loopStatement as LoopStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), doStatement As DoStatementSyntax, statements As SyntaxNode, loopStatement As LoopStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DoLoopBlockSyntax(kind, errors, annotations, DirectCast(doStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DoStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), DirectCast(loopStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LoopStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The Do statement that begins the block. ''' </summary> Public ReadOnly Property DoStatement As DoStatementSyntax Get Return GetRedAtZero(_doStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the DoStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithDoStatement(doStatement as DoStatementSyntax) As DoLoopBlockSyntax return Update(Me.Kind, doStatement, Me.Statements, Me.LoopStatement) End Function ''' <summary> ''' The statements contained in the block statement. This might be an empty list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As DoLoopBlockSyntax return Update(Me.Kind, Me.DoStatement, statements, Me.LoopStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As DoLoopBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function ''' <summary> ''' The Loop statement that ends the block. ''' </summary> Public ReadOnly Property LoopStatement As LoopStatementSyntax Get Return GetRed(_loopStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the LoopStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLoopStatement(loopStatement as LoopStatementSyntax) As DoLoopBlockSyntax return Update(Me.Kind, Me.DoStatement, Me.Statements, loopStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._doStatement Case 1 Return Me._statements Case 2 Return Me._loopStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.DoStatement Case 1 Return GetRed(_statements, 1) Case 2 Return Me.LoopStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitDoLoopBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitDoLoopBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="doStatement"> ''' The value for the DoStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="loopStatement"> ''' The value for the LoopStatement property. ''' </param> Public Function Update(kind As SyntaxKind, doStatement As DoStatementSyntax, statements As SyntaxList(of StatementSyntax), loopStatement As LoopStatementSyntax) As DoLoopBlockSyntax If kind <> Me.Kind OrElse doStatement IsNot Me.DoStatement OrElse statements <> Me.Statements OrElse loopStatement IsNot Me.LoopStatement Then Dim newNode = SyntaxFactory.DoLoopBlock(kind, doStatement, statements, loopStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' The Do statement that begins a Do-Loop block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SimpleDoStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.DoWhileStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.DoUntilStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class DoStatementSyntax Inherits StatementSyntax Friend _whileOrUntilClause as WhileOrUntilClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), doKeyword As InternalSyntax.KeywordSyntax, whileOrUntilClause As WhileOrUntilClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DoStatementSyntax(kind, errors, annotations, doKeyword, if(whileOrUntilClause IsNot Nothing, DirectCast(whileOrUntilClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WhileOrUntilClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Do" keyword. ''' </summary> Public ReadOnly Property DoKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DoStatementSyntax)._doKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the DoKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithDoKeyword(doKeyword as SyntaxToken) As DoStatementSyntax return Update(Me.Kind, doKeyword, Me.WhileOrUntilClause) End Function ''' <summary> ''' The "While expression" or "Until expression" clause of the Do statement, if ''' present. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property WhileOrUntilClause As WhileOrUntilClauseSyntax Get Return GetRed(_whileOrUntilClause, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the WhileOrUntilClause property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithWhileOrUntilClause(whileOrUntilClause as WhileOrUntilClauseSyntax) As DoStatementSyntax return Update(Me.Kind, Me.DoKeyword, whileOrUntilClause) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._whileOrUntilClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.WhileOrUntilClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitDoStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitDoStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="doKeyword"> ''' The value for the DoKeyword property. ''' </param> ''' <param name="whileOrUntilClause"> ''' The value for the WhileOrUntilClause property. ''' </param> Public Function Update(kind As SyntaxKind, doKeyword As SyntaxToken, whileOrUntilClause As WhileOrUntilClauseSyntax) As DoStatementSyntax If kind <> Me.Kind OrElse doKeyword <> Me.DoKeyword OrElse whileOrUntilClause IsNot Me.WhileOrUntilClause Then Dim newNode = SyntaxFactory.DoStatement(kind, doKeyword, whileOrUntilClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' The Loop statement that begins a Do-Loop block. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SimpleLoopStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.LoopWhileStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.LoopUntilStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class LoopStatementSyntax Inherits StatementSyntax Friend _whileOrUntilClause as WhileOrUntilClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), loopKeyword As InternalSyntax.KeywordSyntax, whileOrUntilClause As WhileOrUntilClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LoopStatementSyntax(kind, errors, annotations, loopKeyword, if(whileOrUntilClause IsNot Nothing, DirectCast(whileOrUntilClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WhileOrUntilClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Loop" keyword. ''' </summary> Public ReadOnly Property LoopKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LoopStatementSyntax)._loopKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LoopKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLoopKeyword(loopKeyword as SyntaxToken) As LoopStatementSyntax return Update(Me.Kind, loopKeyword, Me.WhileOrUntilClause) End Function ''' <summary> ''' The "While expression" or "Until expression" clause of the Loop statement, if ''' present. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property WhileOrUntilClause As WhileOrUntilClauseSyntax Get Return GetRed(_whileOrUntilClause, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the WhileOrUntilClause property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithWhileOrUntilClause(whileOrUntilClause as WhileOrUntilClauseSyntax) As LoopStatementSyntax return Update(Me.Kind, Me.LoopKeyword, whileOrUntilClause) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._whileOrUntilClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.WhileOrUntilClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitLoopStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitLoopStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="loopKeyword"> ''' The value for the LoopKeyword property. ''' </param> ''' <param name="whileOrUntilClause"> ''' The value for the WhileOrUntilClause property. ''' </param> Public Function Update(kind As SyntaxKind, loopKeyword As SyntaxToken, whileOrUntilClause As WhileOrUntilClauseSyntax) As LoopStatementSyntax If kind <> Me.Kind OrElse loopKeyword <> Me.LoopKeyword OrElse whileOrUntilClause IsNot Me.WhileOrUntilClause Then Dim newNode = SyntaxFactory.LoopStatement(kind, loopKeyword, whileOrUntilClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "While expression" or "Until expression" in a Do or Loop ''' statement. The Kind of the clause can be "WhileClause" or "UntilClause" to ''' indicate which kind of clause. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.WhileClause"/></description></item> ''' <item><description><see cref="SyntaxKind.UntilClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class WhileOrUntilClauseSyntax Inherits VisualBasicSyntaxNode Friend _condition as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), whileOrUntilKeyword As InternalSyntax.KeywordSyntax, condition As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WhileOrUntilClauseSyntax(kind, errors, annotations, whileOrUntilKeyword, DirectCast(condition.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "While" or "Until" keyword. ''' </summary> Public ReadOnly Property WhileOrUntilKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WhileOrUntilClauseSyntax)._whileOrUntilKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the WhileOrUntilKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithWhileOrUntilKeyword(whileOrUntilKeyword as SyntaxToken) As WhileOrUntilClauseSyntax return Update(Me.Kind, whileOrUntilKeyword, Me.Condition) End Function ''' <summary> ''' The boolean expression after the While or Until. ''' </summary> Public ReadOnly Property Condition As ExpressionSyntax Get Return GetRed(_condition, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Condition property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCondition(condition as ExpressionSyntax) As WhileOrUntilClauseSyntax return Update(Me.Kind, Me.WhileOrUntilKeyword, condition) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._condition Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Condition Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitWhileOrUntilClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitWhileOrUntilClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="whileOrUntilKeyword"> ''' The value for the WhileOrUntilKeyword property. ''' </param> ''' <param name="condition"> ''' The value for the Condition property. ''' </param> Public Function Update(kind As SyntaxKind, whileOrUntilKeyword As SyntaxToken, condition As ExpressionSyntax) As WhileOrUntilClauseSyntax If kind <> Me.Kind OrElse whileOrUntilKeyword <> Me.WhileOrUntilKeyword OrElse condition IsNot Me.Condition Then Dim newNode = SyntaxFactory.WhileOrUntilClause(kind, whileOrUntilKeyword, condition) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' The While statement that begins a While...End While block. This statement ''' always occurs as the Begin of a WhileBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.WhileStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class WhileStatementSyntax Inherits StatementSyntax Friend _condition as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), whileKeyword As InternalSyntax.KeywordSyntax, condition As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WhileStatementSyntax(kind, errors, annotations, whileKeyword, DirectCast(condition.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "While" keyword. ''' </summary> Public ReadOnly Property WhileKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WhileStatementSyntax)._whileKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the WhileKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithWhileKeyword(whileKeyword as SyntaxToken) As WhileStatementSyntax return Update(whileKeyword, Me.Condition) End Function ''' <summary> ''' The boolean expression that controls the While loop. ''' </summary> Public ReadOnly Property Condition As ExpressionSyntax Get Return GetRed(_condition, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Condition property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCondition(condition as ExpressionSyntax) As WhileStatementSyntax return Update(Me.WhileKeyword, condition) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._condition Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Condition Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitWhileStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitWhileStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="whileKeyword"> ''' The value for the WhileKeyword property. ''' </param> ''' <param name="condition"> ''' The value for the Condition property. ''' </param> Public Function Update(whileKeyword As SyntaxToken, condition As ExpressionSyntax) As WhileStatementSyntax If whileKeyword <> Me.WhileKeyword OrElse condition IsNot Me.Condition Then Dim newNode = SyntaxFactory.WhileStatement(whileKeyword, condition) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a For or For Each block. ''' </summary> Public MustInherit Class ForOrForEachBlockSyntax Inherits ExecutableStatementSyntax Friend _statements as SyntaxNode Friend _nextStatement as NextStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The statements contained in the For or For Each loop. This might be an empty ''' list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Return Me.GetStatementsCore() End Get End Property Friend Overridable Function GetStatementsCore() As SyntaxList(Of StatementSyntax) Dim listNode = GetRedAtZero(_statements) Return new SyntaxList(Of StatementSyntax)(listNode) End Function ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithStatements(statements As SyntaxList(Of StatementSyntax)) As ForOrForEachBlockSyntax Return WithStatementsCore(statements) End Function Friend MustOverride Function WithStatementsCore(statements As SyntaxList(Of StatementSyntax)) As ForOrForEachBlockSyntax Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As ForOrForEachBlockSyntax Return AddStatementsCore(items) End Function Friend MustOverride Function AddStatementsCore(ParamArray items As StatementSyntax()) As ForOrForEachBlockSyntax ''' <summary> ''' The Next statement that ends the block. If two For or For Each statements are ''' ended by a single Next statement, the inner For will not have a Next statement. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property NextStatement As NextStatementSyntax Get Return Me.GetNextStatementCore() End Get End Property Friend Overridable Function GetNextStatementCore() As NextStatementSyntax Return GetRed(_nextStatement, 1) End Function ''' <summary> ''' Returns a copy of this with the NextStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithNextStatement(nextStatement As NextStatementSyntax) As ForOrForEachBlockSyntax Return WithNextStatementCore(nextStatement) End Function Friend MustOverride Function WithNextStatementCore(nextStatement As NextStatementSyntax) As ForOrForEachBlockSyntax Public Shadows Function AddNextStatementControlVariables(ParamArray items As ExpressionSyntax()) As ForOrForEachBlockSyntax Return AddNextStatementControlVariablesCore(items) End Function Friend MustOverride Function AddNextStatementControlVariablesCore(ParamArray items As ExpressionSyntax()) As ForOrForEachBlockSyntax End Class ''' <summary> ''' Represents a For block, including the introducing statement, the body and the ''' "Next" (which can be omitted if a containing For has a Next with multiple ''' variables). ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ForBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ForBlockSyntax Inherits ForOrForEachBlockSyntax Friend _forStatement as ForStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), forStatement As ForStatementSyntax, statements As SyntaxNode, nextStatement As NextStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForBlockSyntax(kind, errors, annotations, DirectCast(forStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), if(nextStatement IsNot Nothing, DirectCast(nextStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NextStatementSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The For statement that begins the block. ''' </summary> Public ReadOnly Property ForStatement As ForStatementSyntax Get Return GetRedAtZero(_forStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the ForStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithForStatement(forStatement as ForStatementSyntax) As ForBlockSyntax return Update(forStatement, Me.Statements, Me.NextStatement) End Function ''' <summary> ''' The statements contained in the For or For Each loop. This might be an empty ''' list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property Friend Overrides Function GetStatementsCore() As SyntaxList(Of StatementSyntax) Return Me.Statements End Function Friend Overrides Function WithStatementsCore(statements As SyntaxList(Of StatementSyntax)) As ForOrForEachBlockSyntax Return WithStatements(statements) End Function ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As ForBlockSyntax return Update(Me.ForStatement, statements, Me.NextStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As ForBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function AddStatementsCore(ParamArray items As StatementSyntax()) As ForOrForEachBlockSyntax Return AddStatements(items) End Function ''' <summary> ''' The Next statement that ends the block. If two For or For Each statements are ''' ended by a single Next statement, the inner For will not have a Next statement. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property NextStatement As NextStatementSyntax Get Return GetRed(_nextStatement, 2) End Get End Property Friend Overrides Function GetNextStatementCore() As NextStatementSyntax Return Me.NextStatement End Function Friend Overrides Function WithNextStatementCore(nextStatement As NextStatementSyntax) As ForOrForEachBlockSyntax Return WithNextStatement(nextStatement) End Function ''' <summary> ''' Returns a copy of this with the NextStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNextStatement(nextStatement as NextStatementSyntax) As ForBlockSyntax return Update(Me.ForStatement, Me.Statements, nextStatement) End Function Public Shadows Function AddNextStatementControlVariables(ParamArray items As ExpressionSyntax()) As ForBlockSyntax Dim _child = If(Me.NextStatement IsNot Nothing, Me.NextStatement, SyntaxFactory.NextStatement()) Return Me.WithNextStatement(_child.AddControlVariables(items)) End Function Friend Overrides Function AddNextStatementControlVariablesCore(ParamArray items As ExpressionSyntax()) As ForOrForEachBlockSyntax Return AddNextStatementControlVariables(items) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._forStatement Case 1 Return Me._statements Case 2 Return Me._nextStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.ForStatement Case 1 Return GetRed(_statements, 1) Case 2 Return Me.NextStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitForBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitForBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="forStatement"> ''' The value for the ForStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="nextStatement"> ''' The value for the NextStatement property. ''' </param> Public Function Update(forStatement As ForStatementSyntax, statements As SyntaxList(of StatementSyntax), nextStatement As NextStatementSyntax) As ForBlockSyntax If forStatement IsNot Me.ForStatement OrElse statements <> Me.Statements OrElse nextStatement IsNot Me.NextStatement Then Dim newNode = SyntaxFactory.ForBlock(forStatement, statements, nextStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a For Each block, including the introducing statement, the body and ''' the "Next" (which can be omitted if a containing For has a Next with multiple ''' variables). ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ForEachBlock"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ForEachBlockSyntax Inherits ForOrForEachBlockSyntax Friend _forEachStatement as ForEachStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), forEachStatement As ForEachStatementSyntax, statements As SyntaxNode, nextStatement As NextStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForEachBlockSyntax(kind, errors, annotations, DirectCast(forEachStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForEachStatementSyntax), if(statements IsNot Nothing, statements.Green, Nothing), if(nextStatement IsNot Nothing, DirectCast(nextStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NextStatementSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The For Each statement that begins the block. ''' </summary> Public ReadOnly Property ForEachStatement As ForEachStatementSyntax Get Return GetRedAtZero(_forEachStatement) End Get End Property ''' <summary> ''' Returns a copy of this with the ForEachStatement property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithForEachStatement(forEachStatement as ForEachStatementSyntax) As ForEachBlockSyntax return Update(forEachStatement, Me.Statements, Me.NextStatement) End Function ''' <summary> ''' The statements contained in the For or For Each loop. This might be an empty ''' list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property Friend Overrides Function GetStatementsCore() As SyntaxList(Of StatementSyntax) Return Me.Statements End Function Friend Overrides Function WithStatementsCore(statements As SyntaxList(Of StatementSyntax)) As ForOrForEachBlockSyntax Return WithStatements(statements) End Function ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As ForEachBlockSyntax return Update(Me.ForEachStatement, statements, Me.NextStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As ForEachBlockSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function Friend Overrides Function AddStatementsCore(ParamArray items As StatementSyntax()) As ForOrForEachBlockSyntax Return AddStatements(items) End Function ''' <summary> ''' The Next statement that ends the block. If two For or For Each statements are ''' ended by a single Next statement, the inner For will not have a Next statement. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property NextStatement As NextStatementSyntax Get Return GetRed(_nextStatement, 2) End Get End Property Friend Overrides Function GetNextStatementCore() As NextStatementSyntax Return Me.NextStatement End Function Friend Overrides Function WithNextStatementCore(nextStatement As NextStatementSyntax) As ForOrForEachBlockSyntax Return WithNextStatement(nextStatement) End Function ''' <summary> ''' Returns a copy of this with the NextStatement property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNextStatement(nextStatement as NextStatementSyntax) As ForEachBlockSyntax return Update(Me.ForEachStatement, Me.Statements, nextStatement) End Function Public Shadows Function AddNextStatementControlVariables(ParamArray items As ExpressionSyntax()) As ForEachBlockSyntax Dim _child = If(Me.NextStatement IsNot Nothing, Me.NextStatement, SyntaxFactory.NextStatement()) Return Me.WithNextStatement(_child.AddControlVariables(items)) End Function Friend Overrides Function AddNextStatementControlVariablesCore(ParamArray items As ExpressionSyntax()) As ForOrForEachBlockSyntax Return AddNextStatementControlVariables(items) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._forEachStatement Case 1 Return Me._statements Case 2 Return Me._nextStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.ForEachStatement Case 1 Return GetRed(_statements, 1) Case 2 Return Me.NextStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitForEachBlock(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitForEachBlock(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="forEachStatement"> ''' The value for the ForEachStatement property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="nextStatement"> ''' The value for the NextStatement property. ''' </param> Public Function Update(forEachStatement As ForEachStatementSyntax, statements As SyntaxList(of StatementSyntax), nextStatement As NextStatementSyntax) As ForEachBlockSyntax If forEachStatement IsNot Me.ForEachStatement OrElse statements <> Me.Statements OrElse nextStatement IsNot Me.NextStatement Then Dim newNode = SyntaxFactory.ForEachBlock(forEachStatement, statements, nextStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a For or For Each statement. ''' </summary> Public MustInherit Class ForOrForEachStatementSyntax Inherits StatementSyntax Friend _controlVariable as VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The "For" keyword. ''' </summary> Public ReadOnly Property ForKeyword As SyntaxToken Get Return Me.GetForKeywordCore() End Get End Property Friend Overridable Function GetForKeywordCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForOrForEachStatementSyntax)._forKeyword, Me.Position, 0) End Function ''' <summary> ''' Returns a copy of this with the ForKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithForKeyword(forKeyword As SyntaxToken) As ForOrForEachStatementSyntax Return WithForKeywordCore(forKeyword) End Function Friend MustOverride Function WithForKeywordCore(forKeyword As SyntaxToken) As ForOrForEachStatementSyntax ''' <summary> ''' If the For or For Each statement is of a form that does not declare a new loop ''' control variable, this is the expression that denotes the loop control ''' variable. If this loop is of a form that does declare a new control variable, ''' this is a VariableDeclarator that has the variable being declared. ''' </summary> Public ReadOnly Property ControlVariable As VisualBasicSyntaxNode Get Return Me.GetControlVariableCore() End Get End Property Friend Overridable Function GetControlVariableCore() As VisualBasicSyntaxNode Return GetRed(_controlVariable, 1) End Function ''' <summary> ''' Returns a copy of this with the ControlVariable property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Function WithControlVariable(controlVariable As VisualBasicSyntaxNode) As ForOrForEachStatementSyntax Return WithControlVariableCore(controlVariable) End Function Friend MustOverride Function WithControlVariableCore(controlVariable As VisualBasicSyntaxNode) As ForOrForEachStatementSyntax End Class ''' <summary> ''' The For statement that begins a For-Next block. This statement always occurs as ''' the Begin of a ForBlock. Most of the time, the End of that ForBlock is the ''' corresponding Next statement. However, multiple nested For statements are ended ''' by a single Next statement with multiple variables, then the inner For ''' statements will have End set to Nothing, and the Next statement is the End of ''' the outermost For statement that is being ended. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ForStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ForStatementSyntax Inherits ForOrForEachStatementSyntax Friend _fromValue as ExpressionSyntax Friend _toValue as ExpressionSyntax Friend _stepClause as ForStepClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), forKeyword As InternalSyntax.KeywordSyntax, controlVariable As VisualBasicSyntaxNode, equalsToken As InternalSyntax.PunctuationSyntax, fromValue As ExpressionSyntax, toKeyword As InternalSyntax.KeywordSyntax, toValue As ExpressionSyntax, stepClause As ForStepClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForStatementSyntax(kind, errors, annotations, forKeyword, DirectCast(controlVariable.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.VisualBasicSyntaxNode), equalsToken, DirectCast(fromValue.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), toKeyword, DirectCast(toValue.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), if(stepClause IsNot Nothing, DirectCast(stepClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForStepClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "For" keyword. ''' </summary> Public Shadows ReadOnly Property ForKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForStatementSyntax)._forKeyword, Me.Position, 0) End Get End Property Friend Overrides Function GetForKeywordCore() As SyntaxToken Return Me.ForKeyword End Function Friend Overrides Function WithForKeywordCore(forKeyword As SyntaxToken) As ForOrForEachStatementSyntax Return WithForKeyword(forKeyword) End Function ''' <summary> ''' Returns a copy of this with the ForKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithForKeyword(forKeyword as SyntaxToken) As ForStatementSyntax return Update(forKeyword, Me.ControlVariable, Me.EqualsToken, Me.FromValue, Me.ToKeyword, Me.ToValue, Me.StepClause) End Function ''' <summary> ''' If the For or For Each statement is of a form that does not declare a new loop ''' control variable, this is the expression that denotes the loop control ''' variable. If this loop is of a form that does declare a new control variable, ''' this is a VariableDeclarator that has the variable being declared. ''' </summary> Public Shadows ReadOnly Property ControlVariable As VisualBasicSyntaxNode Get Return GetRed(_controlVariable, 1) End Get End Property Friend Overrides Function GetControlVariableCore() As VisualBasicSyntaxNode Return Me.ControlVariable End Function Friend Overrides Function WithControlVariableCore(controlVariable As VisualBasicSyntaxNode) As ForOrForEachStatementSyntax Return WithControlVariable(controlVariable) End Function ''' <summary> ''' Returns a copy of this with the ControlVariable property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithControlVariable(controlVariable as VisualBasicSyntaxNode) As ForStatementSyntax return Update(Me.ForKeyword, controlVariable, Me.EqualsToken, Me.FromValue, Me.ToKeyword, Me.ToValue, Me.StepClause) End Function ''' <summary> ''' The "=" token. ''' </summary> Public ReadOnly Property EqualsToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForStatementSyntax)._equalsToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the EqualsToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEqualsToken(equalsToken as SyntaxToken) As ForStatementSyntax return Update(Me.ForKeyword, Me.ControlVariable, equalsToken, Me.FromValue, Me.ToKeyword, Me.ToValue, Me.StepClause) End Function ''' <summary> ''' The expression denoting the initial value of the iteration. ''' </summary> Public ReadOnly Property FromValue As ExpressionSyntax Get Return GetRed(_fromValue, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the FromValue property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithFromValue(fromValue as ExpressionSyntax) As ForStatementSyntax return Update(Me.ForKeyword, Me.ControlVariable, Me.EqualsToken, fromValue, Me.ToKeyword, Me.ToValue, Me.StepClause) End Function ''' <summary> ''' The "To" keyword. ''' </summary> Public ReadOnly Property ToKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForStatementSyntax)._toKeyword, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property ''' <summary> ''' Returns a copy of this with the ToKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithToKeyword(toKeyword as SyntaxToken) As ForStatementSyntax return Update(Me.ForKeyword, Me.ControlVariable, Me.EqualsToken, Me.FromValue, toKeyword, Me.ToValue, Me.StepClause) End Function ''' <summary> ''' The expression denoting the final value of the iteration. ''' </summary> Public ReadOnly Property ToValue As ExpressionSyntax Get Return GetRed(_toValue, 5) End Get End Property ''' <summary> ''' Returns a copy of this with the ToValue property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithToValue(toValue as ExpressionSyntax) As ForStatementSyntax return Update(Me.ForKeyword, Me.ControlVariable, Me.EqualsToken, Me.FromValue, Me.ToKeyword, toValue, Me.StepClause) End Function ''' <summary> ''' The optional Step clause. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property StepClause As ForStepClauseSyntax Get Return GetRed(_stepClause, 6) End Get End Property ''' <summary> ''' Returns a copy of this with the StepClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStepClause(stepClause as ForStepClauseSyntax) As ForStatementSyntax return Update(Me.ForKeyword, Me.ControlVariable, Me.EqualsToken, Me.FromValue, Me.ToKeyword, Me.ToValue, stepClause) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._controlVariable Case 3 Return Me._fromValue Case 5 Return Me._toValue Case 6 Return Me._stepClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.ControlVariable Case 3 Return Me.FromValue Case 5 Return Me.ToValue Case 6 Return Me.StepClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitForStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitForStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="forKeyword"> ''' The value for the ForKeyword property. ''' </param> ''' <param name="controlVariable"> ''' The value for the ControlVariable property. ''' </param> ''' <param name="equalsToken"> ''' The value for the EqualsToken property. ''' </param> ''' <param name="fromValue"> ''' The value for the FromValue property. ''' </param> ''' <param name="toKeyword"> ''' The value for the ToKeyword property. ''' </param> ''' <param name="toValue"> ''' The value for the ToValue property. ''' </param> ''' <param name="stepClause"> ''' The value for the StepClause property. ''' </param> Public Function Update(forKeyword As SyntaxToken, controlVariable As VisualBasicSyntaxNode, equalsToken As SyntaxToken, fromValue As ExpressionSyntax, toKeyword As SyntaxToken, toValue As ExpressionSyntax, stepClause As ForStepClauseSyntax) As ForStatementSyntax If forKeyword <> Me.ForKeyword OrElse controlVariable IsNot Me.ControlVariable OrElse equalsToken <> Me.EqualsToken OrElse fromValue IsNot Me.FromValue OrElse toKeyword <> Me.ToKeyword OrElse toValue IsNot Me.ToValue OrElse stepClause IsNot Me.StepClause Then Dim newNode = SyntaxFactory.ForStatement(forKeyword, controlVariable, equalsToken, fromValue, toKeyword, toValue, stepClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' The Step clause in a For Statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ForStepClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ForStepClauseSyntax Inherits VisualBasicSyntaxNode Friend _stepValue as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), stepKeyword As InternalSyntax.KeywordSyntax, stepValue As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForStepClauseSyntax(kind, errors, annotations, stepKeyword, DirectCast(stepValue.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Step" keyword. ''' </summary> Public ReadOnly Property StepKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForStepClauseSyntax)._stepKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the StepKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStepKeyword(stepKeyword as SyntaxToken) As ForStepClauseSyntax return Update(stepKeyword, Me.StepValue) End Function ''' <summary> ''' The expression denoting the step increment. ''' </summary> Public ReadOnly Property StepValue As ExpressionSyntax Get Return GetRed(_stepValue, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the StepValue property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStepValue(stepValue as ExpressionSyntax) As ForStepClauseSyntax return Update(Me.StepKeyword, stepValue) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._stepValue Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.StepValue Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitForStepClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitForStepClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="stepKeyword"> ''' The value for the StepKeyword property. ''' </param> ''' <param name="stepValue"> ''' The value for the StepValue property. ''' </param> Public Function Update(stepKeyword As SyntaxToken, stepValue As ExpressionSyntax) As ForStepClauseSyntax If stepKeyword <> Me.StepKeyword OrElse stepValue IsNot Me.StepValue Then Dim newNode = SyntaxFactory.ForStepClause(stepKeyword, stepValue) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' The For Each statement that begins a For Each-Next block. This statement always ''' occurs as the Begin of a ForBlock, and the body of the For Each-Next is the ''' Body of that ForBlock. Most of the time, the End of that ForBlock is the ''' corresponding Next statement. However, multiple nested For statements are ended ''' by a single Next statement with multiple variables, then the inner For ''' statements will have End set to Nothing, and the Next statement is the End of ''' the outermost For statement that is being ended. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ForEachStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ForEachStatementSyntax Inherits ForOrForEachStatementSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), forKeyword As InternalSyntax.KeywordSyntax, eachKeyword As InternalSyntax.KeywordSyntax, controlVariable As VisualBasicSyntaxNode, inKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForEachStatementSyntax(kind, errors, annotations, forKeyword, eachKeyword, DirectCast(controlVariable.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.VisualBasicSyntaxNode), inKeyword, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "For" keyword. ''' </summary> Public Shadows ReadOnly Property ForKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForEachStatementSyntax)._forKeyword, Me.Position, 0) End Get End Property Friend Overrides Function GetForKeywordCore() As SyntaxToken Return Me.ForKeyword End Function Friend Overrides Function WithForKeywordCore(forKeyword As SyntaxToken) As ForOrForEachStatementSyntax Return WithForKeyword(forKeyword) End Function ''' <summary> ''' Returns a copy of this with the ForKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithForKeyword(forKeyword as SyntaxToken) As ForEachStatementSyntax return Update(forKeyword, Me.EachKeyword, Me.ControlVariable, Me.InKeyword, Me.Expression) End Function ''' <summary> ''' The "Each" keyword. ''' </summary> Public ReadOnly Property EachKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForEachStatementSyntax)._eachKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the EachKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEachKeyword(eachKeyword as SyntaxToken) As ForEachStatementSyntax return Update(Me.ForKeyword, eachKeyword, Me.ControlVariable, Me.InKeyword, Me.Expression) End Function ''' <summary> ''' If the For or For Each statement is of a form that does not declare a new loop ''' control variable, this is the expression that denotes the loop control ''' variable. If this loop is of a form that does declare a new control variable, ''' this is a VariableDeclarator that has the variable being declared. ''' </summary> Public Shadows ReadOnly Property ControlVariable As VisualBasicSyntaxNode Get Return GetRed(_controlVariable, 2) End Get End Property Friend Overrides Function GetControlVariableCore() As VisualBasicSyntaxNode Return Me.ControlVariable End Function Friend Overrides Function WithControlVariableCore(controlVariable As VisualBasicSyntaxNode) As ForOrForEachStatementSyntax Return WithControlVariable(controlVariable) End Function ''' <summary> ''' Returns a copy of this with the ControlVariable property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithControlVariable(controlVariable as VisualBasicSyntaxNode) As ForEachStatementSyntax return Update(Me.ForKeyword, Me.EachKeyword, controlVariable, Me.InKeyword, Me.Expression) End Function ''' <summary> ''' The "In" keyword. ''' </summary> Public ReadOnly Property InKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ForEachStatementSyntax)._inKeyword, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the InKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInKeyword(inKeyword as SyntaxToken) As ForEachStatementSyntax return Update(Me.ForKeyword, Me.EachKeyword, Me.ControlVariable, inKeyword, Me.Expression) End Function ''' <summary> ''' The expression denoting the collection to iterate over. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As ForEachStatementSyntax return Update(Me.ForKeyword, Me.EachKeyword, Me.ControlVariable, Me.InKeyword, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._controlVariable Case 4 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.ControlVariable Case 4 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitForEachStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitForEachStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="forKeyword"> ''' The value for the ForKeyword property. ''' </param> ''' <param name="eachKeyword"> ''' The value for the EachKeyword property. ''' </param> ''' <param name="controlVariable"> ''' The value for the ControlVariable property. ''' </param> ''' <param name="inKeyword"> ''' The value for the InKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(forKeyword As SyntaxToken, eachKeyword As SyntaxToken, controlVariable As VisualBasicSyntaxNode, inKeyword As SyntaxToken, expression As ExpressionSyntax) As ForEachStatementSyntax If forKeyword <> Me.ForKeyword OrElse eachKeyword <> Me.EachKeyword OrElse controlVariable IsNot Me.ControlVariable OrElse inKeyword <> Me.InKeyword OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.ForEachStatement(forKeyword, eachKeyword, controlVariable, inKeyword, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' The Next statement that ends a For-Next or For Each-Next block. This statement ''' always occurs as the End of a ForBlock (with Kind=ForBlock or ForEachBlock), ''' and the body of the For-Next is the Body of that ForBlock. The Begin of that ''' ForBlock has the corresponding For or For Each statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.NextStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class NextStatementSyntax Inherits StatementSyntax Friend _controlVariables as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), nextKeyword As InternalSyntax.KeywordSyntax, controlVariables As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NextStatementSyntax(kind, errors, annotations, nextKeyword, if(controlVariables IsNot Nothing, controlVariables.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Next" keyword. ''' </summary> Public ReadOnly Property NextKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NextStatementSyntax)._nextKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the NextKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNextKeyword(nextKeyword as SyntaxToken) As NextStatementSyntax return Update(nextKeyword, Me.ControlVariables) End Function ''' <summary> ''' The variables in the Next statement, if present ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property ControlVariables As SeparatedSyntaxList(Of ExpressionSyntax) Get Dim listNode = GetRed(_controlVariables, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ExpressionSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the ControlVariables property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithControlVariables(controlVariables as SeparatedSyntaxList(Of ExpressionSyntax)) As NextStatementSyntax return Update(Me.NextKeyword, controlVariables) End Function Public Shadows Function AddControlVariables(ParamArray items As ExpressionSyntax()) As NextStatementSyntax Return Me.WithControlVariables(Me.ControlVariables.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._controlVariables Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_controlVariables, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitNextStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitNextStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="nextKeyword"> ''' The value for the NextKeyword property. ''' </param> ''' <param name="controlVariables"> ''' The value for the ControlVariables property. ''' </param> Public Function Update(nextKeyword As SyntaxToken, controlVariables As SeparatedSyntaxList(Of ExpressionSyntax)) As NextStatementSyntax If nextKeyword <> Me.NextKeyword OrElse controlVariables <> Me.ControlVariables Then Dim newNode = SyntaxFactory.NextStatement(nextKeyword, controlVariables) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' The Using statement that begins a Using block. This statement always occurs as ''' the Begin of a UsingBlock, and the body of the Using is the Body of that ''' UsingBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.UsingStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class UsingStatementSyntax Inherits StatementSyntax Friend _expression as ExpressionSyntax Friend _variables as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), usingKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax, variables As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.UsingStatementSyntax(kind, errors, annotations, usingKeyword, if(expression IsNot Nothing, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), Nothing), if(variables IsNot Nothing, variables.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Using" keyword. ''' </summary> Public ReadOnly Property UsingKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.UsingStatementSyntax)._usingKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the UsingKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithUsingKeyword(usingKeyword as SyntaxToken) As UsingStatementSyntax return Update(usingKeyword, Me.Expression, Me.Variables) End Function ''' <summary> ''' If the Using statement is of a form that does not declare a new variable, this ''' is the expression used in the using. Otherwise, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As UsingStatementSyntax return Update(Me.UsingKeyword, expression, Me.Variables) End Function ''' <summary> ''' If the Using statement is of a form that declares one or more new variables, ''' this is the list of variable declarations. Otherwise, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Variables As SeparatedSyntaxList(Of VariableDeclaratorSyntax) Get Dim listNode = GetRed(_variables, 2) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of VariableDeclaratorSyntax)(listNode, Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Variables property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithVariables(variables as SeparatedSyntaxList(Of VariableDeclaratorSyntax)) As UsingStatementSyntax return Update(Me.UsingKeyword, Me.Expression, variables) End Function Public Shadows Function AddVariables(ParamArray items As VariableDeclaratorSyntax()) As UsingStatementSyntax Return Me.WithVariables(Me.Variables.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case 2 Return Me._variables Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case 2 Return GetRed(_variables, 2) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitUsingStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitUsingStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="usingKeyword"> ''' The value for the UsingKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="variables"> ''' The value for the Variables property. ''' </param> Public Function Update(usingKeyword As SyntaxToken, expression As ExpressionSyntax, variables As SeparatedSyntaxList(Of VariableDeclaratorSyntax)) As UsingStatementSyntax If usingKeyword <> Me.UsingKeyword OrElse expression IsNot Me.Expression OrElse variables <> Me.Variables Then Dim newNode = SyntaxFactory.UsingStatement(usingKeyword, expression, variables) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a Throw statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ThrowStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ThrowStatementSyntax Inherits ExecutableStatementSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), throwKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ThrowStatementSyntax(kind, errors, annotations, throwKeyword, if(expression IsNot Nothing, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Throw" keyword ''' </summary> Public ReadOnly Property ThrowKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ThrowStatementSyntax)._throwKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ThrowKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithThrowKeyword(throwKeyword as SyntaxToken) As ThrowStatementSyntax return Update(throwKeyword, Me.Expression) End Function ''' <summary> ''' The expression denoting the value being thrown. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As ThrowStatementSyntax return Update(Me.ThrowKeyword, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitThrowStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitThrowStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="throwKeyword"> ''' The value for the ThrowKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(throwKeyword As SyntaxToken, expression As ExpressionSyntax) As ThrowStatementSyntax If throwKeyword <> Me.ThrowKeyword OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.ThrowStatement(throwKeyword, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a simple, compound, or Mid assignment statement. Which one can be ''' determined by checking the Kind. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SimpleAssignmentStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.MidAssignmentStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.AddAssignmentStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.SubtractAssignmentStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.MultiplyAssignmentStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.DivideAssignmentStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.IntegerDivideAssignmentStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ExponentiateAssignmentStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.LeftShiftAssignmentStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.RightShiftAssignmentStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ConcatenateAssignmentStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AssignmentStatementSyntax Inherits ExecutableStatementSyntax Friend _left as ExpressionSyntax Friend _right as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), left As ExpressionSyntax, operatorToken As InternalSyntax.PunctuationSyntax, right As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AssignmentStatementSyntax(kind, errors, annotations, DirectCast(left.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), operatorToken, DirectCast(right.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The target (left hand side) of the assignment. ''' </summary> Public ReadOnly Property Left As ExpressionSyntax Get Return GetRedAtZero(_left) End Get End Property ''' <summary> ''' Returns a copy of this with the Left property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithLeft(left as ExpressionSyntax) As AssignmentStatementSyntax return Update(Me.Kind, left, Me.OperatorToken, Me.Right) End Function ''' <summary> ''' The operator used in the assignment statement. One of "=", "+=", "-=", "*=", ''' "/=", "\=", "^=", "&=", "<<=" or ">>=". ''' </summary> Public ReadOnly Property OperatorToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AssignmentStatementSyntax)._operatorToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OperatorToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOperatorToken(operatorToken as SyntaxToken) As AssignmentStatementSyntax return Update(Me.Kind, Me.Left, operatorToken, Me.Right) End Function ''' <summary> ''' The source (right hand side) of the assignment. ''' </summary> Public ReadOnly Property Right As ExpressionSyntax Get Return GetRed(_right, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Right property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithRight(right as ExpressionSyntax) As AssignmentStatementSyntax return Update(Me.Kind, Me.Left, Me.OperatorToken, right) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._left Case 2 Return Me._right Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Left Case 2 Return Me.Right Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAssignmentStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAssignmentStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="left"> ''' The value for the Left property. ''' </param> ''' <param name="operatorToken"> ''' The value for the OperatorToken property. ''' </param> ''' <param name="right"> ''' The value for the Right property. ''' </param> Public Function Update(kind As SyntaxKind, left As ExpressionSyntax, operatorToken As SyntaxToken, right As ExpressionSyntax) As AssignmentStatementSyntax If kind <> Me.Kind OrElse left IsNot Me.Left OrElse operatorToken <> Me.OperatorToken OrElse right IsNot Me.Right Then Dim newNode = SyntaxFactory.AssignmentStatement(kind, left, operatorToken, right) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a left-hand side of a MidAssignment statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.MidExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class MidExpressionSyntax Inherits ExpressionSyntax Friend _argumentList as ArgumentListSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), mid As InternalSyntax.IdentifierTokenSyntax, argumentList As ArgumentListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MidExpressionSyntax(kind, errors, annotations, mid, DirectCast(argumentList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArgumentListSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Mid" possibly followed by a type character. ''' </summary> Public ReadOnly Property Mid As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MidExpressionSyntax)._mid, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Mid property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithMid(mid as SyntaxToken) As MidExpressionSyntax return Update(mid, Me.ArgumentList) End Function ''' <summary> ''' The argument list. ''' </summary> Public ReadOnly Property ArgumentList As ArgumentListSyntax Get Return GetRed(_argumentList, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the ArgumentList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArgumentList(argumentList as ArgumentListSyntax) As MidExpressionSyntax return Update(Me.Mid, argumentList) End Function Public Shadows Function AddArgumentListArguments(ParamArray items As ArgumentSyntax()) As MidExpressionSyntax Dim _child = If(Me.ArgumentList IsNot Nothing, Me.ArgumentList, SyntaxFactory.ArgumentList()) Return Me.WithArgumentList(_child.AddArguments(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._argumentList Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.ArgumentList Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitMidExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitMidExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="mid"> ''' The value for the Mid property. ''' </param> ''' <param name="argumentList"> ''' The value for the ArgumentList property. ''' </param> Public Function Update(mid As SyntaxToken, argumentList As ArgumentListSyntax) As MidExpressionSyntax If mid <> Me.Mid OrElse argumentList IsNot Me.ArgumentList Then Dim newNode = SyntaxFactory.MidExpression(mid, argumentList) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represent a call statement (also known as a invocation statement). ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CallStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CallStatementSyntax Inherits ExecutableStatementSyntax Friend _invocation as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), callKeyword As InternalSyntax.KeywordSyntax, invocation As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CallStatementSyntax(kind, errors, annotations, callKeyword, DirectCast(invocation.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Call" keyword. ''' </summary> Public ReadOnly Property CallKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CallStatementSyntax)._callKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the CallKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCallKeyword(callKeyword as SyntaxToken) As CallStatementSyntax return Update(callKeyword, Me.Invocation) End Function ''' <summary> ''' The expression denoting the call. This could be an Invocation or a MemberAccess ''' (in the case where no parentheses were supplied.) ''' </summary> Public ReadOnly Property Invocation As ExpressionSyntax Get Return GetRed(_invocation, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Invocation property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInvocation(invocation as ExpressionSyntax) As CallStatementSyntax return Update(Me.CallKeyword, invocation) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._invocation Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Invocation Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCallStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCallStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="callKeyword"> ''' The value for the CallKeyword property. ''' </param> ''' <param name="invocation"> ''' The value for the Invocation property. ''' </param> Public Function Update(callKeyword As SyntaxToken, invocation As ExpressionSyntax) As CallStatementSyntax If callKeyword <> Me.CallKeyword OrElse invocation IsNot Me.Invocation Then Dim newNode = SyntaxFactory.CallStatement(callKeyword, invocation) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an AddHandler or RemoveHandler statement. The Kind property ''' determines which one. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.AddHandlerStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.RemoveHandlerStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AddRemoveHandlerStatementSyntax Inherits ExecutableStatementSyntax Friend _eventExpression as ExpressionSyntax Friend _delegateExpression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), addHandlerOrRemoveHandlerKeyword As InternalSyntax.KeywordSyntax, eventExpression As ExpressionSyntax, commaToken As InternalSyntax.PunctuationSyntax, delegateExpression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AddRemoveHandlerStatementSyntax(kind, errors, annotations, addHandlerOrRemoveHandlerKeyword, DirectCast(eventExpression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), commaToken, DirectCast(delegateExpression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "AddHandler" or "RemoveHandler" keyword. ''' </summary> Public ReadOnly Property AddHandlerOrRemoveHandlerKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AddRemoveHandlerStatementSyntax)._addHandlerOrRemoveHandlerKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the AddHandlerOrRemoveHandlerKeyword property ''' changed to the specified value. Returns this instance if the specified value is ''' the same as the current value. ''' </summary> Public Shadows Function WithAddHandlerOrRemoveHandlerKeyword(addHandlerOrRemoveHandlerKeyword as SyntaxToken) As AddRemoveHandlerStatementSyntax return Update(Me.Kind, addHandlerOrRemoveHandlerKeyword, Me.EventExpression, Me.CommaToken, Me.DelegateExpression) End Function ''' <summary> ''' The event being accessed. ''' </summary> Public ReadOnly Property EventExpression As ExpressionSyntax Get Return GetRed(_eventExpression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the EventExpression property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithEventExpression(eventExpression as ExpressionSyntax) As AddRemoveHandlerStatementSyntax return Update(Me.Kind, Me.AddHandlerOrRemoveHandlerKeyword, eventExpression, Me.CommaToken, Me.DelegateExpression) End Function ''' <summary> ''' The "," token. ''' </summary> Public ReadOnly Property CommaToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AddRemoveHandlerStatementSyntax)._commaToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the CommaToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCommaToken(commaToken as SyntaxToken) As AddRemoveHandlerStatementSyntax return Update(Me.Kind, Me.AddHandlerOrRemoveHandlerKeyword, Me.EventExpression, commaToken, Me.DelegateExpression) End Function ''' <summary> ''' The delegate being added or removed. ''' </summary> Public ReadOnly Property DelegateExpression As ExpressionSyntax Get Return GetRed(_delegateExpression, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the DelegateExpression property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithDelegateExpression(delegateExpression as ExpressionSyntax) As AddRemoveHandlerStatementSyntax return Update(Me.Kind, Me.AddHandlerOrRemoveHandlerKeyword, Me.EventExpression, Me.CommaToken, delegateExpression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._eventExpression Case 3 Return Me._delegateExpression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.EventExpression Case 3 Return Me.DelegateExpression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAddRemoveHandlerStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAddRemoveHandlerStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="addHandlerOrRemoveHandlerKeyword"> ''' The value for the AddHandlerOrRemoveHandlerKeyword property. ''' </param> ''' <param name="eventExpression"> ''' The value for the EventExpression property. ''' </param> ''' <param name="commaToken"> ''' The value for the CommaToken property. ''' </param> ''' <param name="delegateExpression"> ''' The value for the DelegateExpression property. ''' </param> Public Function Update(kind As SyntaxKind, addHandlerOrRemoveHandlerKeyword As SyntaxToken, eventExpression As ExpressionSyntax, commaToken As SyntaxToken, delegateExpression As ExpressionSyntax) As AddRemoveHandlerStatementSyntax If kind <> Me.Kind OrElse addHandlerOrRemoveHandlerKeyword <> Me.AddHandlerOrRemoveHandlerKeyword OrElse eventExpression IsNot Me.EventExpression OrElse commaToken <> Me.CommaToken OrElse delegateExpression IsNot Me.DelegateExpression Then Dim newNode = SyntaxFactory.AddRemoveHandlerStatement(kind, addHandlerOrRemoveHandlerKeyword, eventExpression, commaToken, delegateExpression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represent a RaiseEvent statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.RaiseEventStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class RaiseEventStatementSyntax Inherits ExecutableStatementSyntax Friend _name as IdentifierNameSyntax Friend _argumentList as ArgumentListSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), raiseEventKeyword As InternalSyntax.KeywordSyntax, name As IdentifierNameSyntax, argumentList As ArgumentListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RaiseEventStatementSyntax(kind, errors, annotations, raiseEventKeyword, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IdentifierNameSyntax), if(argumentList IsNot Nothing, DirectCast(argumentList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArgumentListSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "RaiseEvent" keyword ''' </summary> Public ReadOnly Property RaiseEventKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RaiseEventStatementSyntax)._raiseEventKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the RaiseEventKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithRaiseEventKeyword(raiseEventKeyword as SyntaxToken) As RaiseEventStatementSyntax return Update(raiseEventKeyword, Me.Name, Me.ArgumentList) End Function ''' <summary> ''' The name of the event being raised. ''' </summary> Public ReadOnly Property Name As IdentifierNameSyntax Get Return GetRed(_name, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as IdentifierNameSyntax) As RaiseEventStatementSyntax return Update(Me.RaiseEventKeyword, name, Me.ArgumentList) End Function ''' <summary> ''' The argument list, if present. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ArgumentList As ArgumentListSyntax Get Return GetRed(_argumentList, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the ArgumentList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArgumentList(argumentList as ArgumentListSyntax) As RaiseEventStatementSyntax return Update(Me.RaiseEventKeyword, Me.Name, argumentList) End Function Public Shadows Function AddArgumentListArguments(ParamArray items As ArgumentSyntax()) As RaiseEventStatementSyntax Dim _child = If(Me.ArgumentList IsNot Nothing, Me.ArgumentList, SyntaxFactory.ArgumentList()) Return Me.WithArgumentList(_child.AddArguments(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._name Case 2 Return Me._argumentList Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Name Case 2 Return Me.ArgumentList Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitRaiseEventStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitRaiseEventStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="raiseEventKeyword"> ''' The value for the RaiseEventKeyword property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="argumentList"> ''' The value for the ArgumentList property. ''' </param> Public Function Update(raiseEventKeyword As SyntaxToken, name As IdentifierNameSyntax, argumentList As ArgumentListSyntax) As RaiseEventStatementSyntax If raiseEventKeyword <> Me.RaiseEventKeyword OrElse name IsNot Me.Name OrElse argumentList IsNot Me.ArgumentList Then Dim newNode = SyntaxFactory.RaiseEventStatement(raiseEventKeyword, name, argumentList) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "With" statement. This statement always occurs as the ''' BeginStatement of a WithBlock, and the body of the With is the Body of that ''' WithBlock. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.WithStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class WithStatementSyntax Inherits StatementSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), withKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WithStatementSyntax(kind, errors, annotations, withKeyword, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "With" keyword. ''' </summary> Public ReadOnly Property WithKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WithStatementSyntax)._withKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the WithKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithWithKeyword(withKeyword as SyntaxToken) As WithStatementSyntax return Update(withKeyword, Me.Expression) End Function ''' <summary> ''' The expression that is the operand of the With statement. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As WithStatementSyntax return Update(Me.WithKeyword, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitWithStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitWithStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="withKeyword"> ''' The value for the WithKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(withKeyword As SyntaxToken, expression As ExpressionSyntax) As WithStatementSyntax If withKeyword <> Me.WithKeyword OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.WithStatement(withKeyword, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a ReDim statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ReDimStatement"/></description></item> ''' <item><description><see cref="SyntaxKind.ReDimPreserveStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ReDimStatementSyntax Inherits ExecutableStatementSyntax Friend _clauses as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), reDimKeyword As InternalSyntax.KeywordSyntax, preserveKeyword As InternalSyntax.KeywordSyntax, clauses As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ReDimStatementSyntax(kind, errors, annotations, reDimKeyword, preserveKeyword, if(clauses IsNot Nothing, clauses.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "ReDim" keyword. ''' </summary> Public ReadOnly Property ReDimKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ReDimStatementSyntax)._reDimKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ReDimKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithReDimKeyword(reDimKeyword as SyntaxToken) As ReDimStatementSyntax return Update(Me.Kind, reDimKeyword, Me.PreserveKeyword, Me.Clauses) End Function ''' <summary> ''' Returns Nothing if Kind=ReDim, returns the "Preserve" keyword if ''' Kind=RedimPreserve. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property PreserveKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ReDimStatementSyntax)._preserveKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the PreserveKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithPreserveKeyword(preserveKeyword as SyntaxToken) As ReDimStatementSyntax return Update(Me.Kind, Me.ReDimKeyword, preserveKeyword, Me.Clauses) End Function ''' <summary> ''' The list of ReDim clauses. ''' </summary> Public ReadOnly Property Clauses As SeparatedSyntaxList(Of RedimClauseSyntax) Get Dim listNode = GetRed(_clauses, 2) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of RedimClauseSyntax)(listNode, Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Clauses property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithClauses(clauses as SeparatedSyntaxList(Of RedimClauseSyntax)) As ReDimStatementSyntax return Update(Me.Kind, Me.ReDimKeyword, Me.PreserveKeyword, clauses) End Function Public Shadows Function AddClauses(ParamArray items As RedimClauseSyntax()) As ReDimStatementSyntax Return Me.WithClauses(Me.Clauses.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._clauses Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return GetRed(_clauses, 2) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitReDimStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitReDimStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="reDimKeyword"> ''' The value for the ReDimKeyword property. ''' </param> ''' <param name="preserveKeyword"> ''' The value for the PreserveKeyword property. ''' </param> ''' <param name="clauses"> ''' The value for the Clauses property. ''' </param> Public Function Update(kind As SyntaxKind, reDimKeyword As SyntaxToken, preserveKeyword As SyntaxToken, clauses As SeparatedSyntaxList(Of RedimClauseSyntax)) As ReDimStatementSyntax If kind <> Me.Kind OrElse reDimKeyword <> Me.ReDimKeyword OrElse preserveKeyword <> Me.PreserveKeyword OrElse clauses <> Me.Clauses Then Dim newNode = SyntaxFactory.ReDimStatement(kind, reDimKeyword, preserveKeyword, clauses) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a ReDim statement clause. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.RedimClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class RedimClauseSyntax Inherits VisualBasicSyntaxNode Friend _expression as ExpressionSyntax Friend _arrayBounds as ArgumentListSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), expression As ExpressionSyntax, arrayBounds As ArgumentListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RedimClauseSyntax(kind, errors, annotations, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), DirectCast(arrayBounds.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArgumentListSyntax)), Nothing, 0) End Sub ''' <summary> ''' The target of the ReDim statement. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRedAtZero(_expression) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As RedimClauseSyntax return Update(expression, Me.ArrayBounds) End Function ''' <summary> ''' The ArraySizeInitializationModifier. ''' </summary> Public ReadOnly Property ArrayBounds As ArgumentListSyntax Get Return GetRed(_arrayBounds, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the ArrayBounds property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArrayBounds(arrayBounds as ArgumentListSyntax) As RedimClauseSyntax return Update(Me.Expression, arrayBounds) End Function Public Shadows Function AddArrayBoundsArguments(ParamArray items As ArgumentSyntax()) As RedimClauseSyntax Dim _child = If(Me.ArrayBounds IsNot Nothing, Me.ArrayBounds, SyntaxFactory.ArgumentList()) Return Me.WithArrayBounds(_child.AddArguments(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._expression Case 1 Return Me._arrayBounds Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Expression Case 1 Return Me.ArrayBounds Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitRedimClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitRedimClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="arrayBounds"> ''' The value for the ArrayBounds property. ''' </param> Public Function Update(expression As ExpressionSyntax, arrayBounds As ArgumentListSyntax) As RedimClauseSyntax If expression IsNot Me.Expression OrElse arrayBounds IsNot Me.ArrayBounds Then Dim newNode = SyntaxFactory.RedimClause(expression, arrayBounds) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an "Erase" statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EraseStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EraseStatementSyntax Inherits ExecutableStatementSyntax Friend _expressions as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), eraseKeyword As InternalSyntax.KeywordSyntax, expressions As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EraseStatementSyntax(kind, errors, annotations, eraseKeyword, if(expressions IsNot Nothing, expressions.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Erase" keyword. ''' </summary> Public ReadOnly Property EraseKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EraseStatementSyntax)._eraseKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the EraseKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEraseKeyword(eraseKeyword as SyntaxToken) As EraseStatementSyntax return Update(eraseKeyword, Me.Expressions) End Function ''' <summary> ''' A list of expressions denoting the arrays to erase. ''' </summary> Public ReadOnly Property Expressions As SeparatedSyntaxList(Of ExpressionSyntax) Get Dim listNode = GetRed(_expressions, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ExpressionSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Expressions property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpressions(expressions as SeparatedSyntaxList(Of ExpressionSyntax)) As EraseStatementSyntax return Update(Me.EraseKeyword, expressions) End Function Public Shadows Function AddExpressions(ParamArray items As ExpressionSyntax()) As EraseStatementSyntax Return Me.WithExpressions(Me.Expressions.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expressions Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_expressions, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEraseStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEraseStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="eraseKeyword"> ''' The value for the EraseKeyword property. ''' </param> ''' <param name="expressions"> ''' The value for the Expressions property. ''' </param> Public Function Update(eraseKeyword As SyntaxToken, expressions As SeparatedSyntaxList(Of ExpressionSyntax)) As EraseStatementSyntax If eraseKeyword <> Me.EraseKeyword OrElse expressions <> Me.Expressions Then Dim newNode = SyntaxFactory.EraseStatement(eraseKeyword, expressions) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' An abstract base class for all node classes that define expressions. ''' </summary> Public MustInherit Class ExpressionSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents a literal. The kind of literal is determined by the Kind property: ''' IntegerLiteral, CharacterLiteral, BooleanLiteral, DecimalLiteral, ''' FloatingLiteral, DateLiteral or StringLiteral. The value of the literal can be ''' determined by casting the associated Token to the correct type and getting the ''' value from the token. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CharacterLiteralExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.TrueLiteralExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.FalseLiteralExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.NumericLiteralExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.DateLiteralExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.StringLiteralExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.NothingLiteralExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class LiteralExpressionSyntax Inherits ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), token As InternalSyntax.SyntaxToken) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LiteralExpressionSyntax(kind, errors, annotations, token), Nothing, 0) End Sub ''' <summary> ''' The token that represents the literal. The Kind property determines what type ''' this property returns: Kind=IntegerLiteral ==> Returns IntegerLiteralToken. ''' Kind=CharacterLiteral ==> Returns CharacterLiteralToken. Kind=DecimalLiteral ''' ==> Returns DecimalLiteralToken Kind=FloatingLiteral ==> Returns ''' FloatingLiteralToken Kind=DateLiteral ==> Returns DateLiteralToken ''' Kind=StringLiteral ==> Returns StringLiteralToken Kind=BooleanLiteral ==> ''' Returns Keyword (with it's kind being TrueKeyword or FalseKeyword) ''' Kind=NothingLiteral ==> Returns Keyword (with it's kind being ''' NothingKeyword) ''' </summary> Public ReadOnly Property Token As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LiteralExpressionSyntax)._token, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Token property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithToken(token as SyntaxToken) As LiteralExpressionSyntax return Update(Me.Kind, token) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitLiteralExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitLiteralExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="token"> ''' The value for the Token property. ''' </param> Public Function Update(kind As SyntaxKind, token As SyntaxToken) As LiteralExpressionSyntax If kind <> Me.Kind OrElse token <> Me.Token Then Dim newNode = SyntaxFactory.LiteralExpression(kind, token) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a parenthesized expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ParenthesizedExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ParenthesizedExpressionSyntax Inherits ExpressionSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), openParenToken As InternalSyntax.PunctuationSyntax, expression As ExpressionSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParenthesizedExpressionSyntax(kind, errors, annotations, openParenToken, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "(" token ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParenthesizedExpressionSyntax)._openParenToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As ParenthesizedExpressionSyntax return Update(openParenToken, Me.Expression, Me.CloseParenToken) End Function ''' <summary> ''' The expression inside the parentheses. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As ParenthesizedExpressionSyntax return Update(Me.OpenParenToken, expression, Me.CloseParenToken) End Function ''' <summary> ''' The ")" token ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParenthesizedExpressionSyntax)._closeParenToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As ParenthesizedExpressionSyntax return Update(Me.OpenParenToken, Me.Expression, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitParenthesizedExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitParenthesizedExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(openParenToken As SyntaxToken, expression As ExpressionSyntax, closeParenToken As SyntaxToken) As ParenthesizedExpressionSyntax If openParenToken <> Me.OpenParenToken OrElse expression IsNot Me.Expression OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a tuple literal expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TupleExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TupleExpressionSyntax Inherits ExpressionSyntax Friend _arguments as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), openParenToken As InternalSyntax.PunctuationSyntax, arguments As SyntaxNode, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TupleExpressionSyntax(kind, errors, annotations, openParenToken, if(arguments IsNot Nothing, arguments.Green, Nothing), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "(" token ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TupleExpressionSyntax)._openParenToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As TupleExpressionSyntax return Update(openParenToken, Me.Arguments, Me.CloseParenToken) End Function ''' <summary> ''' The list of tuple arguments. ''' </summary> Public ReadOnly Property Arguments As SeparatedSyntaxList(Of SimpleArgumentSyntax) Get Dim listNode = GetRed(_arguments, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of SimpleArgumentSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Arguments property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArguments(arguments as SeparatedSyntaxList(Of SimpleArgumentSyntax)) As TupleExpressionSyntax return Update(Me.OpenParenToken, arguments, Me.CloseParenToken) End Function Public Shadows Function AddArguments(ParamArray items As SimpleArgumentSyntax()) As TupleExpressionSyntax Return Me.WithArguments(Me.Arguments.AddRange(items)) End Function ''' <summary> ''' The ")" token ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TupleExpressionSyntax)._closeParenToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As TupleExpressionSyntax return Update(Me.OpenParenToken, Me.Arguments, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._arguments Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_arguments, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTupleExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTupleExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="arguments"> ''' The value for the Arguments property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(openParenToken As SyntaxToken, arguments As SeparatedSyntaxList(Of SimpleArgumentSyntax), closeParenToken As SyntaxToken) As TupleExpressionSyntax If openParenToken <> Me.OpenParenToken OrElse arguments <> Me.Arguments OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a tuple type expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TupleType"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TupleTypeSyntax Inherits TypeSyntax Friend _elements as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), openParenToken As InternalSyntax.PunctuationSyntax, elements As SyntaxNode, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TupleTypeSyntax(kind, errors, annotations, openParenToken, if(elements IsNot Nothing, elements.Green, Nothing), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "(" token ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TupleTypeSyntax)._openParenToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As TupleTypeSyntax return Update(openParenToken, Me.Elements, Me.CloseParenToken) End Function ''' <summary> ''' The list of tuple elements. ''' </summary> Public ReadOnly Property Elements As SeparatedSyntaxList(Of TupleElementSyntax) Get Dim listNode = GetRed(_elements, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of TupleElementSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Elements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElements(elements as SeparatedSyntaxList(Of TupleElementSyntax)) As TupleTypeSyntax return Update(Me.OpenParenToken, elements, Me.CloseParenToken) End Function Public Shadows Function AddElements(ParamArray items As TupleElementSyntax()) As TupleTypeSyntax Return Me.WithElements(Me.Elements.AddRange(items)) End Function ''' <summary> ''' The ")" token ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TupleTypeSyntax)._closeParenToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As TupleTypeSyntax return Update(Me.OpenParenToken, Me.Elements, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._elements Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_elements, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTupleType(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTupleType(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="elements"> ''' The value for the Elements property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(openParenToken As SyntaxToken, elements As SeparatedSyntaxList(Of TupleElementSyntax), closeParenToken As SyntaxToken) As TupleTypeSyntax If openParenToken <> Me.OpenParenToken OrElse elements <> Me.Elements OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a single declaration of a tuple element. ''' </summary> Public MustInherit Class TupleElementSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents a single declaration of a tuple element supplying only the type. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TypedTupleElement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TypedTupleElementSyntax Inherits TupleElementSyntax Friend _type as TypeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), type As TypeSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypedTupleElementSyntax(kind, errors, annotations, DirectCast(type.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax)), Nothing, 0) End Sub ''' <summary> ''' The type-name part of the tuple element syntax. ''' </summary> Public ReadOnly Property Type As TypeSyntax Get Return GetRedAtZero(_type) End Get End Property ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithType(type as TypeSyntax) As TypedTupleElementSyntax return Update(type) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Me._type Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode If i = 0 Then Return Me.Type Else Return Nothing End If End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTypedTupleElement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTypedTupleElement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="type"> ''' The value for the Type property. ''' </param> Public Function Update(type As TypeSyntax) As TypedTupleElementSyntax If type IsNot Me.Type Then Dim newNode = SyntaxFactory.TypedTupleElement(type) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a single declaration of a tuple element supplying element name and ''' optionally a type. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.NamedTupleElement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class NamedTupleElementSyntax Inherits TupleElementSyntax Friend _asClause as SimpleAsClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), identifier As InternalSyntax.IdentifierTokenSyntax, asClause As SimpleAsClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NamedTupleElementSyntax(kind, errors, annotations, identifier, if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The name of the element. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NamedTupleElementSyntax)._identifier, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As NamedTupleElementSyntax return Update(identifier, Me.AsClause) End Function ''' <summary> ''' A simple "As" clause specifying the type of the tuple element. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As NamedTupleElementSyntax return Update(Me.Identifier, asClause) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._asClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.AsClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitNamedTupleElement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitNamedTupleElement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> Public Function Update(identifier As SyntaxToken, asClause As SimpleAsClauseSyntax) As NamedTupleElementSyntax If identifier <> Me.Identifier OrElse asClause IsNot Me.AsClause Then Dim newNode = SyntaxFactory.NamedTupleElement(identifier, asClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Identifies one of the special instances "Me", "MyClass" or "MyBase". The Kind ''' property identifies which. ''' </summary> Public MustInherit Class InstanceExpressionSyntax Inherits ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The "Me", "MyClass" or "MyBase" keyword. ''' </summary> Public ReadOnly Property Keyword As SyntaxToken Get Return Me.GetKeywordCore() End Get End Property Friend Overridable Function GetKeywordCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InstanceExpressionSyntax)._keyword, Me.Position, 0) End Function ''' <summary> ''' Returns a copy of this with the Keyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithKeyword(keyword As SyntaxToken) As InstanceExpressionSyntax Return WithKeywordCore(keyword) End Function Friend MustOverride Function WithKeywordCore(keyword As SyntaxToken) As InstanceExpressionSyntax End Class ''' <summary> ''' Identifies the special instance "Me" ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.MeExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class MeExpressionSyntax Inherits InstanceExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), keyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MeExpressionSyntax(kind, errors, annotations, keyword), Nothing, 0) End Sub ''' <summary> ''' The "Me", "MyClass" or "MyBase" keyword. ''' </summary> Public Shadows ReadOnly Property Keyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MeExpressionSyntax)._keyword, Me.Position, 0) End Get End Property Friend Overrides Function GetKeywordCore() As SyntaxToken Return Me.Keyword End Function Friend Overrides Function WithKeywordCore(keyword As SyntaxToken) As InstanceExpressionSyntax Return WithKeyword(keyword) End Function ''' <summary> ''' Returns a copy of this with the Keyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithKeyword(keyword as SyntaxToken) As MeExpressionSyntax return Update(keyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitMeExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitMeExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="keyword"> ''' The value for the Keyword property. ''' </param> Public Function Update(keyword As SyntaxToken) As MeExpressionSyntax If keyword <> Me.Keyword Then Dim newNode = SyntaxFactory.MeExpression(keyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Identifies the special instance "MyBase" ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.MyBaseExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class MyBaseExpressionSyntax Inherits InstanceExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), keyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MyBaseExpressionSyntax(kind, errors, annotations, keyword), Nothing, 0) End Sub ''' <summary> ''' The "Me", "MyClass" or "MyBase" keyword. ''' </summary> Public Shadows ReadOnly Property Keyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MyBaseExpressionSyntax)._keyword, Me.Position, 0) End Get End Property Friend Overrides Function GetKeywordCore() As SyntaxToken Return Me.Keyword End Function Friend Overrides Function WithKeywordCore(keyword As SyntaxToken) As InstanceExpressionSyntax Return WithKeyword(keyword) End Function ''' <summary> ''' Returns a copy of this with the Keyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithKeyword(keyword as SyntaxToken) As MyBaseExpressionSyntax return Update(keyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitMyBaseExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitMyBaseExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="keyword"> ''' The value for the Keyword property. ''' </param> Public Function Update(keyword As SyntaxToken) As MyBaseExpressionSyntax If keyword <> Me.Keyword Then Dim newNode = SyntaxFactory.MyBaseExpression(keyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Identifies the special instance "MyClass" ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.MyClassExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class MyClassExpressionSyntax Inherits InstanceExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), keyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MyClassExpressionSyntax(kind, errors, annotations, keyword), Nothing, 0) End Sub ''' <summary> ''' The "Me", "MyClass" or "MyBase" keyword. ''' </summary> Public Shadows ReadOnly Property Keyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MyClassExpressionSyntax)._keyword, Me.Position, 0) End Get End Property Friend Overrides Function GetKeywordCore() As SyntaxToken Return Me.Keyword End Function Friend Overrides Function WithKeywordCore(keyword As SyntaxToken) As InstanceExpressionSyntax Return WithKeyword(keyword) End Function ''' <summary> ''' Returns a copy of this with the Keyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithKeyword(keyword as SyntaxToken) As MyClassExpressionSyntax return Update(keyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitMyClassExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitMyClassExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="keyword"> ''' The value for the Keyword property. ''' </param> Public Function Update(keyword As SyntaxToken) As MyClassExpressionSyntax If keyword <> Me.Keyword Then Dim newNode = SyntaxFactory.MyClassExpression(keyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a GetType expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.GetTypeExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class GetTypeExpressionSyntax Inherits ExpressionSyntax Friend _type as TypeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), getTypeKeyword As InternalSyntax.KeywordSyntax, openParenToken As InternalSyntax.PunctuationSyntax, type As TypeSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GetTypeExpressionSyntax(kind, errors, annotations, getTypeKeyword, openParenToken, DirectCast(type.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "GetType" keyword. ''' </summary> Public ReadOnly Property GetTypeKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GetTypeExpressionSyntax)._getTypeKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the GetTypeKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithGetTypeKeyword(getTypeKeyword as SyntaxToken) As GetTypeExpressionSyntax return Update(getTypeKeyword, Me.OpenParenToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The "(" token. ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GetTypeExpressionSyntax)._openParenToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As GetTypeExpressionSyntax return Update(Me.GetTypeKeyword, openParenToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The type to get the Type object for. This can be an open generic type. ''' </summary> Public ReadOnly Property Type As TypeSyntax Get Return GetRed(_type, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithType(type as TypeSyntax) As GetTypeExpressionSyntax return Update(Me.GetTypeKeyword, Me.OpenParenToken, type, Me.CloseParenToken) End Function ''' <summary> ''' The ")" token. ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GetTypeExpressionSyntax)._closeParenToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As GetTypeExpressionSyntax return Update(Me.GetTypeKeyword, Me.OpenParenToken, Me.Type, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._type Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Type Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitGetTypeExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitGetTypeExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="getTypeKeyword"> ''' The value for the GetTypeKeyword property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="type"> ''' The value for the Type property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(getTypeKeyword As SyntaxToken, openParenToken As SyntaxToken, type As TypeSyntax, closeParenToken As SyntaxToken) As GetTypeExpressionSyntax If getTypeKeyword <> Me.GetTypeKeyword OrElse openParenToken <> Me.OpenParenToken OrElse type IsNot Me.Type OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.GetTypeExpression(getTypeKeyword, openParenToken, type, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a TypeOf...Is or IsNot expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TypeOfIsExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.TypeOfIsNotExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TypeOfExpressionSyntax Inherits ExpressionSyntax Friend _expression as ExpressionSyntax Friend _type as TypeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), typeOfKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax, operatorToken As InternalSyntax.KeywordSyntax, type As TypeSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeOfExpressionSyntax(kind, errors, annotations, typeOfKeyword, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), operatorToken, DirectCast(type.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "TypeOf" keyword. ''' </summary> Public ReadOnly Property TypeOfKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeOfExpressionSyntax)._typeOfKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the TypeOfKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithTypeOfKeyword(typeOfKeyword as SyntaxToken) As TypeOfExpressionSyntax return Update(Me.Kind, typeOfKeyword, Me.Expression, Me.OperatorToken, Me.Type) End Function ''' <summary> ''' The expression being tested. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As TypeOfExpressionSyntax return Update(Me.Kind, Me.TypeOfKeyword, expression, Me.OperatorToken, Me.Type) End Function ''' <summary> ''' The "Is" or "IsNot" keyword. ''' </summary> Public ReadOnly Property OperatorToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeOfExpressionSyntax)._operatorToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the OperatorToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOperatorToken(operatorToken as SyntaxToken) As TypeOfExpressionSyntax return Update(Me.Kind, Me.TypeOfKeyword, Me.Expression, operatorToken, Me.Type) End Function ''' <summary> ''' The name of the type being tested against. ''' </summary> Public ReadOnly Property Type As TypeSyntax Get Return GetRed(_type, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithType(type as TypeSyntax) As TypeOfExpressionSyntax return Update(Me.Kind, Me.TypeOfKeyword, Me.Expression, Me.OperatorToken, type) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case 3 Return Me._type Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case 3 Return Me.Type Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTypeOfExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTypeOfExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="typeOfKeyword"> ''' The value for the TypeOfKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="operatorToken"> ''' The value for the OperatorToken property. ''' </param> ''' <param name="type"> ''' The value for the Type property. ''' </param> Public Function Update(kind As SyntaxKind, typeOfKeyword As SyntaxToken, expression As ExpressionSyntax, operatorToken As SyntaxToken, type As TypeSyntax) As TypeOfExpressionSyntax If kind <> Me.Kind OrElse typeOfKeyword <> Me.TypeOfKeyword OrElse expression IsNot Me.Expression OrElse operatorToken <> Me.OperatorToken OrElse type IsNot Me.Type Then Dim newNode = SyntaxFactory.TypeOfExpression(kind, typeOfKeyword, expression, operatorToken, type) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a GetXmlNamespace expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.GetXmlNamespaceExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class GetXmlNamespaceExpressionSyntax Inherits ExpressionSyntax Friend _name as XmlPrefixNameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), getXmlNamespaceKeyword As InternalSyntax.KeywordSyntax, openParenToken As InternalSyntax.PunctuationSyntax, name As XmlPrefixNameSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GetXmlNamespaceExpressionSyntax(kind, errors, annotations, getXmlNamespaceKeyword, openParenToken, if(name IsNot Nothing, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlPrefixNameSyntax), Nothing), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "GetXmlNamespace" keyword. ''' </summary> Public ReadOnly Property GetXmlNamespaceKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GetXmlNamespaceExpressionSyntax)._getXmlNamespaceKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the GetXmlNamespaceKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithGetXmlNamespaceKeyword(getXmlNamespaceKeyword as SyntaxToken) As GetXmlNamespaceExpressionSyntax return Update(getXmlNamespaceKeyword, Me.OpenParenToken, Me.Name, Me.CloseParenToken) End Function ''' <summary> ''' The "(" token. ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GetXmlNamespaceExpressionSyntax)._openParenToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As GetXmlNamespaceExpressionSyntax return Update(Me.GetXmlNamespaceKeyword, openParenToken, Me.Name, Me.CloseParenToken) End Function ''' <summary> ''' The Xml namespace name being referenced. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Name As XmlPrefixNameSyntax Get Return GetRed(_name, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as XmlPrefixNameSyntax) As GetXmlNamespaceExpressionSyntax return Update(Me.GetXmlNamespaceKeyword, Me.OpenParenToken, name, Me.CloseParenToken) End Function ''' <summary> ''' The ")" token. ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GetXmlNamespaceExpressionSyntax)._closeParenToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As GetXmlNamespaceExpressionSyntax return Update(Me.GetXmlNamespaceKeyword, Me.OpenParenToken, Me.Name, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._name Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Name Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitGetXmlNamespaceExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitGetXmlNamespaceExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="getXmlNamespaceKeyword"> ''' The value for the GetXmlNamespaceKeyword property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(getXmlNamespaceKeyword As SyntaxToken, openParenToken As SyntaxToken, name As XmlPrefixNameSyntax, closeParenToken As SyntaxToken) As GetXmlNamespaceExpressionSyntax If getXmlNamespaceKeyword <> Me.GetXmlNamespaceKeyword OrElse openParenToken <> Me.OpenParenToken OrElse name IsNot Me.Name OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.GetXmlNamespaceExpression(getXmlNamespaceKeyword, openParenToken, name, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents member access (.name) or dictionary access (!name). The Kind ''' property determines which kind of access. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SimpleMemberAccessExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.DictionaryAccessExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class MemberAccessExpressionSyntax Inherits ExpressionSyntax Friend _expression as ExpressionSyntax Friend _name as SimpleNameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), expression As ExpressionSyntax, operatorToken As InternalSyntax.PunctuationSyntax, name As SimpleNameSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MemberAccessExpressionSyntax(kind, errors, annotations, if(expression IsNot Nothing, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), Nothing), operatorToken, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleNameSyntax)), Nothing, 0) End Sub ''' <summary> ''' The expression on the left-hand-side of the "." or "!" token. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRedAtZero(_expression) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As MemberAccessExpressionSyntax return Update(Me.Kind, expression, Me.OperatorToken, Me.Name) End Function ''' <summary> ''' The "." or "!" token. ''' </summary> Public ReadOnly Property OperatorToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MemberAccessExpressionSyntax)._operatorToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OperatorToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOperatorToken(operatorToken as SyntaxToken) As MemberAccessExpressionSyntax return Update(Me.Kind, Me.Expression, operatorToken, Me.Name) End Function ''' <summary> ''' The identifier after the "." or "!" token. ''' </summary> Public ReadOnly Property Name As SimpleNameSyntax Get Return GetRed(_name, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as SimpleNameSyntax) As MemberAccessExpressionSyntax return Update(Me.Kind, Me.Expression, Me.OperatorToken, name) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._expression Case 2 Return Me._name Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Expression Case 2 Return Me.Name Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitMemberAccessExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitMemberAccessExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="operatorToken"> ''' The value for the OperatorToken property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> Public Function Update(kind As SyntaxKind, expression As ExpressionSyntax, operatorToken As SyntaxToken, name As SimpleNameSyntax) As MemberAccessExpressionSyntax If kind <> Me.Kind OrElse expression IsNot Me.Expression OrElse operatorToken <> Me.OperatorToken OrElse name IsNot Me.Name Then Dim newNode = SyntaxFactory.MemberAccessExpression(kind, expression, operatorToken, name) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML member element access (node.<Element>), attribute ''' access (node.@Attribute) or descendants access (node...<Descendant>). The ''' Kind property determines which kind of access. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlElementAccessExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.XmlDescendantAccessExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.XmlAttributeAccessExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlMemberAccessExpressionSyntax Inherits ExpressionSyntax Friend _base as ExpressionSyntax Friend _name as XmlNodeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), base As ExpressionSyntax, token1 As InternalSyntax.PunctuationSyntax, token2 As InternalSyntax.PunctuationSyntax, token3 As InternalSyntax.PunctuationSyntax, name As XmlNodeSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlMemberAccessExpressionSyntax(kind, errors, annotations, if(base IsNot Nothing, DirectCast(base.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), Nothing), token1, token2, token3, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNodeSyntax)), Nothing, 0) End Sub ''' <summary> ''' The expression on the left-hand-side of the ".", ".@" or "..." . ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Base As ExpressionSyntax Get Return GetRedAtZero(_base) End Get End Property ''' <summary> ''' Returns a copy of this with the Base property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithBase(base as ExpressionSyntax) As XmlMemberAccessExpressionSyntax return Update(Me.Kind, base, Me.Token1, Me.Token2, Me.Token3, Me.Name) End Function ''' <summary> ''' The initial dot "." part of the separator. ''' </summary> Public ReadOnly Property Token1 As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlMemberAccessExpressionSyntax)._token1, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the Token1 property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithToken1(token1 as SyntaxToken) As XmlMemberAccessExpressionSyntax return Update(Me.Kind, Me.Base, token1, Me.Token2, Me.Token3, Me.Name) End Function ''' <summary> ''' The "@" part of .@ or the second "." of "...". ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Token2 As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlMemberAccessExpressionSyntax)._token2 If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(2), Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Token2 property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithToken2(token2 as SyntaxToken) As XmlMemberAccessExpressionSyntax return Update(Me.Kind, Me.Base, Me.Token1, token2, Me.Token3, Me.Name) End Function ''' <summary> ''' The third "." in a "..." separator. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Token3 As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlMemberAccessExpressionSyntax)._token3 If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(3), Me.GetChildIndex(3)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Token3 property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithToken3(token3 as SyntaxToken) As XmlMemberAccessExpressionSyntax return Update(Me.Kind, Me.Base, Me.Token1, Me.Token2, token3, Me.Name) End Function ''' <summary> ''' The identifier after the ".", ".@" or "..." ''' </summary> Public ReadOnly Property Name As XmlNodeSyntax Get Return GetRed(_name, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as XmlNodeSyntax) As XmlMemberAccessExpressionSyntax return Update(Me.Kind, Me.Base, Me.Token1, Me.Token2, Me.Token3, name) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._base Case 4 Return Me._name Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Base Case 4 Return Me.Name Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlMemberAccessExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlMemberAccessExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="base"> ''' The value for the Base property. ''' </param> ''' <param name="token1"> ''' The value for the Token1 property. ''' </param> ''' <param name="token2"> ''' The value for the Token2 property. ''' </param> ''' <param name="token3"> ''' The value for the Token3 property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> Public Function Update(kind As SyntaxKind, base As ExpressionSyntax, token1 As SyntaxToken, token2 As SyntaxToken, token3 As SyntaxToken, name As XmlNodeSyntax) As XmlMemberAccessExpressionSyntax If kind <> Me.Kind OrElse base IsNot Me.Base OrElse token1 <> Me.Token1 OrElse token2 <> Me.Token2 OrElse token3 <> Me.Token3 OrElse name IsNot Me.Name Then Dim newNode = SyntaxFactory.XmlMemberAccessExpression(kind, base, token1, token2, token3, name) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an invocation expression consisting of an invocation target and an ''' optional argument list or an array, parameterized property or object default ''' property index. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.InvocationExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class InvocationExpressionSyntax Inherits ExpressionSyntax Friend _expression as ExpressionSyntax Friend _argumentList as ArgumentListSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), expression As ExpressionSyntax, argumentList As ArgumentListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InvocationExpressionSyntax(kind, errors, annotations, if(expression IsNot Nothing, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), Nothing), if(argumentList IsNot Nothing, DirectCast(argumentList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArgumentListSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The target of the call or index expression. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRedAtZero(_expression) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As InvocationExpressionSyntax return Update(expression, Me.ArgumentList) End Function ''' <summary> ''' The argument list. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ArgumentList As ArgumentListSyntax Get Return GetRed(_argumentList, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the ArgumentList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArgumentList(argumentList as ArgumentListSyntax) As InvocationExpressionSyntax return Update(Me.Expression, argumentList) End Function Public Shadows Function AddArgumentListArguments(ParamArray items As ArgumentSyntax()) As InvocationExpressionSyntax Dim _child = If(Me.ArgumentList IsNot Nothing, Me.ArgumentList, SyntaxFactory.ArgumentList()) Return Me.WithArgumentList(_child.AddArguments(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._expression Case 1 Return Me._argumentList Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Expression Case 1 Return Me.ArgumentList Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitInvocationExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitInvocationExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="argumentList"> ''' The value for the ArgumentList property. ''' </param> Public Function Update(expression As ExpressionSyntax, argumentList As ArgumentListSyntax) As InvocationExpressionSyntax If expression IsNot Me.Expression OrElse argumentList IsNot Me.ArgumentList Then Dim newNode = SyntaxFactory.InvocationExpression(expression, argumentList) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Base class for object, array and anonymous object creation expressions ''' </summary> Partial Public MustInherit Class NewExpressionSyntax Inherits ExpressionSyntax Friend _attributeLists as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The "New" keyword. ''' </summary> Public ReadOnly Property NewKeyword As SyntaxToken Get Return Me.GetNewKeywordCore() End Get End Property Friend Overridable Function GetNewKeywordCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NewExpressionSyntax)._newKeyword, Me.Position, 0) End Function ''' <summary> ''' Returns a copy of this with the NewKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithNewKeyword(newKeyword As SyntaxToken) As NewExpressionSyntax Return WithNewKeywordCore(newKeyword) End Function Friend MustOverride Function WithNewKeywordCore(newKeyword As SyntaxToken) As NewExpressionSyntax ''' <summary> ''' A list of all attribute lists on the type. If no attributes were specified, an ''' empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Return Me.GetAttributeListsCore() End Get End Property Friend Overridable Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Dim listNode = GetRed(_attributeLists, 1) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Function WithAttributeLists(attributeLists As SyntaxList(Of AttributeListSyntax)) As NewExpressionSyntax Return WithAttributeListsCore(attributeLists) End Function Friend MustOverride Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As NewExpressionSyntax Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As NewExpressionSyntax Return AddAttributeListsCore(items) End Function Friend MustOverride Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As NewExpressionSyntax End Class ''' <summary> ''' Represents a New expression that creates a new non-array object, possibly with ''' a "With" or "From" clause. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ObjectCreationExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ObjectCreationExpressionSyntax Inherits NewExpressionSyntax Friend _type as TypeSyntax Friend _argumentList as ArgumentListSyntax Friend _initializer as ObjectCreationInitializerSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), newKeyword As InternalSyntax.KeywordSyntax, attributeLists As SyntaxNode, type As TypeSyntax, argumentList As ArgumentListSyntax, initializer As ObjectCreationInitializerSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ObjectCreationExpressionSyntax(kind, errors, annotations, newKeyword, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), DirectCast(type.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax), if(argumentList IsNot Nothing, DirectCast(argumentList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArgumentListSyntax), Nothing), if(initializer IsNot Nothing, DirectCast(initializer.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ObjectCreationInitializerSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "New" keyword. ''' </summary> Public Shadows ReadOnly Property NewKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ObjectCreationExpressionSyntax)._newKeyword, Me.Position, 0) End Get End Property Friend Overrides Function GetNewKeywordCore() As SyntaxToken Return Me.NewKeyword End Function Friend Overrides Function WithNewKeywordCore(newKeyword As SyntaxToken) As NewExpressionSyntax Return WithNewKeyword(newKeyword) End Function ''' <summary> ''' Returns a copy of this with the NewKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNewKeyword(newKeyword as SyntaxToken) As ObjectCreationExpressionSyntax return Update(newKeyword, Me.AttributeLists, Me.Type, Me.ArgumentList, Me.Initializer) End Function ''' <summary> ''' A list of all attribute lists on the type. If no attributes were specified, an ''' empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRed(_attributeLists, 1) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As NewExpressionSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As ObjectCreationExpressionSyntax return Update(Me.NewKeyword, attributeLists, Me.Type, Me.ArgumentList, Me.Initializer) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As ObjectCreationExpressionSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As NewExpressionSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' The type of the object being initialized. ''' </summary> Public ReadOnly Property Type As TypeSyntax Get Return GetRed(_type, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithType(type as TypeSyntax) As ObjectCreationExpressionSyntax return Update(Me.NewKeyword, Me.AttributeLists, type, Me.ArgumentList, Me.Initializer) End Function ''' <summary> ''' The argument list, if present. If no argument list was supplied, Nothing is ''' returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ArgumentList As ArgumentListSyntax Get Return GetRed(_argumentList, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the ArgumentList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArgumentList(argumentList as ArgumentListSyntax) As ObjectCreationExpressionSyntax return Update(Me.NewKeyword, Me.AttributeLists, Me.Type, argumentList, Me.Initializer) End Function Public Shadows Function AddArgumentListArguments(ParamArray items As ArgumentSyntax()) As ObjectCreationExpressionSyntax Dim _child = If(Me.ArgumentList IsNot Nothing, Me.ArgumentList, SyntaxFactory.ArgumentList()) Return Me.WithArgumentList(_child.AddArguments(items)) End Function ''' <summary> ''' An optional From or With clause to initialize the new object. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Initializer As ObjectCreationInitializerSyntax Get Return GetRed(_initializer, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the Initializer property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInitializer(initializer as ObjectCreationInitializerSyntax) As ObjectCreationExpressionSyntax return Update(Me.NewKeyword, Me.AttributeLists, Me.Type, Me.ArgumentList, initializer) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._attributeLists Case 2 Return Me._type Case 3 Return Me._argumentList Case 4 Return Me._initializer Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_attributeLists, 1) Case 2 Return Me.Type Case 3 Return Me.ArgumentList Case 4 Return Me.Initializer Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitObjectCreationExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitObjectCreationExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="newKeyword"> ''' The value for the NewKeyword property. ''' </param> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="type"> ''' The value for the Type property. ''' </param> ''' <param name="argumentList"> ''' The value for the ArgumentList property. ''' </param> ''' <param name="initializer"> ''' The value for the Initializer property. ''' </param> Public Function Update(newKeyword As SyntaxToken, attributeLists As SyntaxList(of AttributeListSyntax), type As TypeSyntax, argumentList As ArgumentListSyntax, initializer As ObjectCreationInitializerSyntax) As ObjectCreationExpressionSyntax If newKeyword <> Me.NewKeyword OrElse attributeLists <> Me.AttributeLists OrElse type IsNot Me.Type OrElse argumentList IsNot Me.ArgumentList OrElse initializer IsNot Me.Initializer Then Dim newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, attributeLists, type, argumentList, initializer) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a New expression that create an object of anonymous type. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.AnonymousObjectCreationExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AnonymousObjectCreationExpressionSyntax Inherits NewExpressionSyntax Friend _initializer as ObjectMemberInitializerSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), newKeyword As InternalSyntax.KeywordSyntax, attributeLists As SyntaxNode, initializer As ObjectMemberInitializerSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax(kind, errors, annotations, newKeyword, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), DirectCast(initializer.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ObjectMemberInitializerSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "New" keyword. ''' </summary> Public Shadows ReadOnly Property NewKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)._newKeyword, Me.Position, 0) End Get End Property Friend Overrides Function GetNewKeywordCore() As SyntaxToken Return Me.NewKeyword End Function Friend Overrides Function WithNewKeywordCore(newKeyword As SyntaxToken) As NewExpressionSyntax Return WithNewKeyword(newKeyword) End Function ''' <summary> ''' Returns a copy of this with the NewKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNewKeyword(newKeyword as SyntaxToken) As AnonymousObjectCreationExpressionSyntax return Update(newKeyword, Me.AttributeLists, Me.Initializer) End Function ''' <summary> ''' A list of all attribute lists on the type. If no attributes were specified, an ''' empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRed(_attributeLists, 1) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As NewExpressionSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As AnonymousObjectCreationExpressionSyntax return Update(Me.NewKeyword, attributeLists, Me.Initializer) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As AnonymousObjectCreationExpressionSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As NewExpressionSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' The With clause to initialize the new object. ''' </summary> Public ReadOnly Property Initializer As ObjectMemberInitializerSyntax Get Return GetRed(_initializer, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Initializer property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInitializer(initializer as ObjectMemberInitializerSyntax) As AnonymousObjectCreationExpressionSyntax return Update(Me.NewKeyword, Me.AttributeLists, initializer) End Function Public Shadows Function AddInitializerInitializers(ParamArray items As FieldInitializerSyntax()) As AnonymousObjectCreationExpressionSyntax Dim _child = If(Me.Initializer IsNot Nothing, Me.Initializer, SyntaxFactory.ObjectMemberInitializer()) Return Me.WithInitializer(_child.AddInitializers(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._attributeLists Case 2 Return Me._initializer Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_attributeLists, 1) Case 2 Return Me.Initializer Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAnonymousObjectCreationExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAnonymousObjectCreationExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="newKeyword"> ''' The value for the NewKeyword property. ''' </param> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="initializer"> ''' The value for the Initializer property. ''' </param> Public Function Update(newKeyword As SyntaxToken, attributeLists As SyntaxList(of AttributeListSyntax), initializer As ObjectMemberInitializerSyntax) As AnonymousObjectCreationExpressionSyntax If newKeyword <> Me.NewKeyword OrElse attributeLists <> Me.AttributeLists OrElse initializer IsNot Me.Initializer Then Dim newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, attributeLists, initializer) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an expression that creates a new array. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ArrayCreationExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ArrayCreationExpressionSyntax Inherits NewExpressionSyntax Friend _type as TypeSyntax Friend _arrayBounds as ArgumentListSyntax Friend _rankSpecifiers as SyntaxNode Friend _initializer as CollectionInitializerSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), newKeyword As InternalSyntax.KeywordSyntax, attributeLists As SyntaxNode, type As TypeSyntax, arrayBounds As ArgumentListSyntax, rankSpecifiers As SyntaxNode, initializer As CollectionInitializerSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArrayCreationExpressionSyntax(kind, errors, annotations, newKeyword, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), DirectCast(type.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax), if(arrayBounds IsNot Nothing, DirectCast(arrayBounds.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArgumentListSyntax), Nothing), if(rankSpecifiers IsNot Nothing, rankSpecifiers.Green, Nothing), DirectCast(initializer.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CollectionInitializerSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "New" keyword. ''' </summary> Public Shadows ReadOnly Property NewKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArrayCreationExpressionSyntax)._newKeyword, Me.Position, 0) End Get End Property Friend Overrides Function GetNewKeywordCore() As SyntaxToken Return Me.NewKeyword End Function Friend Overrides Function WithNewKeywordCore(newKeyword As SyntaxToken) As NewExpressionSyntax Return WithNewKeyword(newKeyword) End Function ''' <summary> ''' Returns a copy of this with the NewKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNewKeyword(newKeyword as SyntaxToken) As ArrayCreationExpressionSyntax return Update(newKeyword, Me.AttributeLists, Me.Type, Me.ArrayBounds, Me.RankSpecifiers, Me.Initializer) End Function ''' <summary> ''' A list of all attribute lists on the type. If no attributes were specified, an ''' empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRed(_attributeLists, 1) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As NewExpressionSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As ArrayCreationExpressionSyntax return Update(Me.NewKeyword, attributeLists, Me.Type, Me.ArrayBounds, Me.RankSpecifiers, Me.Initializer) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As ArrayCreationExpressionSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As NewExpressionSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' The element type of the array being created. ''' </summary> Public ReadOnly Property Type As TypeSyntax Get Return GetRed(_type, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithType(type as TypeSyntax) As ArrayCreationExpressionSyntax return Update(Me.NewKeyword, Me.AttributeLists, type, Me.ArrayBounds, Me.RankSpecifiers, Me.Initializer) End Function ''' <summary> ''' The optional array bounds, such as "(4)" or "(0 to 5, 0 To 6)". ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ArrayBounds As ArgumentListSyntax Get Return GetRed(_arrayBounds, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the ArrayBounds property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArrayBounds(arrayBounds as ArgumentListSyntax) As ArrayCreationExpressionSyntax return Update(Me.NewKeyword, Me.AttributeLists, Me.Type, arrayBounds, Me.RankSpecifiers, Me.Initializer) End Function Public Shadows Function AddArrayBoundsArguments(ParamArray items As ArgumentSyntax()) As ArrayCreationExpressionSyntax Dim _child = If(Me.ArrayBounds IsNot Nothing, Me.ArrayBounds, SyntaxFactory.ArgumentList()) Return Me.WithArrayBounds(_child.AddArguments(items)) End Function ''' <summary> ''' A list of array modifiers such as "()" or "(,)". If no array modifiers were ''' present, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property RankSpecifiers As SyntaxList(Of ArrayRankSpecifierSyntax) Get Dim listNode = GetRed(_rankSpecifiers, 4) Return new SyntaxList(Of ArrayRankSpecifierSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the RankSpecifiers property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithRankSpecifiers(rankSpecifiers as SyntaxList(Of ArrayRankSpecifierSyntax)) As ArrayCreationExpressionSyntax return Update(Me.NewKeyword, Me.AttributeLists, Me.Type, Me.ArrayBounds, rankSpecifiers, Me.Initializer) End Function Public Shadows Function AddRankSpecifiers(ParamArray items As ArrayRankSpecifierSyntax()) As ArrayCreationExpressionSyntax Return Me.WithRankSpecifiers(Me.RankSpecifiers.AddRange(items)) End Function ''' <summary> ''' The initializer including the braces. ''' </summary> Public ReadOnly Property Initializer As CollectionInitializerSyntax Get Return GetRed(_initializer, 5) End Get End Property ''' <summary> ''' Returns a copy of this with the Initializer property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInitializer(initializer as CollectionInitializerSyntax) As ArrayCreationExpressionSyntax return Update(Me.NewKeyword, Me.AttributeLists, Me.Type, Me.ArrayBounds, Me.RankSpecifiers, initializer) End Function Public Shadows Function AddInitializerInitializers(ParamArray items As ExpressionSyntax()) As ArrayCreationExpressionSyntax Dim _child = If(Me.Initializer IsNot Nothing, Me.Initializer, SyntaxFactory.CollectionInitializer()) Return Me.WithInitializer(_child.AddInitializers(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._attributeLists Case 2 Return Me._type Case 3 Return Me._arrayBounds Case 4 Return Me._rankSpecifiers Case 5 Return Me._initializer Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_attributeLists, 1) Case 2 Return Me.Type Case 3 Return Me.ArrayBounds Case 4 Return GetRed(_rankSpecifiers, 4) Case 5 Return Me.Initializer Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitArrayCreationExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitArrayCreationExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="newKeyword"> ''' The value for the NewKeyword property. ''' </param> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="type"> ''' The value for the Type property. ''' </param> ''' <param name="arrayBounds"> ''' The value for the ArrayBounds property. ''' </param> ''' <param name="rankSpecifiers"> ''' The value for the RankSpecifiers property. ''' </param> ''' <param name="initializer"> ''' The value for the Initializer property. ''' </param> Public Function Update(newKeyword As SyntaxToken, attributeLists As SyntaxList(of AttributeListSyntax), type As TypeSyntax, arrayBounds As ArgumentListSyntax, rankSpecifiers As SyntaxList(of ArrayRankSpecifierSyntax), initializer As CollectionInitializerSyntax) As ArrayCreationExpressionSyntax If newKeyword <> Me.NewKeyword OrElse attributeLists <> Me.AttributeLists OrElse type IsNot Me.Type OrElse arrayBounds IsNot Me.ArrayBounds OrElse rankSpecifiers <> Me.RankSpecifiers OrElse initializer IsNot Me.Initializer Then Dim newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, attributeLists, type, arrayBounds, rankSpecifiers, initializer) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an expression that creates a new array without naming the element ''' type. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CollectionInitializer"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CollectionInitializerSyntax Inherits ExpressionSyntax Friend _initializers as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), openBraceToken As InternalSyntax.PunctuationSyntax, initializers As SyntaxNode, closeBraceToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CollectionInitializerSyntax(kind, errors, annotations, openBraceToken, if(initializers IsNot Nothing, initializers.Green, Nothing), closeBraceToken), Nothing, 0) End Sub ''' <summary> ''' The "{" token. ''' </summary> Public ReadOnly Property OpenBraceToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CollectionInitializerSyntax)._openBraceToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenBraceToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenBraceToken(openBraceToken as SyntaxToken) As CollectionInitializerSyntax return Update(openBraceToken, Me.Initializers, Me.CloseBraceToken) End Function ''' <summary> ''' The list of initializers between the braces. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Initializers As SeparatedSyntaxList(Of ExpressionSyntax) Get Dim listNode = GetRed(_initializers, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ExpressionSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Initializers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInitializers(initializers as SeparatedSyntaxList(Of ExpressionSyntax)) As CollectionInitializerSyntax return Update(Me.OpenBraceToken, initializers, Me.CloseBraceToken) End Function Public Shadows Function AddInitializers(ParamArray items As ExpressionSyntax()) As CollectionInitializerSyntax Return Me.WithInitializers(Me.Initializers.AddRange(items)) End Function ''' <summary> ''' The "}" token. ''' </summary> Public ReadOnly Property CloseBraceToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CollectionInitializerSyntax)._closeBraceToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseBraceToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseBraceToken(closeBraceToken as SyntaxToken) As CollectionInitializerSyntax return Update(Me.OpenBraceToken, Me.Initializers, closeBraceToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._initializers Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_initializers, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCollectionInitializer(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCollectionInitializer(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="openBraceToken"> ''' The value for the OpenBraceToken property. ''' </param> ''' <param name="initializers"> ''' The value for the Initializers property. ''' </param> ''' <param name="closeBraceToken"> ''' The value for the CloseBraceToken property. ''' </param> Public Function Update(openBraceToken As SyntaxToken, initializers As SeparatedSyntaxList(Of ExpressionSyntax), closeBraceToken As SyntaxToken) As CollectionInitializerSyntax If openBraceToken <> Me.OpenBraceToken OrElse initializers <> Me.Initializers OrElse closeBraceToken <> Me.CloseBraceToken Then Dim newNode = SyntaxFactory.CollectionInitializer(openBraceToken, initializers, closeBraceToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a CType, DirectCast or TryCast conversion expression. The Kind ''' property determines which kind of cast it is. ''' </summary> Public MustInherit Class CastExpressionSyntax Inherits ExpressionSyntax Friend _expression as ExpressionSyntax Friend _type as TypeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The "CType", "DirectCast" or "TryCast" keyword. ''' </summary> Public ReadOnly Property Keyword As SyntaxToken Get Return Me.GetKeywordCore() End Get End Property Friend Overridable Function GetKeywordCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CastExpressionSyntax)._keyword, Me.Position, 0) End Function ''' <summary> ''' Returns a copy of this with the Keyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithKeyword(keyword As SyntaxToken) As CastExpressionSyntax Return WithKeywordCore(keyword) End Function Friend MustOverride Function WithKeywordCore(keyword As SyntaxToken) As CastExpressionSyntax ''' <summary> ''' The "(" token. ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get Return Me.GetOpenParenTokenCore() End Get End Property Friend Overridable Function GetOpenParenTokenCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CastExpressionSyntax)._openParenToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Function ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Function WithOpenParenToken(openParenToken As SyntaxToken) As CastExpressionSyntax Return WithOpenParenTokenCore(openParenToken) End Function Friend MustOverride Function WithOpenParenTokenCore(openParenToken As SyntaxToken) As CastExpressionSyntax ''' <summary> ''' The expression being cast. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return Me.GetExpressionCore() End Get End Property Friend Overridable Function GetExpressionCore() As ExpressionSyntax Return GetRed(_expression, 2) End Function ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithExpression(expression As ExpressionSyntax) As CastExpressionSyntax Return WithExpressionCore(expression) End Function Friend MustOverride Function WithExpressionCore(expression As ExpressionSyntax) As CastExpressionSyntax ''' <summary> ''' The "," token. ''' </summary> Public ReadOnly Property CommaToken As SyntaxToken Get Return Me.GetCommaTokenCore() End Get End Property Friend Overridable Function GetCommaTokenCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CastExpressionSyntax)._commaToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Function ''' <summary> ''' Returns a copy of this with the CommaToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithCommaToken(commaToken As SyntaxToken) As CastExpressionSyntax Return WithCommaTokenCore(commaToken) End Function Friend MustOverride Function WithCommaTokenCore(commaToken As SyntaxToken) As CastExpressionSyntax ''' <summary> ''' The type the expression is being cast to. ''' </summary> Public ReadOnly Property Type As TypeSyntax Get Return Me.GetTypeCore() End Get End Property Friend Overridable Function GetTypeCore() As TypeSyntax Return GetRed(_type, 4) End Function ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Function WithType(type As TypeSyntax) As CastExpressionSyntax Return WithTypeCore(type) End Function Friend MustOverride Function WithTypeCore(type As TypeSyntax) As CastExpressionSyntax ''' <summary> ''' The ")" token. ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get Return Me.GetCloseParenTokenCore() End Get End Property Friend Overridable Function GetCloseParenTokenCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CastExpressionSyntax)._closeParenToken, Me.GetChildPosition(5), Me.GetChildIndex(5)) End Function ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Function WithCloseParenToken(closeParenToken As SyntaxToken) As CastExpressionSyntax Return WithCloseParenTokenCore(closeParenToken) End Function Friend MustOverride Function WithCloseParenTokenCore(closeParenToken As SyntaxToken) As CastExpressionSyntax End Class ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CTypeExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CTypeExpressionSyntax Inherits CastExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), keyword As InternalSyntax.KeywordSyntax, openParenToken As InternalSyntax.PunctuationSyntax, expression As ExpressionSyntax, commaToken As InternalSyntax.PunctuationSyntax, type As TypeSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CTypeExpressionSyntax(kind, errors, annotations, keyword, openParenToken, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), commaToken, DirectCast(type.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "CType", "DirectCast" or "TryCast" keyword. ''' </summary> Public Shadows ReadOnly Property Keyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CTypeExpressionSyntax)._keyword, Me.Position, 0) End Get End Property Friend Overrides Function GetKeywordCore() As SyntaxToken Return Me.Keyword End Function Friend Overrides Function WithKeywordCore(keyword As SyntaxToken) As CastExpressionSyntax Return WithKeyword(keyword) End Function ''' <summary> ''' Returns a copy of this with the Keyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithKeyword(keyword as SyntaxToken) As CTypeExpressionSyntax return Update(keyword, Me.OpenParenToken, Me.Expression, Me.CommaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The "(" token. ''' </summary> Public Shadows ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CTypeExpressionSyntax)._openParenToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property Friend Overrides Function GetOpenParenTokenCore() As SyntaxToken Return Me.OpenParenToken End Function Friend Overrides Function WithOpenParenTokenCore(openParenToken As SyntaxToken) As CastExpressionSyntax Return WithOpenParenToken(openParenToken) End Function ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As CTypeExpressionSyntax return Update(Me.Keyword, openParenToken, Me.Expression, Me.CommaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The expression being cast. ''' </summary> Public Shadows ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 2) End Get End Property Friend Overrides Function GetExpressionCore() As ExpressionSyntax Return Me.Expression End Function Friend Overrides Function WithExpressionCore(expression As ExpressionSyntax) As CastExpressionSyntax Return WithExpression(expression) End Function ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As CTypeExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, expression, Me.CommaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The "," token. ''' </summary> Public Shadows ReadOnly Property CommaToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CTypeExpressionSyntax)._commaToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property Friend Overrides Function GetCommaTokenCore() As SyntaxToken Return Me.CommaToken End Function Friend Overrides Function WithCommaTokenCore(commaToken As SyntaxToken) As CastExpressionSyntax Return WithCommaToken(commaToken) End Function ''' <summary> ''' Returns a copy of this with the CommaToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCommaToken(commaToken as SyntaxToken) As CTypeExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, Me.Expression, commaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The type the expression is being cast to. ''' </summary> Public Shadows ReadOnly Property Type As TypeSyntax Get Return GetRed(_type, 4) End Get End Property Friend Overrides Function GetTypeCore() As TypeSyntax Return Me.Type End Function Friend Overrides Function WithTypeCore(type As TypeSyntax) As CastExpressionSyntax Return WithType(type) End Function ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithType(type as TypeSyntax) As CTypeExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, Me.Expression, Me.CommaToken, type, Me.CloseParenToken) End Function ''' <summary> ''' The ")" token. ''' </summary> Public Shadows ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CTypeExpressionSyntax)._closeParenToken, Me.GetChildPosition(5), Me.GetChildIndex(5)) End Get End Property Friend Overrides Function GetCloseParenTokenCore() As SyntaxToken Return Me.CloseParenToken End Function Friend Overrides Function WithCloseParenTokenCore(closeParenToken As SyntaxToken) As CastExpressionSyntax Return WithCloseParenToken(closeParenToken) End Function ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As CTypeExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, Me.Expression, Me.CommaToken, Me.Type, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._expression Case 4 Return Me._type Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Expression Case 4 Return Me.Type Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCTypeExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCTypeExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="keyword"> ''' The value for the Keyword property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="commaToken"> ''' The value for the CommaToken property. ''' </param> ''' <param name="type"> ''' The value for the Type property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(keyword As SyntaxToken, openParenToken As SyntaxToken, expression As ExpressionSyntax, commaToken As SyntaxToken, type As TypeSyntax, closeParenToken As SyntaxToken) As CTypeExpressionSyntax If keyword <> Me.Keyword OrElse openParenToken <> Me.OpenParenToken OrElse expression IsNot Me.Expression OrElse commaToken <> Me.CommaToken OrElse type IsNot Me.Type OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.CTypeExpression(keyword, openParenToken, expression, commaToken, type, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.DirectCastExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class DirectCastExpressionSyntax Inherits CastExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), keyword As InternalSyntax.KeywordSyntax, openParenToken As InternalSyntax.PunctuationSyntax, expression As ExpressionSyntax, commaToken As InternalSyntax.PunctuationSyntax, type As TypeSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DirectCastExpressionSyntax(kind, errors, annotations, keyword, openParenToken, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), commaToken, DirectCast(type.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "CType", "DirectCast" or "TryCast" keyword. ''' </summary> Public Shadows ReadOnly Property Keyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DirectCastExpressionSyntax)._keyword, Me.Position, 0) End Get End Property Friend Overrides Function GetKeywordCore() As SyntaxToken Return Me.Keyword End Function Friend Overrides Function WithKeywordCore(keyword As SyntaxToken) As CastExpressionSyntax Return WithKeyword(keyword) End Function ''' <summary> ''' Returns a copy of this with the Keyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithKeyword(keyword as SyntaxToken) As DirectCastExpressionSyntax return Update(keyword, Me.OpenParenToken, Me.Expression, Me.CommaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The "(" token. ''' </summary> Public Shadows ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DirectCastExpressionSyntax)._openParenToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property Friend Overrides Function GetOpenParenTokenCore() As SyntaxToken Return Me.OpenParenToken End Function Friend Overrides Function WithOpenParenTokenCore(openParenToken As SyntaxToken) As CastExpressionSyntax Return WithOpenParenToken(openParenToken) End Function ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As DirectCastExpressionSyntax return Update(Me.Keyword, openParenToken, Me.Expression, Me.CommaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The expression being cast. ''' </summary> Public Shadows ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 2) End Get End Property Friend Overrides Function GetExpressionCore() As ExpressionSyntax Return Me.Expression End Function Friend Overrides Function WithExpressionCore(expression As ExpressionSyntax) As CastExpressionSyntax Return WithExpression(expression) End Function ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As DirectCastExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, expression, Me.CommaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The "," token. ''' </summary> Public Shadows ReadOnly Property CommaToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DirectCastExpressionSyntax)._commaToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property Friend Overrides Function GetCommaTokenCore() As SyntaxToken Return Me.CommaToken End Function Friend Overrides Function WithCommaTokenCore(commaToken As SyntaxToken) As CastExpressionSyntax Return WithCommaToken(commaToken) End Function ''' <summary> ''' Returns a copy of this with the CommaToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCommaToken(commaToken as SyntaxToken) As DirectCastExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, Me.Expression, commaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The type the expression is being cast to. ''' </summary> Public Shadows ReadOnly Property Type As TypeSyntax Get Return GetRed(_type, 4) End Get End Property Friend Overrides Function GetTypeCore() As TypeSyntax Return Me.Type End Function Friend Overrides Function WithTypeCore(type As TypeSyntax) As CastExpressionSyntax Return WithType(type) End Function ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithType(type as TypeSyntax) As DirectCastExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, Me.Expression, Me.CommaToken, type, Me.CloseParenToken) End Function ''' <summary> ''' The ")" token. ''' </summary> Public Shadows ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DirectCastExpressionSyntax)._closeParenToken, Me.GetChildPosition(5), Me.GetChildIndex(5)) End Get End Property Friend Overrides Function GetCloseParenTokenCore() As SyntaxToken Return Me.CloseParenToken End Function Friend Overrides Function WithCloseParenTokenCore(closeParenToken As SyntaxToken) As CastExpressionSyntax Return WithCloseParenToken(closeParenToken) End Function ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As DirectCastExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, Me.Expression, Me.CommaToken, Me.Type, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._expression Case 4 Return Me._type Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Expression Case 4 Return Me.Type Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitDirectCastExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitDirectCastExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="keyword"> ''' The value for the Keyword property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="commaToken"> ''' The value for the CommaToken property. ''' </param> ''' <param name="type"> ''' The value for the Type property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(keyword As SyntaxToken, openParenToken As SyntaxToken, expression As ExpressionSyntax, commaToken As SyntaxToken, type As TypeSyntax, closeParenToken As SyntaxToken) As DirectCastExpressionSyntax If keyword <> Me.Keyword OrElse openParenToken <> Me.OpenParenToken OrElse expression IsNot Me.Expression OrElse commaToken <> Me.CommaToken OrElse type IsNot Me.Type OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.DirectCastExpression(keyword, openParenToken, expression, commaToken, type, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TryCastExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TryCastExpressionSyntax Inherits CastExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), keyword As InternalSyntax.KeywordSyntax, openParenToken As InternalSyntax.PunctuationSyntax, expression As ExpressionSyntax, commaToken As InternalSyntax.PunctuationSyntax, type As TypeSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TryCastExpressionSyntax(kind, errors, annotations, keyword, openParenToken, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), commaToken, DirectCast(type.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "CType", "DirectCast" or "TryCast" keyword. ''' </summary> Public Shadows ReadOnly Property Keyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TryCastExpressionSyntax)._keyword, Me.Position, 0) End Get End Property Friend Overrides Function GetKeywordCore() As SyntaxToken Return Me.Keyword End Function Friend Overrides Function WithKeywordCore(keyword As SyntaxToken) As CastExpressionSyntax Return WithKeyword(keyword) End Function ''' <summary> ''' Returns a copy of this with the Keyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithKeyword(keyword as SyntaxToken) As TryCastExpressionSyntax return Update(keyword, Me.OpenParenToken, Me.Expression, Me.CommaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The "(" token. ''' </summary> Public Shadows ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TryCastExpressionSyntax)._openParenToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property Friend Overrides Function GetOpenParenTokenCore() As SyntaxToken Return Me.OpenParenToken End Function Friend Overrides Function WithOpenParenTokenCore(openParenToken As SyntaxToken) As CastExpressionSyntax Return WithOpenParenToken(openParenToken) End Function ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As TryCastExpressionSyntax return Update(Me.Keyword, openParenToken, Me.Expression, Me.CommaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The expression being cast. ''' </summary> Public Shadows ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 2) End Get End Property Friend Overrides Function GetExpressionCore() As ExpressionSyntax Return Me.Expression End Function Friend Overrides Function WithExpressionCore(expression As ExpressionSyntax) As CastExpressionSyntax Return WithExpression(expression) End Function ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As TryCastExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, expression, Me.CommaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The "," token. ''' </summary> Public Shadows ReadOnly Property CommaToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TryCastExpressionSyntax)._commaToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property Friend Overrides Function GetCommaTokenCore() As SyntaxToken Return Me.CommaToken End Function Friend Overrides Function WithCommaTokenCore(commaToken As SyntaxToken) As CastExpressionSyntax Return WithCommaToken(commaToken) End Function ''' <summary> ''' Returns a copy of this with the CommaToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCommaToken(commaToken as SyntaxToken) As TryCastExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, Me.Expression, commaToken, Me.Type, Me.CloseParenToken) End Function ''' <summary> ''' The type the expression is being cast to. ''' </summary> Public Shadows ReadOnly Property Type As TypeSyntax Get Return GetRed(_type, 4) End Get End Property Friend Overrides Function GetTypeCore() As TypeSyntax Return Me.Type End Function Friend Overrides Function WithTypeCore(type As TypeSyntax) As CastExpressionSyntax Return WithType(type) End Function ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithType(type as TypeSyntax) As TryCastExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, Me.Expression, Me.CommaToken, type, Me.CloseParenToken) End Function ''' <summary> ''' The ")" token. ''' </summary> Public Shadows ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TryCastExpressionSyntax)._closeParenToken, Me.GetChildPosition(5), Me.GetChildIndex(5)) End Get End Property Friend Overrides Function GetCloseParenTokenCore() As SyntaxToken Return Me.CloseParenToken End Function Friend Overrides Function WithCloseParenTokenCore(closeParenToken As SyntaxToken) As CastExpressionSyntax Return WithCloseParenToken(closeParenToken) End Function ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As TryCastExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, Me.Expression, Me.CommaToken, Me.Type, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._expression Case 4 Return Me._type Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Expression Case 4 Return Me.Type Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTryCastExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTryCastExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="keyword"> ''' The value for the Keyword property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="commaToken"> ''' The value for the CommaToken property. ''' </param> ''' <param name="type"> ''' The value for the Type property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(keyword As SyntaxToken, openParenToken As SyntaxToken, expression As ExpressionSyntax, commaToken As SyntaxToken, type As TypeSyntax, closeParenToken As SyntaxToken) As TryCastExpressionSyntax If keyword <> Me.Keyword OrElse openParenToken <> Me.OpenParenToken OrElse expression IsNot Me.Expression OrElse commaToken <> Me.CommaToken OrElse type IsNot Me.Type OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.TryCastExpression(keyword, openParenToken, expression, commaToken, type, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a cast to a pre-defined type using a pre-defined cast expression, ''' such as CInt or CLng. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.PredefinedCastExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class PredefinedCastExpressionSyntax Inherits ExpressionSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), keyword As InternalSyntax.KeywordSyntax, openParenToken As InternalSyntax.PunctuationSyntax, expression As ExpressionSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PredefinedCastExpressionSyntax(kind, errors, annotations, keyword, openParenToken, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The keyword that was used in the cast operation. ''' </summary> Public ReadOnly Property Keyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PredefinedCastExpressionSyntax)._keyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Keyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithKeyword(keyword as SyntaxToken) As PredefinedCastExpressionSyntax return Update(keyword, Me.OpenParenToken, Me.Expression, Me.CloseParenToken) End Function ''' <summary> ''' The "(" token. ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PredefinedCastExpressionSyntax)._openParenToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As PredefinedCastExpressionSyntax return Update(Me.Keyword, openParenToken, Me.Expression, Me.CloseParenToken) End Function ''' <summary> ''' The expression being cast. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As PredefinedCastExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, expression, Me.CloseParenToken) End Function ''' <summary> ''' The ")" token. ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PredefinedCastExpressionSyntax)._closeParenToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As PredefinedCastExpressionSyntax return Update(Me.Keyword, Me.OpenParenToken, Me.Expression, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitPredefinedCastExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitPredefinedCastExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="keyword"> ''' The value for the Keyword property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(keyword As SyntaxToken, openParenToken As SyntaxToken, expression As ExpressionSyntax, closeParenToken As SyntaxToken) As PredefinedCastExpressionSyntax If keyword <> Me.Keyword OrElse openParenToken <> Me.OpenParenToken OrElse expression IsNot Me.Expression OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.PredefinedCastExpression(keyword, openParenToken, expression, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a binary operator. The Kind property classifies the operators into ''' similar kind of operators (arithmetic, relational, logical or string); the ''' exact operation being performed is determined by the Operator property. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.AddExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.SubtractExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.MultiplyExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.DivideExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.IntegerDivideExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.ExponentiateExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.LeftShiftExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.RightShiftExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.ConcatenateExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.ModuloExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.EqualsExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.NotEqualsExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.LessThanExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.LessThanOrEqualExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.GreaterThanOrEqualExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.GreaterThanExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.IsExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.IsNotExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.LikeExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.OrExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.ExclusiveOrExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.AndExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.OrElseExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.AndAlsoExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class BinaryExpressionSyntax Inherits ExpressionSyntax Friend _left as ExpressionSyntax Friend _right as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), left As ExpressionSyntax, operatorToken As InternalSyntax.SyntaxToken, right As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.BinaryExpressionSyntax(kind, errors, annotations, DirectCast(left.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), operatorToken, DirectCast(right.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The left operand. ''' </summary> Public ReadOnly Property Left As ExpressionSyntax Get Return GetRedAtZero(_left) End Get End Property ''' <summary> ''' Returns a copy of this with the Left property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithLeft(left as ExpressionSyntax) As BinaryExpressionSyntax return Update(Me.Kind, left, Me.OperatorToken, Me.Right) End Function Public ReadOnly Property OperatorToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.BinaryExpressionSyntax)._operatorToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OperatorToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOperatorToken(operatorToken as SyntaxToken) As BinaryExpressionSyntax return Update(Me.Kind, Me.Left, operatorToken, Me.Right) End Function ''' <summary> ''' The right operand. ''' </summary> Public ReadOnly Property Right As ExpressionSyntax Get Return GetRed(_right, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Right property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithRight(right as ExpressionSyntax) As BinaryExpressionSyntax return Update(Me.Kind, Me.Left, Me.OperatorToken, right) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._left Case 2 Return Me._right Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Left Case 2 Return Me.Right Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitBinaryExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitBinaryExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="left"> ''' The value for the Left property. ''' </param> ''' <param name="operatorToken"> ''' The value for the OperatorToken property. ''' </param> ''' <param name="right"> ''' The value for the Right property. ''' </param> Public Function Update(kind As SyntaxKind, left As ExpressionSyntax, operatorToken As SyntaxToken, right As ExpressionSyntax) As BinaryExpressionSyntax If kind <> Me.Kind OrElse left IsNot Me.Left OrElse operatorToken <> Me.OperatorToken OrElse right IsNot Me.Right Then Dim newNode = SyntaxFactory.BinaryExpression(kind, left, operatorToken, right) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Describes a unary operator: Plus, Negate, Not or AddressOf. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.UnaryPlusExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.UnaryMinusExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.NotExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.AddressOfExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class UnaryExpressionSyntax Inherits ExpressionSyntax Friend _operand as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), operatorToken As InternalSyntax.SyntaxToken, operand As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.UnaryExpressionSyntax(kind, errors, annotations, operatorToken, DirectCast(operand.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The token that is the operator. ''' </summary> Public ReadOnly Property OperatorToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.UnaryExpressionSyntax)._operatorToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OperatorToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOperatorToken(operatorToken as SyntaxToken) As UnaryExpressionSyntax return Update(Me.Kind, operatorToken, Me.Operand) End Function ''' <summary> ''' The expression being operated on. ''' </summary> Public ReadOnly Property Operand As ExpressionSyntax Get Return GetRed(_operand, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Operand property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOperand(operand as ExpressionSyntax) As UnaryExpressionSyntax return Update(Me.Kind, Me.OperatorToken, operand) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._operand Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Operand Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitUnaryExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitUnaryExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="operatorToken"> ''' The value for the OperatorToken property. ''' </param> ''' <param name="operand"> ''' The value for the Operand property. ''' </param> Public Function Update(kind As SyntaxKind, operatorToken As SyntaxToken, operand As ExpressionSyntax) As UnaryExpressionSyntax If kind <> Me.Kind OrElse operatorToken <> Me.OperatorToken OrElse operand IsNot Me.Operand Then Dim newNode = SyntaxFactory.UnaryExpression(kind, operatorToken, operand) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a conditional expression, If(condition, true-expr, false-expr) or ''' If(expr, nothing-expr). ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.BinaryConditionalExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class BinaryConditionalExpressionSyntax Inherits ExpressionSyntax Friend _firstExpression as ExpressionSyntax Friend _secondExpression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), ifKeyword As InternalSyntax.KeywordSyntax, openParenToken As InternalSyntax.PunctuationSyntax, firstExpression As ExpressionSyntax, commaToken As InternalSyntax.PunctuationSyntax, secondExpression As ExpressionSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.BinaryConditionalExpressionSyntax(kind, errors, annotations, ifKeyword, openParenToken, DirectCast(firstExpression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), commaToken, DirectCast(secondExpression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "If" keyword ''' </summary> Public ReadOnly Property IfKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.BinaryConditionalExpressionSyntax)._ifKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the IfKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIfKeyword(ifKeyword as SyntaxToken) As BinaryConditionalExpressionSyntax return Update(ifKeyword, Me.OpenParenToken, Me.FirstExpression, Me.CommaToken, Me.SecondExpression, Me.CloseParenToken) End Function ''' <summary> ''' The "(" token ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.BinaryConditionalExpressionSyntax)._openParenToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As BinaryConditionalExpressionSyntax return Update(Me.IfKeyword, openParenToken, Me.FirstExpression, Me.CommaToken, Me.SecondExpression, Me.CloseParenToken) End Function ''' <summary> ''' The first expression inside the parentheses. ''' </summary> Public ReadOnly Property FirstExpression As ExpressionSyntax Get Return GetRed(_firstExpression, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the FirstExpression property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithFirstExpression(firstExpression as ExpressionSyntax) As BinaryConditionalExpressionSyntax return Update(Me.IfKeyword, Me.OpenParenToken, firstExpression, Me.CommaToken, Me.SecondExpression, Me.CloseParenToken) End Function ''' <summary> ''' The "," token. ''' </summary> Public ReadOnly Property CommaToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.BinaryConditionalExpressionSyntax)._commaToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the CommaToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCommaToken(commaToken as SyntaxToken) As BinaryConditionalExpressionSyntax return Update(Me.IfKeyword, Me.OpenParenToken, Me.FirstExpression, commaToken, Me.SecondExpression, Me.CloseParenToken) End Function ''' <summary> ''' The second expression inside the parentheses. ''' </summary> Public ReadOnly Property SecondExpression As ExpressionSyntax Get Return GetRed(_secondExpression, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the SecondExpression property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSecondExpression(secondExpression as ExpressionSyntax) As BinaryConditionalExpressionSyntax return Update(Me.IfKeyword, Me.OpenParenToken, Me.FirstExpression, Me.CommaToken, secondExpression, Me.CloseParenToken) End Function ''' <summary> ''' The ")" token ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.BinaryConditionalExpressionSyntax)._closeParenToken, Me.GetChildPosition(5), Me.GetChildIndex(5)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As BinaryConditionalExpressionSyntax return Update(Me.IfKeyword, Me.OpenParenToken, Me.FirstExpression, Me.CommaToken, Me.SecondExpression, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._firstExpression Case 4 Return Me._secondExpression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.FirstExpression Case 4 Return Me.SecondExpression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitBinaryConditionalExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitBinaryConditionalExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="ifKeyword"> ''' The value for the IfKeyword property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="firstExpression"> ''' The value for the FirstExpression property. ''' </param> ''' <param name="commaToken"> ''' The value for the CommaToken property. ''' </param> ''' <param name="secondExpression"> ''' The value for the SecondExpression property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(ifKeyword As SyntaxToken, openParenToken As SyntaxToken, firstExpression As ExpressionSyntax, commaToken As SyntaxToken, secondExpression As ExpressionSyntax, closeParenToken As SyntaxToken) As BinaryConditionalExpressionSyntax If ifKeyword <> Me.IfKeyword OrElse openParenToken <> Me.OpenParenToken OrElse firstExpression IsNot Me.FirstExpression OrElse commaToken <> Me.CommaToken OrElse secondExpression IsNot Me.SecondExpression OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.BinaryConditionalExpression(ifKeyword, openParenToken, firstExpression, commaToken, secondExpression, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a conditional expression, If(condition, true-expr, false-expr) or ''' If(expr, nothing-expr). ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TernaryConditionalExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TernaryConditionalExpressionSyntax Inherits ExpressionSyntax Friend _condition as ExpressionSyntax Friend _whenTrue as ExpressionSyntax Friend _whenFalse as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), ifKeyword As InternalSyntax.KeywordSyntax, openParenToken As InternalSyntax.PunctuationSyntax, condition As ExpressionSyntax, firstCommaToken As InternalSyntax.PunctuationSyntax, whenTrue As ExpressionSyntax, secondCommaToken As InternalSyntax.PunctuationSyntax, whenFalse As ExpressionSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TernaryConditionalExpressionSyntax(kind, errors, annotations, ifKeyword, openParenToken, DirectCast(condition.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), firstCommaToken, DirectCast(whenTrue.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), secondCommaToken, DirectCast(whenFalse.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "If" keyword ''' </summary> Public ReadOnly Property IfKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TernaryConditionalExpressionSyntax)._ifKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the IfKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIfKeyword(ifKeyword as SyntaxToken) As TernaryConditionalExpressionSyntax return Update(ifKeyword, Me.OpenParenToken, Me.Condition, Me.FirstCommaToken, Me.WhenTrue, Me.SecondCommaToken, Me.WhenFalse, Me.CloseParenToken) End Function ''' <summary> ''' The "(" token ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TernaryConditionalExpressionSyntax)._openParenToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As TernaryConditionalExpressionSyntax return Update(Me.IfKeyword, openParenToken, Me.Condition, Me.FirstCommaToken, Me.WhenTrue, Me.SecondCommaToken, Me.WhenFalse, Me.CloseParenToken) End Function ''' <summary> ''' The first expression inside the parentheses. ''' </summary> Public ReadOnly Property Condition As ExpressionSyntax Get Return GetRed(_condition, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Condition property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCondition(condition as ExpressionSyntax) As TernaryConditionalExpressionSyntax return Update(Me.IfKeyword, Me.OpenParenToken, condition, Me.FirstCommaToken, Me.WhenTrue, Me.SecondCommaToken, Me.WhenFalse, Me.CloseParenToken) End Function ''' <summary> ''' The "," token. ''' </summary> Public ReadOnly Property FirstCommaToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TernaryConditionalExpressionSyntax)._firstCommaToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the FirstCommaToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithFirstCommaToken(firstCommaToken as SyntaxToken) As TernaryConditionalExpressionSyntax return Update(Me.IfKeyword, Me.OpenParenToken, Me.Condition, firstCommaToken, Me.WhenTrue, Me.SecondCommaToken, Me.WhenFalse, Me.CloseParenToken) End Function ''' <summary> ''' The second expression inside the parentheses. ''' </summary> Public ReadOnly Property WhenTrue As ExpressionSyntax Get Return GetRed(_whenTrue, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the WhenTrue property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithWhenTrue(whenTrue as ExpressionSyntax) As TernaryConditionalExpressionSyntax return Update(Me.IfKeyword, Me.OpenParenToken, Me.Condition, Me.FirstCommaToken, whenTrue, Me.SecondCommaToken, Me.WhenFalse, Me.CloseParenToken) End Function ''' <summary> ''' The "," token. ''' </summary> Public ReadOnly Property SecondCommaToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TernaryConditionalExpressionSyntax)._secondCommaToken, Me.GetChildPosition(5), Me.GetChildIndex(5)) End Get End Property ''' <summary> ''' Returns a copy of this with the SecondCommaToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSecondCommaToken(secondCommaToken as SyntaxToken) As TernaryConditionalExpressionSyntax return Update(Me.IfKeyword, Me.OpenParenToken, Me.Condition, Me.FirstCommaToken, Me.WhenTrue, secondCommaToken, Me.WhenFalse, Me.CloseParenToken) End Function ''' <summary> ''' The second expression inside the parentheses. ''' </summary> Public ReadOnly Property WhenFalse As ExpressionSyntax Get Return GetRed(_whenFalse, 6) End Get End Property ''' <summary> ''' Returns a copy of this with the WhenFalse property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithWhenFalse(whenFalse as ExpressionSyntax) As TernaryConditionalExpressionSyntax return Update(Me.IfKeyword, Me.OpenParenToken, Me.Condition, Me.FirstCommaToken, Me.WhenTrue, Me.SecondCommaToken, whenFalse, Me.CloseParenToken) End Function ''' <summary> ''' The ")" token ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TernaryConditionalExpressionSyntax)._closeParenToken, Me.GetChildPosition(7), Me.GetChildIndex(7)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As TernaryConditionalExpressionSyntax return Update(Me.IfKeyword, Me.OpenParenToken, Me.Condition, Me.FirstCommaToken, Me.WhenTrue, Me.SecondCommaToken, Me.WhenFalse, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._condition Case 4 Return Me._whenTrue Case 6 Return Me._whenFalse Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Condition Case 4 Return Me.WhenTrue Case 6 Return Me.WhenFalse Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTernaryConditionalExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTernaryConditionalExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="ifKeyword"> ''' The value for the IfKeyword property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="condition"> ''' The value for the Condition property. ''' </param> ''' <param name="firstCommaToken"> ''' The value for the FirstCommaToken property. ''' </param> ''' <param name="whenTrue"> ''' The value for the WhenTrue property. ''' </param> ''' <param name="secondCommaToken"> ''' The value for the SecondCommaToken property. ''' </param> ''' <param name="whenFalse"> ''' The value for the WhenFalse property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(ifKeyword As SyntaxToken, openParenToken As SyntaxToken, condition As ExpressionSyntax, firstCommaToken As SyntaxToken, whenTrue As ExpressionSyntax, secondCommaToken As SyntaxToken, whenFalse As ExpressionSyntax, closeParenToken As SyntaxToken) As TernaryConditionalExpressionSyntax If ifKeyword <> Me.IfKeyword OrElse openParenToken <> Me.OpenParenToken OrElse condition IsNot Me.Condition OrElse firstCommaToken <> Me.FirstCommaToken OrElse whenTrue IsNot Me.WhenTrue OrElse secondCommaToken <> Me.SecondCommaToken OrElse whenFalse IsNot Me.WhenFalse OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.TernaryConditionalExpression(ifKeyword, openParenToken, condition, firstCommaToken, whenTrue, secondCommaToken, whenFalse, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a lambda expression, either single line or multi-line. ''' </summary> Public MustInherit Class LambdaExpressionSyntax Inherits ExpressionSyntax Friend _subOrFunctionHeader as LambdaHeaderSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The header part of the lambda that includes the "Sub" or "Function" keyword, ''' the argument list and return type. ''' </summary> Public ReadOnly Property SubOrFunctionHeader As LambdaHeaderSyntax Get Return Me.GetSubOrFunctionHeaderCore() End Get End Property Friend Overridable Function GetSubOrFunctionHeaderCore() As LambdaHeaderSyntax Return GetRedAtZero(_subOrFunctionHeader) End Function ''' <summary> ''' Returns a copy of this with the SubOrFunctionHeader property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Function WithSubOrFunctionHeader(subOrFunctionHeader As LambdaHeaderSyntax) As LambdaExpressionSyntax Return WithSubOrFunctionHeaderCore(subOrFunctionHeader) End Function Friend MustOverride Function WithSubOrFunctionHeaderCore(subOrFunctionHeader As LambdaHeaderSyntax) As LambdaExpressionSyntax End Class ''' <summary> ''' Represents a single line lambda expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SingleLineFunctionLambdaExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.SingleLineSubLambdaExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SingleLineLambdaExpressionSyntax Inherits LambdaExpressionSyntax Friend _body as VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), subOrFunctionHeader As LambdaHeaderSyntax, body As VisualBasicSyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SingleLineLambdaExpressionSyntax(kind, errors, annotations, DirectCast(subOrFunctionHeader.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LambdaHeaderSyntax), DirectCast(body.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.VisualBasicSyntaxNode)), Nothing, 0) End Sub ''' <summary> ''' The header part of the lambda that includes the "Sub" or "Function" keyword, ''' the argument list and return type. ''' </summary> Public Shadows ReadOnly Property SubOrFunctionHeader As LambdaHeaderSyntax Get Return GetRedAtZero(_subOrFunctionHeader) End Get End Property Friend Overrides Function GetSubOrFunctionHeaderCore() As LambdaHeaderSyntax Return Me.SubOrFunctionHeader End Function Friend Overrides Function WithSubOrFunctionHeaderCore(subOrFunctionHeader As LambdaHeaderSyntax) As LambdaExpressionSyntax Return WithSubOrFunctionHeader(subOrFunctionHeader) End Function ''' <summary> ''' Returns a copy of this with the SubOrFunctionHeader property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSubOrFunctionHeader(subOrFunctionHeader as LambdaHeaderSyntax) As SingleLineLambdaExpressionSyntax return Update(Me.Kind, subOrFunctionHeader, Me.Body) End Function ''' <summary> ''' The body of the lambda. Depending on the kind of lambda, this is either a ''' Statement (single-line Sub lambda) or Expression (single-line Function). ''' </summary> Public ReadOnly Property Body As VisualBasicSyntaxNode Get Return GetRed(_body, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Body property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithBody(body as VisualBasicSyntaxNode) As SingleLineLambdaExpressionSyntax return Update(Me.Kind, Me.SubOrFunctionHeader, body) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._subOrFunctionHeader Case 1 Return Me._body Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.SubOrFunctionHeader Case 1 Return Me.Body Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSingleLineLambdaExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSingleLineLambdaExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="subOrFunctionHeader"> ''' The value for the SubOrFunctionHeader property. ''' </param> ''' <param name="body"> ''' The value for the Body property. ''' </param> Public Function Update(kind As SyntaxKind, subOrFunctionHeader As LambdaHeaderSyntax, body As VisualBasicSyntaxNode) As SingleLineLambdaExpressionSyntax If kind <> Me.Kind OrElse subOrFunctionHeader IsNot Me.SubOrFunctionHeader OrElse body IsNot Me.Body Then Dim newNode = SyntaxFactory.SingleLineLambdaExpression(kind, subOrFunctionHeader, body) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a multi-line lambda expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.MultiLineFunctionLambdaExpression"/></description></item> ''' <item><description><see cref="SyntaxKind.MultiLineSubLambdaExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class MultiLineLambdaExpressionSyntax Inherits LambdaExpressionSyntax Friend _statements as SyntaxNode Friend _endSubOrFunctionStatement as EndBlockStatementSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), subOrFunctionHeader As LambdaHeaderSyntax, statements As SyntaxNode, endSubOrFunctionStatement As EndBlockStatementSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.MultiLineLambdaExpressionSyntax(kind, errors, annotations, DirectCast(subOrFunctionHeader.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LambdaHeaderSyntax), if(statements IsNot Nothing, statements.Green, Nothing), DirectCast(endSubOrFunctionStatement.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndBlockStatementSyntax)), Nothing, 0) End Sub ''' <summary> ''' The header part of the lambda that includes the "Sub" or "Function" keyword, ''' the argument list and return type. ''' </summary> Public Shadows ReadOnly Property SubOrFunctionHeader As LambdaHeaderSyntax Get Return GetRedAtZero(_subOrFunctionHeader) End Get End Property Friend Overrides Function GetSubOrFunctionHeaderCore() As LambdaHeaderSyntax Return Me.SubOrFunctionHeader End Function Friend Overrides Function WithSubOrFunctionHeaderCore(subOrFunctionHeader As LambdaHeaderSyntax) As LambdaExpressionSyntax Return WithSubOrFunctionHeader(subOrFunctionHeader) End Function ''' <summary> ''' Returns a copy of this with the SubOrFunctionHeader property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSubOrFunctionHeader(subOrFunctionHeader as LambdaHeaderSyntax) As MultiLineLambdaExpressionSyntax return Update(Me.Kind, subOrFunctionHeader, Me.Statements, Me.EndSubOrFunctionStatement) End Function ''' <summary> ''' The body of the lambda. Depending on the kind of lambda, this is either a ''' StatementBody (multi-line lambda), Statement (single-line Sub lambda) or ''' Expression (single-line Function). This might be an empty list. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Statements As SyntaxList(Of StatementSyntax) Get Dim listNode = GetRed(_statements, 1) Return new SyntaxList(Of StatementSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Statements property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStatements(statements as SyntaxList(Of StatementSyntax)) As MultiLineLambdaExpressionSyntax return Update(Me.Kind, Me.SubOrFunctionHeader, statements, Me.EndSubOrFunctionStatement) End Function Public Shadows Function AddStatements(ParamArray items As StatementSyntax()) As MultiLineLambdaExpressionSyntax Return Me.WithStatements(Me.Statements.AddRange(items)) End Function ''' <summary> ''' Returns the "End Sub" or "End Function" statement if this is a multi-line ''' lambda. ''' </summary> Public ReadOnly Property EndSubOrFunctionStatement As EndBlockStatementSyntax Get Return GetRed(_endSubOrFunctionStatement, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndSubOrFunctionStatement property changed to ''' the specified value. Returns this instance if the specified value is the same ''' as the current value. ''' </summary> Public Shadows Function WithEndSubOrFunctionStatement(endSubOrFunctionStatement as EndBlockStatementSyntax) As MultiLineLambdaExpressionSyntax return Update(Me.Kind, Me.SubOrFunctionHeader, Me.Statements, endSubOrFunctionStatement) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._subOrFunctionHeader Case 1 Return Me._statements Case 2 Return Me._endSubOrFunctionStatement Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.SubOrFunctionHeader Case 1 Return GetRed(_statements, 1) Case 2 Return Me.EndSubOrFunctionStatement Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitMultiLineLambdaExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitMultiLineLambdaExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="subOrFunctionHeader"> ''' The value for the SubOrFunctionHeader property. ''' </param> ''' <param name="statements"> ''' The value for the Statements property. ''' </param> ''' <param name="endSubOrFunctionStatement"> ''' The value for the EndSubOrFunctionStatement property. ''' </param> Public Function Update(kind As SyntaxKind, subOrFunctionHeader As LambdaHeaderSyntax, statements As SyntaxList(of StatementSyntax), endSubOrFunctionStatement As EndBlockStatementSyntax) As MultiLineLambdaExpressionSyntax If kind <> Me.Kind OrElse subOrFunctionHeader IsNot Me.SubOrFunctionHeader OrElse statements <> Me.Statements OrElse endSubOrFunctionStatement IsNot Me.EndSubOrFunctionStatement Then Dim newNode = SyntaxFactory.MultiLineLambdaExpression(kind, subOrFunctionHeader, statements, endSubOrFunctionStatement) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the header part of a lambda expression ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SubLambdaHeader"/></description></item> ''' <item><description><see cref="SyntaxKind.FunctionLambdaHeader"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class LambdaHeaderSyntax Inherits MethodBaseSyntax Friend _asClause as SimpleAsClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), attributeLists As SyntaxNode, modifiers As GreenNode, subOrFunctionKeyword As InternalSyntax.KeywordSyntax, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LambdaHeaderSyntax(kind, errors, annotations, if(attributeLists IsNot Nothing, attributeLists.Green, Nothing), modifiers, subOrFunctionKeyword, if(parameterList IsNot Nothing, DirectCast(parameterList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ParameterListSyntax), Nothing), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all attribute lists on this declaration. If no attributes were ''' specified, Nothing is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AttributeLists As SyntaxList(Of AttributeListSyntax) Get Dim listNode = GetRedAtZero(_attributeLists) Return new SyntaxList(Of AttributeListSyntax)(listNode) End Get End Property Friend Overrides Function GetAttributeListsCore() As SyntaxList(Of AttributeListSyntax) Return Me.AttributeLists End Function Friend Overrides Function WithAttributeListsCore(attributeLists As SyntaxList(Of AttributeListSyntax)) As MethodBaseSyntax Return WithAttributeLists(attributeLists) End Function ''' <summary> ''' Returns a copy of this with the AttributeLists property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAttributeLists(attributeLists as SyntaxList(Of AttributeListSyntax)) As LambdaHeaderSyntax return Update(Me.Kind, attributeLists, Me.Modifiers, Me.SubOrFunctionKeyword, Me.ParameterList, Me.AsClause) End Function Public Shadows Function AddAttributeLists(ParamArray items As AttributeListSyntax()) As LambdaHeaderSyntax Return Me.WithAttributeLists(Me.AttributeLists.AddRange(items)) End Function Friend Overrides Function AddAttributeListsCore(ParamArray items As AttributeListSyntax()) As MethodBaseSyntax Return AddAttributeLists(items) End Function ''' <summary> ''' A list of all the modifier tokens that were present on this declaration. If no ''' modifiers were specified, an empty list is returned. A bitfield version of all ''' the modifiers ORed together, which is in many cases easier to use, can be ''' obtained with the Modifiers property. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property Modifiers As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LambdaHeaderSyntax)._modifiers If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function GetModifiersCore() As SyntaxTokenList Return Me.Modifiers End Function Friend Overrides Function WithModifiersCore(modifiers As SyntaxTokenList) As MethodBaseSyntax Return WithModifiers(modifiers) End Function ''' <summary> ''' Returns a copy of this with the Modifiers property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifiers(modifiers as SyntaxTokenList) As LambdaHeaderSyntax return Update(Me.Kind, Me.AttributeLists, modifiers, Me.SubOrFunctionKeyword, Me.ParameterList, Me.AsClause) End Function Public Shadows Function AddModifiers(ParamArray items As SyntaxToken()) As LambdaHeaderSyntax Return Me.WithModifiers(Me.Modifiers.AddRange(items)) End Function Friend Overrides Function AddModifiersCore(ParamArray items As SyntaxToken()) As MethodBaseSyntax Return AddModifiers(items) End Function ''' <summary> ''' The "Sub" or "Function" keyword that introduces this lambda expression. ''' </summary> Public ReadOnly Property SubOrFunctionKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LambdaHeaderSyntax)._subOrFunctionKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the SubOrFunctionKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSubOrFunctionKeyword(subOrFunctionKeyword as SyntaxToken) As LambdaHeaderSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, subOrFunctionKeyword, Me.ParameterList, Me.AsClause) End Function ''' <summary> ''' The method's parameter list including the parentheses. If no parameter list was ''' present, Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public Shadows ReadOnly Property ParameterList As ParameterListSyntax Get Return GetRed(_parameterList, 3) End Get End Property Friend Overrides Function GetParameterListCore() As ParameterListSyntax Return Me.ParameterList End Function Friend Overrides Function WithParameterListCore(parameterList As ParameterListSyntax) As MethodBaseSyntax Return WithParameterList(parameterList) End Function ''' <summary> ''' Returns a copy of this with the ParameterList property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithParameterList(parameterList as ParameterListSyntax) As LambdaHeaderSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.SubOrFunctionKeyword, parameterList, Me.AsClause) End Function Public Shadows Function AddParameterListParameters(ParamArray items As ParameterSyntax()) As LambdaHeaderSyntax Dim _child = If(Me.ParameterList IsNot Nothing, Me.ParameterList, SyntaxFactory.ParameterList()) Return Me.WithParameterList(_child.AddParameters(items)) End Function Friend Overrides Function AddParameterListParametersCore(ParamArray items As ParameterSyntax()) As MethodBaseSyntax Return AddParameterListParameters(items) End Function ''' <summary> ''' The "As" clause that describes the return type. If no As clause was present, ''' Nothing is returned. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As LambdaHeaderSyntax return Update(Me.Kind, Me.AttributeLists, Me.Modifiers, Me.SubOrFunctionKeyword, Me.ParameterList, asClause) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._attributeLists Case 3 Return Me._parameterList Case 4 Return Me._asClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return GetRedAtZero(_attributeLists) Case 3 Return Me.ParameterList Case 4 Return Me.AsClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitLambdaHeader(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitLambdaHeader(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="attributeLists"> ''' The value for the AttributeLists property. ''' </param> ''' <param name="modifiers"> ''' The value for the Modifiers property. ''' </param> ''' <param name="subOrFunctionKeyword"> ''' The value for the SubOrFunctionKeyword property. ''' </param> ''' <param name="parameterList"> ''' The value for the ParameterList property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> Public Function Update(kind As SyntaxKind, attributeLists As SyntaxList(of AttributeListSyntax), modifiers As SyntaxTokenList, subOrFunctionKeyword As SyntaxToken, parameterList As ParameterListSyntax, asClause As SimpleAsClauseSyntax) As LambdaHeaderSyntax If kind <> Me.Kind OrElse attributeLists <> Me.AttributeLists OrElse modifiers <> Me.Modifiers OrElse subOrFunctionKeyword <> Me.SubOrFunctionKeyword OrElse parameterList IsNot Me.ParameterList OrElse asClause IsNot Me.AsClause Then Dim newNode = SyntaxFactory.LambdaHeader(kind, attributeLists, modifiers, subOrFunctionKeyword, parameterList, asClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a parenthesized argument list. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ArgumentList"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ArgumentListSyntax Inherits VisualBasicSyntaxNode Friend _arguments as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), openParenToken As InternalSyntax.PunctuationSyntax, arguments As SyntaxNode, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArgumentListSyntax(kind, errors, annotations, openParenToken, if(arguments IsNot Nothing, arguments.Green, Nothing), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "(" token. ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArgumentListSyntax)._openParenToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As ArgumentListSyntax return Update(openParenToken, Me.Arguments, Me.CloseParenToken) End Function ''' <summary> ''' The list of arguments. This may be empty. Omitted argument are represented by ''' an OmittedArgumentSyntax node. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Arguments As SeparatedSyntaxList(Of ArgumentSyntax) Get Dim listNode = GetRed(_arguments, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ArgumentSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Arguments property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArguments(arguments as SeparatedSyntaxList(Of ArgumentSyntax)) As ArgumentListSyntax return Update(Me.OpenParenToken, arguments, Me.CloseParenToken) End Function Public Shadows Function AddArguments(ParamArray items As ArgumentSyntax()) As ArgumentListSyntax Return Me.WithArguments(Me.Arguments.AddRange(items)) End Function ''' <summary> ''' The ")" token. ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArgumentListSyntax)._closeParenToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As ArgumentListSyntax return Update(Me.OpenParenToken, Me.Arguments, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._arguments Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_arguments, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitArgumentList(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitArgumentList(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="arguments"> ''' The value for the Arguments property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(openParenToken As SyntaxToken, arguments As SeparatedSyntaxList(Of ArgumentSyntax), closeParenToken As SyntaxToken) As ArgumentListSyntax If openParenToken <> Me.OpenParenToken OrElse arguments <> Me.Arguments OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Base class for the possible kinds of arguments that can appear in an argument ''' list. ''' </summary> Public MustInherit Class ArgumentSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents an omitted argument in an argument list. An omitted argument is not ''' considered a syntax error but a valid case when no argument is required. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.OmittedArgument"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class OmittedArgumentSyntax Inherits ArgumentSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), empty As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OmittedArgumentSyntax(kind, errors, annotations, empty), Nothing, 0) End Sub ''' <summary> ''' An empty token because all non terminals must have a token. ''' </summary> Public ReadOnly Property Empty As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OmittedArgumentSyntax)._empty, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Empty property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithEmpty(empty as SyntaxToken) As OmittedArgumentSyntax return Update(empty) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitOmittedArgument(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitOmittedArgument(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="empty"> ''' The value for the Empty property. ''' </param> Public Function Update(empty As SyntaxToken) As OmittedArgumentSyntax If empty <> Me.Empty Then Dim newNode = SyntaxFactory.OmittedArgument(empty) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an argument that is just an optional argument name and an ''' expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SimpleArgument"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SimpleArgumentSyntax Inherits ArgumentSyntax Friend _nameColonEquals as NameColonEqualsSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), nameColonEquals As NameColonEqualsSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleArgumentSyntax(kind, errors, annotations, if(nameColonEquals IsNot Nothing, DirectCast(nameColonEquals.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NameColonEqualsSyntax), Nothing), DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The optional name and ":=" prefix of a named argument. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property NameColonEquals As NameColonEqualsSyntax Get Return GetRedAtZero(_nameColonEquals) End Get End Property ''' <summary> ''' Returns a copy of this with the NameColonEquals property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithNameColonEquals(nameColonEquals as NameColonEqualsSyntax) As SimpleArgumentSyntax return Update(nameColonEquals, Me.Expression) End Function ''' <summary> ''' The expression that is the argument. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As SimpleArgumentSyntax return Update(Me.NameColonEquals, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._nameColonEquals Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.NameColonEquals Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSimpleArgument(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSimpleArgument(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="nameColonEquals"> ''' The value for the NameColonEquals property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(nameColonEquals As NameColonEqualsSyntax, expression As ExpressionSyntax) As SimpleArgumentSyntax If nameColonEquals IsNot Me.NameColonEquals OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.SimpleArgument(nameColonEquals, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an identifier name followed by a ":=" token in a named argument. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.NameColonEquals"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class NameColonEqualsSyntax Inherits VisualBasicSyntaxNode Friend _name as IdentifierNameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), name As IdentifierNameSyntax, colonEqualsToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NameColonEqualsSyntax(kind, errors, annotations, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IdentifierNameSyntax), colonEqualsToken), Nothing, 0) End Sub ''' <summary> ''' The name used to identify the named argument. ''' </summary> Public ReadOnly Property Name As IdentifierNameSyntax Get Return GetRedAtZero(_name) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as IdentifierNameSyntax) As NameColonEqualsSyntax return Update(name, Me.ColonEqualsToken) End Function ''' <summary> ''' The ":=" token. ''' </summary> Public ReadOnly Property ColonEqualsToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NameColonEqualsSyntax)._colonEqualsToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ColonEqualsToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithColonEqualsToken(colonEqualsToken as SyntaxToken) As NameColonEqualsSyntax return Update(Me.Name, colonEqualsToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._name Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Name Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitNameColonEquals(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitNameColonEquals(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="colonEqualsToken"> ''' The value for the ColonEqualsToken property. ''' </param> Public Function Update(name As IdentifierNameSyntax, colonEqualsToken As SyntaxToken) As NameColonEqualsSyntax If name IsNot Me.Name OrElse colonEqualsToken <> Me.ColonEqualsToken Then Dim newNode = SyntaxFactory.NameColonEquals(name, colonEqualsToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a range argument, such as "0 to 5", used in array bounds. The ''' "Value" property represents the upper bound of the range. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.RangeArgument"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class RangeArgumentSyntax Inherits ArgumentSyntax Friend _lowerBound as ExpressionSyntax Friend _upperBound as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lowerBound As ExpressionSyntax, toKeyword As InternalSyntax.KeywordSyntax, upperBound As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RangeArgumentSyntax(kind, errors, annotations, DirectCast(lowerBound.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), toKeyword, DirectCast(upperBound.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The lower bound of the range. This is typically the integer constant zero. ''' </summary> Public ReadOnly Property LowerBound As ExpressionSyntax Get Return GetRedAtZero(_lowerBound) End Get End Property ''' <summary> ''' Returns a copy of this with the LowerBound property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLowerBound(lowerBound as ExpressionSyntax) As RangeArgumentSyntax return Update(lowerBound, Me.ToKeyword, Me.UpperBound) End Function ''' <summary> ''' The "To" keyword. ''' </summary> Public ReadOnly Property ToKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RangeArgumentSyntax)._toKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ToKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithToKeyword(toKeyword as SyntaxToken) As RangeArgumentSyntax return Update(Me.LowerBound, toKeyword, Me.UpperBound) End Function ''' <summary> ''' The upper bound of the range. ''' </summary> Public ReadOnly Property UpperBound As ExpressionSyntax Get Return GetRed(_upperBound, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the UpperBound property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithUpperBound(upperBound as ExpressionSyntax) As RangeArgumentSyntax return Update(Me.LowerBound, Me.ToKeyword, upperBound) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._lowerBound Case 2 Return Me._upperBound Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.LowerBound Case 2 Return Me.UpperBound Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitRangeArgument(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitRangeArgument(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lowerBound"> ''' The value for the LowerBound property. ''' </param> ''' <param name="toKeyword"> ''' The value for the ToKeyword property. ''' </param> ''' <param name="upperBound"> ''' The value for the UpperBound property. ''' </param> Public Function Update(lowerBound As ExpressionSyntax, toKeyword As SyntaxToken, upperBound As ExpressionSyntax) As RangeArgumentSyntax If lowerBound IsNot Me.LowerBound OrElse toKeyword <> Me.ToKeyword OrElse upperBound IsNot Me.UpperBound Then Dim newNode = SyntaxFactory.RangeArgument(lowerBound, toKeyword, upperBound) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' This class represents a query expression. A query expression is composed of one ''' or more query operators in a row. The first query operator must be a From or ''' Aggregate. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.QueryExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class QueryExpressionSyntax Inherits ExpressionSyntax Friend _clauses as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), clauses As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.QueryExpressionSyntax(kind, errors, annotations, if(clauses IsNot Nothing, clauses.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' A list of all the query operators in this query expression. This list always ''' contains at least one operator. ''' </summary> Public ReadOnly Property Clauses As SyntaxList(Of QueryClauseSyntax) Get Dim listNode = GetRedAtZero(_clauses) Return new SyntaxList(Of QueryClauseSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Clauses property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithClauses(clauses as SyntaxList(Of QueryClauseSyntax)) As QueryExpressionSyntax return Update(clauses) End Function Public Shadows Function AddClauses(ParamArray items As QueryClauseSyntax()) As QueryExpressionSyntax Return Me.WithClauses(Me.Clauses.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Me._clauses Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode If i = 0 Then Return GetRedAtZero(_clauses) Else Return Nothing End If End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitQueryExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitQueryExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="clauses"> ''' The value for the Clauses property. ''' </param> Public Function Update(clauses As SyntaxList(of QueryClauseSyntax)) As QueryExpressionSyntax If clauses <> Me.Clauses Then Dim newNode = SyntaxFactory.QueryExpression(clauses) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' This is a base class for all query operators. ''' </summary> Public MustInherit Class QueryClauseSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Describes a single variable of the form "x [As Type] In expression" for use in ''' query expressions. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CollectionRangeVariable"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CollectionRangeVariableSyntax Inherits VisualBasicSyntaxNode Friend _identifier as ModifiedIdentifierSyntax Friend _asClause as SimpleAsClauseSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), identifier As ModifiedIdentifierSyntax, asClause As SimpleAsClauseSyntax, inKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CollectionRangeVariableSyntax(kind, errors, annotations, DirectCast(identifier.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModifiedIdentifierSyntax), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing), inKeyword, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The name of the range variable being defined. ''' </summary> Public ReadOnly Property Identifier As ModifiedIdentifierSyntax Get Return GetRedAtZero(_identifier) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as ModifiedIdentifierSyntax) As CollectionRangeVariableSyntax return Update(identifier, Me.AsClause, Me.InKeyword, Me.Expression) End Function ''' <summary> ''' Describes the type of the variable being defined. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As CollectionRangeVariableSyntax return Update(Me.Identifier, asClause, Me.InKeyword, Me.Expression) End Function ''' <summary> ''' The "In" keyword. ''' </summary> Public ReadOnly Property InKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CollectionRangeVariableSyntax)._inKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the InKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithInKeyword(inKeyword as SyntaxToken) As CollectionRangeVariableSyntax return Update(Me.Identifier, Me.AsClause, inKeyword, Me.Expression) End Function ''' <summary> ''' The expression that serves as the source of items for the range variable. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As CollectionRangeVariableSyntax return Update(Me.Identifier, Me.AsClause, Me.InKeyword, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._identifier Case 1 Return Me._asClause Case 3 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Identifier Case 1 Return Me.AsClause Case 3 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCollectionRangeVariable(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCollectionRangeVariable(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> ''' <param name="inKeyword"> ''' The value for the InKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(identifier As ModifiedIdentifierSyntax, asClause As SimpleAsClauseSyntax, inKeyword As SyntaxToken, expression As ExpressionSyntax) As CollectionRangeVariableSyntax If identifier IsNot Me.Identifier OrElse asClause IsNot Me.AsClause OrElse inKeyword <> Me.InKeyword OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.CollectionRangeVariable(identifier, asClause, inKeyword, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Describes a single variable of the form "[x [As Type] =] expression" for use in ''' query expressions. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ExpressionRangeVariable"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ExpressionRangeVariableSyntax Inherits VisualBasicSyntaxNode Friend _nameEquals as VariableNameEqualsSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), nameEquals As VariableNameEqualsSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionRangeVariableSyntax(kind, errors, annotations, if(nameEquals IsNot Nothing, DirectCast(nameEquals.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.VariableNameEqualsSyntax), Nothing), DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The optional name and type of the expression range variable. If omitted, the ''' name of the expression range variable is inferred from the expression. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property NameEquals As VariableNameEqualsSyntax Get Return GetRedAtZero(_nameEquals) End Get End Property ''' <summary> ''' Returns a copy of this with the NameEquals property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNameEquals(nameEquals as VariableNameEqualsSyntax) As ExpressionRangeVariableSyntax return Update(nameEquals, Me.Expression) End Function ''' <summary> ''' The expression used to initialize the expression variable. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As ExpressionRangeVariableSyntax return Update(Me.NameEquals, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._nameEquals Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.NameEquals Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitExpressionRangeVariable(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitExpressionRangeVariable(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="nameEquals"> ''' The value for the NameEquals property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(nameEquals As VariableNameEqualsSyntax, expression As ExpressionSyntax) As ExpressionRangeVariableSyntax If nameEquals IsNot Me.NameEquals OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.ExpressionRangeVariable(nameEquals, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Describes a single variable of the form "[x [As Type] =] aggregation-function" ''' for use in the Into clause of Aggregate or Group By or Group Join query ''' operators. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.AggregationRangeVariable"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AggregationRangeVariableSyntax Inherits VisualBasicSyntaxNode Friend _nameEquals as VariableNameEqualsSyntax Friend _aggregation as AggregationSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), nameEquals As VariableNameEqualsSyntax, aggregation As AggregationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AggregationRangeVariableSyntax(kind, errors, annotations, if(nameEquals IsNot Nothing, DirectCast(nameEquals.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.VariableNameEqualsSyntax), Nothing), DirectCast(aggregation.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AggregationSyntax)), Nothing, 0) End Sub ''' <summary> ''' The optional name and type of the expression range variable. If omitted, the ''' name of the expression range variable is inferred from the aggregation ''' expression. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property NameEquals As VariableNameEqualsSyntax Get Return GetRedAtZero(_nameEquals) End Get End Property ''' <summary> ''' Returns a copy of this with the NameEquals property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNameEquals(nameEquals as VariableNameEqualsSyntax) As AggregationRangeVariableSyntax return Update(nameEquals, Me.Aggregation) End Function ''' <summary> ''' The name of the aggregation function. The "Group" aggregation function is ''' represented by the identifier "Group". ''' </summary> Public ReadOnly Property Aggregation As AggregationSyntax Get Return GetRed(_aggregation, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Aggregation property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAggregation(aggregation as AggregationSyntax) As AggregationRangeVariableSyntax return Update(Me.NameEquals, aggregation) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._nameEquals Case 1 Return Me._aggregation Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.NameEquals Case 1 Return Me.Aggregation Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAggregationRangeVariable(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAggregationRangeVariable(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="nameEquals"> ''' The value for the NameEquals property. ''' </param> ''' <param name="aggregation"> ''' The value for the Aggregation property. ''' </param> Public Function Update(nameEquals As VariableNameEqualsSyntax, aggregation As AggregationSyntax) As AggregationRangeVariableSyntax If nameEquals IsNot Me.NameEquals OrElse aggregation IsNot Me.Aggregation Then Dim newNode = SyntaxFactory.AggregationRangeVariable(nameEquals, aggregation) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the name and optional type of an expression range variable. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.VariableNameEquals"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class VariableNameEqualsSyntax Inherits VisualBasicSyntaxNode Friend _identifier as ModifiedIdentifierSyntax Friend _asClause as SimpleAsClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), identifier As ModifiedIdentifierSyntax, asClause As SimpleAsClauseSyntax, equalsToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.VariableNameEqualsSyntax(kind, errors, annotations, DirectCast(identifier.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ModifiedIdentifierSyntax), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing), equalsToken), Nothing, 0) End Sub ''' <summary> ''' The name of the variable being defined. ''' </summary> Public ReadOnly Property Identifier As ModifiedIdentifierSyntax Get Return GetRedAtZero(_identifier) End Get End Property ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as ModifiedIdentifierSyntax) As VariableNameEqualsSyntax return Update(identifier, Me.AsClause, Me.EqualsToken) End Function ''' <summary> ''' Describes the type of the variable being defined. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As VariableNameEqualsSyntax return Update(Me.Identifier, asClause, Me.EqualsToken) End Function ''' <summary> ''' The "=" token. ''' </summary> Public ReadOnly Property EqualsToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.VariableNameEqualsSyntax)._equalsToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the EqualsToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEqualsToken(equalsToken as SyntaxToken) As VariableNameEqualsSyntax return Update(Me.Identifier, Me.AsClause, equalsToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._identifier Case 1 Return Me._asClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Identifier Case 1 Return Me.AsClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitVariableNameEquals(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitVariableNameEquals(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> ''' <param name="equalsToken"> ''' The value for the EqualsToken property. ''' </param> Public Function Update(identifier As ModifiedIdentifierSyntax, asClause As SimpleAsClauseSyntax, equalsToken As SyntaxToken) As VariableNameEqualsSyntax If identifier IsNot Me.Identifier OrElse asClause IsNot Me.AsClause OrElse equalsToken <> Me.EqualsToken Then Dim newNode = SyntaxFactory.VariableNameEquals(identifier, asClause, equalsToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents aggregation in aggregation range variable declaration of a Group By, ''' Group Join or Aggregate query operator. ''' </summary> Public MustInherit Class AggregationSyntax Inherits ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents an invocation of an Aggregation function in the aggregation range ''' variable declaration of a Group By, Group Join or Aggregate query operator. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.FunctionAggregation"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class FunctionAggregationSyntax Inherits AggregationSyntax Friend _argument as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), functionName As InternalSyntax.IdentifierTokenSyntax, openParenToken As InternalSyntax.PunctuationSyntax, argument As ExpressionSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FunctionAggregationSyntax(kind, errors, annotations, functionName, openParenToken, if(argument IsNot Nothing, DirectCast(argument.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), Nothing), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The name of the aggregation function. ''' </summary> Public ReadOnly Property FunctionName As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FunctionAggregationSyntax)._functionName, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the FunctionName property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithFunctionName(functionName as SyntaxToken) As FunctionAggregationSyntax return Update(functionName, Me.OpenParenToken, Me.Argument, Me.CloseParenToken) End Function ''' <summary> ''' The "(" token if present. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property OpenParenToken As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FunctionAggregationSyntax)._openParenToken If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As FunctionAggregationSyntax return Update(Me.FunctionName, openParenToken, Me.Argument, Me.CloseParenToken) End Function ''' <summary> ''' The argument to the aggregation function. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Argument As ExpressionSyntax Get Return GetRed(_argument, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Argument property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArgument(argument as ExpressionSyntax) As FunctionAggregationSyntax return Update(Me.FunctionName, Me.OpenParenToken, argument, Me.CloseParenToken) End Function ''' <summary> ''' The ")" token, if present. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property CloseParenToken As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FunctionAggregationSyntax)._closeParenToken If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(3), Me.GetChildIndex(3)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As FunctionAggregationSyntax return Update(Me.FunctionName, Me.OpenParenToken, Me.Argument, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._argument Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Argument Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitFunctionAggregation(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitFunctionAggregation(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="functionName"> ''' The value for the FunctionName property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="argument"> ''' The value for the Argument property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(functionName As SyntaxToken, openParenToken As SyntaxToken, argument As ExpressionSyntax, closeParenToken As SyntaxToken) As FunctionAggregationSyntax If functionName <> Me.FunctionName OrElse openParenToken <> Me.OpenParenToken OrElse argument IsNot Me.Argument OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.FunctionAggregation(functionName, openParenToken, argument, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the use of "Group" as the aggregation function in the in the ''' aggregation range variable declaration of a Group By or Group Join query ''' operator. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.GroupAggregation"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class GroupAggregationSyntax Inherits AggregationSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), groupKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GroupAggregationSyntax(kind, errors, annotations, groupKeyword), Nothing, 0) End Sub ''' <summary> ''' The "Group" keyword. ''' </summary> Public ReadOnly Property GroupKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GroupAggregationSyntax)._groupKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the GroupKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithGroupKeyword(groupKeyword as SyntaxToken) As GroupAggregationSyntax return Update(groupKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitGroupAggregation(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitGroupAggregation(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="groupKeyword"> ''' The value for the GroupKeyword property. ''' </param> Public Function Update(groupKeyword As SyntaxToken) As GroupAggregationSyntax If groupKeyword <> Me.GroupKeyword Then Dim newNode = SyntaxFactory.GroupAggregation(groupKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "From" query operator. If this is the beginning of a query, the ''' Source will be Nothing. Otherwise, the Source will be the part of the query to ''' the left of the From. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.FromClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class FromClauseSyntax Inherits QueryClauseSyntax Friend _variables as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), fromKeyword As InternalSyntax.KeywordSyntax, variables As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FromClauseSyntax(kind, errors, annotations, fromKeyword, if(variables IsNot Nothing, variables.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "From" keyword. ''' </summary> Public ReadOnly Property FromKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.FromClauseSyntax)._fromKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the FromKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithFromKeyword(fromKeyword as SyntaxToken) As FromClauseSyntax return Update(fromKeyword, Me.Variables) End Function ''' <summary> ''' The list of collection variables declared by this From operator. ''' </summary> Public ReadOnly Property Variables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax) Get Dim listNode = GetRed(_variables, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of CollectionRangeVariableSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Variables property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithVariables(variables as SeparatedSyntaxList(Of CollectionRangeVariableSyntax)) As FromClauseSyntax return Update(Me.FromKeyword, variables) End Function Public Shadows Function AddVariables(ParamArray items As CollectionRangeVariableSyntax()) As FromClauseSyntax Return Me.WithVariables(Me.Variables.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._variables Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_variables, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitFromClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitFromClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="fromKeyword"> ''' The value for the FromKeyword property. ''' </param> ''' <param name="variables"> ''' The value for the Variables property. ''' </param> Public Function Update(fromKeyword As SyntaxToken, variables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax)) As FromClauseSyntax If fromKeyword <> Me.FromKeyword OrElse variables <> Me.Variables Then Dim newNode = SyntaxFactory.FromClause(fromKeyword, variables) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "Let" query operator. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.LetClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class LetClauseSyntax Inherits QueryClauseSyntax Friend _variables as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), letKeyword As InternalSyntax.KeywordSyntax, variables As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LetClauseSyntax(kind, errors, annotations, letKeyword, if(variables IsNot Nothing, variables.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Let" keyword. ''' </summary> Public ReadOnly Property LetKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.LetClauseSyntax)._letKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LetKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLetKeyword(letKeyword as SyntaxToken) As LetClauseSyntax return Update(letKeyword, Me.Variables) End Function ''' <summary> ''' The list of expression range variable being defined by the Let operator. ''' </summary> Public ReadOnly Property Variables As SeparatedSyntaxList(Of ExpressionRangeVariableSyntax) Get Dim listNode = GetRed(_variables, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ExpressionRangeVariableSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Variables property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithVariables(variables as SeparatedSyntaxList(Of ExpressionRangeVariableSyntax)) As LetClauseSyntax return Update(Me.LetKeyword, variables) End Function Public Shadows Function AddVariables(ParamArray items As ExpressionRangeVariableSyntax()) As LetClauseSyntax Return Me.WithVariables(Me.Variables.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._variables Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_variables, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitLetClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitLetClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="letKeyword"> ''' The value for the LetKeyword property. ''' </param> ''' <param name="variables"> ''' The value for the Variables property. ''' </param> Public Function Update(letKeyword As SyntaxToken, variables As SeparatedSyntaxList(Of ExpressionRangeVariableSyntax)) As LetClauseSyntax If letKeyword <> Me.LetKeyword OrElse variables <> Me.Variables Then Dim newNode = SyntaxFactory.LetClause(letKeyword, variables) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an Aggregate query operator. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.AggregateClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AggregateClauseSyntax Inherits QueryClauseSyntax Friend _variables as SyntaxNode Friend _additionalQueryOperators as SyntaxNode Friend _aggregationVariables as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), aggregateKeyword As InternalSyntax.KeywordSyntax, variables As SyntaxNode, additionalQueryOperators As SyntaxNode, intoKeyword As InternalSyntax.KeywordSyntax, aggregationVariables As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AggregateClauseSyntax(kind, errors, annotations, aggregateKeyword, if(variables IsNot Nothing, variables.Green, Nothing), if(additionalQueryOperators IsNot Nothing, additionalQueryOperators.Green, Nothing), intoKeyword, if(aggregationVariables IsNot Nothing, aggregationVariables.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Aggregate" keyword. ''' </summary> Public ReadOnly Property AggregateKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AggregateClauseSyntax)._aggregateKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the AggregateKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAggregateKeyword(aggregateKeyword as SyntaxToken) As AggregateClauseSyntax return Update(aggregateKeyword, Me.Variables, Me.AdditionalQueryOperators, Me.IntoKeyword, Me.AggregationVariables) End Function ''' <summary> ''' The list of collection range variables declared by this Aggregate operator. ''' </summary> Public ReadOnly Property Variables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax) Get Dim listNode = GetRed(_variables, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of CollectionRangeVariableSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Variables property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithVariables(variables as SeparatedSyntaxList(Of CollectionRangeVariableSyntax)) As AggregateClauseSyntax return Update(Me.AggregateKeyword, variables, Me.AdditionalQueryOperators, Me.IntoKeyword, Me.AggregationVariables) End Function Public Shadows Function AddVariables(ParamArray items As CollectionRangeVariableSyntax()) As AggregateClauseSyntax Return Me.WithVariables(Me.Variables.AddRange(items)) End Function ''' <summary> ''' A list of additional query operators. It may be empty. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AdditionalQueryOperators As SyntaxList(Of QueryClauseSyntax) Get Dim listNode = GetRed(_additionalQueryOperators, 2) Return new SyntaxList(Of QueryClauseSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the AdditionalQueryOperators property changed to ''' the specified value. Returns this instance if the specified value is the same ''' as the current value. ''' </summary> Public Shadows Function WithAdditionalQueryOperators(additionalQueryOperators as SyntaxList(Of QueryClauseSyntax)) As AggregateClauseSyntax return Update(Me.AggregateKeyword, Me.Variables, additionalQueryOperators, Me.IntoKeyword, Me.AggregationVariables) End Function Public Shadows Function AddAdditionalQueryOperators(ParamArray items As QueryClauseSyntax()) As AggregateClauseSyntax Return Me.WithAdditionalQueryOperators(Me.AdditionalQueryOperators.AddRange(items)) End Function ''' <summary> ''' The "Into" keyword. ''' </summary> Public ReadOnly Property IntoKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AggregateClauseSyntax)._intoKeyword, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the IntoKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIntoKeyword(intoKeyword as SyntaxToken) As AggregateClauseSyntax return Update(Me.AggregateKeyword, Me.Variables, Me.AdditionalQueryOperators, intoKeyword, Me.AggregationVariables) End Function ''' <summary> ''' The list of new variables being defined by the aggregation. ''' </summary> Public ReadOnly Property AggregationVariables As SeparatedSyntaxList(Of AggregationRangeVariableSyntax) Get Dim listNode = GetRed(_aggregationVariables, 4) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of AggregationRangeVariableSyntax)(listNode, Me.GetChildIndex(4)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the AggregationVariables property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAggregationVariables(aggregationVariables as SeparatedSyntaxList(Of AggregationRangeVariableSyntax)) As AggregateClauseSyntax return Update(Me.AggregateKeyword, Me.Variables, Me.AdditionalQueryOperators, Me.IntoKeyword, aggregationVariables) End Function Public Shadows Function AddAggregationVariables(ParamArray items As AggregationRangeVariableSyntax()) As AggregateClauseSyntax Return Me.WithAggregationVariables(Me.AggregationVariables.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._variables Case 2 Return Me._additionalQueryOperators Case 4 Return Me._aggregationVariables Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_variables, 1) Case 2 Return GetRed(_additionalQueryOperators, 2) Case 4 Return GetRed(_aggregationVariables, 4) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAggregateClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAggregateClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="aggregateKeyword"> ''' The value for the AggregateKeyword property. ''' </param> ''' <param name="variables"> ''' The value for the Variables property. ''' </param> ''' <param name="additionalQueryOperators"> ''' The value for the AdditionalQueryOperators property. ''' </param> ''' <param name="intoKeyword"> ''' The value for the IntoKeyword property. ''' </param> ''' <param name="aggregationVariables"> ''' The value for the AggregationVariables property. ''' </param> Public Function Update(aggregateKeyword As SyntaxToken, variables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax), additionalQueryOperators As SyntaxList(of QueryClauseSyntax), intoKeyword As SyntaxToken, aggregationVariables As SeparatedSyntaxList(Of AggregationRangeVariableSyntax)) As AggregateClauseSyntax If aggregateKeyword <> Me.AggregateKeyword OrElse variables <> Me.Variables OrElse additionalQueryOperators <> Me.AdditionalQueryOperators OrElse intoKeyword <> Me.IntoKeyword OrElse aggregationVariables <> Me.AggregationVariables Then Dim newNode = SyntaxFactory.AggregateClause(aggregateKeyword, variables, additionalQueryOperators, intoKeyword, aggregationVariables) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Distinct" query operator. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.DistinctClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class DistinctClauseSyntax Inherits QueryClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), distinctKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DistinctClauseSyntax(kind, errors, annotations, distinctKeyword), Nothing, 0) End Sub ''' <summary> ''' The "Distinct" keyword. ''' </summary> Public ReadOnly Property DistinctKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DistinctClauseSyntax)._distinctKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the DistinctKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithDistinctKeyword(distinctKeyword as SyntaxToken) As DistinctClauseSyntax return Update(distinctKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitDistinctClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitDistinctClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="distinctKeyword"> ''' The value for the DistinctKeyword property. ''' </param> Public Function Update(distinctKeyword As SyntaxToken) As DistinctClauseSyntax If distinctKeyword <> Me.DistinctKeyword Then Dim newNode = SyntaxFactory.DistinctClause(distinctKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "Where" query operator. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.WhereClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class WhereClauseSyntax Inherits QueryClauseSyntax Friend _condition as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), whereKeyword As InternalSyntax.KeywordSyntax, condition As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WhereClauseSyntax(kind, errors, annotations, whereKeyword, DirectCast(condition.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Where" keyword. ''' </summary> Public ReadOnly Property WhereKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.WhereClauseSyntax)._whereKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the WhereKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithWhereKeyword(whereKeyword as SyntaxToken) As WhereClauseSyntax return Update(whereKeyword, Me.Condition) End Function ''' <summary> ''' The boolean expression used for filtering. ''' </summary> Public ReadOnly Property Condition As ExpressionSyntax Get Return GetRed(_condition, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Condition property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCondition(condition as ExpressionSyntax) As WhereClauseSyntax return Update(Me.WhereKeyword, condition) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._condition Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Condition Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitWhereClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitWhereClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="whereKeyword"> ''' The value for the WhereKeyword property. ''' </param> ''' <param name="condition"> ''' The value for the Condition property. ''' </param> Public Function Update(whereKeyword As SyntaxToken, condition As ExpressionSyntax) As WhereClauseSyntax If whereKeyword <> Me.WhereKeyword OrElse condition IsNot Me.Condition Then Dim newNode = SyntaxFactory.WhereClause(whereKeyword, condition) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "Skip While" or "Take While" query operator. The Kind property ''' tells which. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SkipWhileClause"/></description></item> ''' <item><description><see cref="SyntaxKind.TakeWhileClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class PartitionWhileClauseSyntax Inherits QueryClauseSyntax Friend _condition as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), skipOrTakeKeyword As InternalSyntax.KeywordSyntax, whileKeyword As InternalSyntax.KeywordSyntax, condition As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PartitionWhileClauseSyntax(kind, errors, annotations, skipOrTakeKeyword, whileKeyword, DirectCast(condition.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Skip" or "Take" keyword. ''' </summary> Public ReadOnly Property SkipOrTakeKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PartitionWhileClauseSyntax)._skipOrTakeKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the SkipOrTakeKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSkipOrTakeKeyword(skipOrTakeKeyword as SyntaxToken) As PartitionWhileClauseSyntax return Update(Me.Kind, skipOrTakeKeyword, Me.WhileKeyword, Me.Condition) End Function ''' <summary> ''' The "While" keyword. ''' </summary> Public ReadOnly Property WhileKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PartitionWhileClauseSyntax)._whileKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the WhileKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithWhileKeyword(whileKeyword as SyntaxToken) As PartitionWhileClauseSyntax return Update(Me.Kind, Me.SkipOrTakeKeyword, whileKeyword, Me.Condition) End Function ''' <summary> ''' The boolean expression used for partitioning. ''' </summary> Public ReadOnly Property Condition As ExpressionSyntax Get Return GetRed(_condition, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Condition property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCondition(condition as ExpressionSyntax) As PartitionWhileClauseSyntax return Update(Me.Kind, Me.SkipOrTakeKeyword, Me.WhileKeyword, condition) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._condition Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Condition Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitPartitionWhileClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitPartitionWhileClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="skipOrTakeKeyword"> ''' The value for the SkipOrTakeKeyword property. ''' </param> ''' <param name="whileKeyword"> ''' The value for the WhileKeyword property. ''' </param> ''' <param name="condition"> ''' The value for the Condition property. ''' </param> Public Function Update(kind As SyntaxKind, skipOrTakeKeyword As SyntaxToken, whileKeyword As SyntaxToken, condition As ExpressionSyntax) As PartitionWhileClauseSyntax If kind <> Me.Kind OrElse skipOrTakeKeyword <> Me.SkipOrTakeKeyword OrElse whileKeyword <> Me.WhileKeyword OrElse condition IsNot Me.Condition Then Dim newNode = SyntaxFactory.PartitionWhileClause(kind, skipOrTakeKeyword, whileKeyword, condition) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a "Skip" or "Take" query operator. The Kind property tells which. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SkipClause"/></description></item> ''' <item><description><see cref="SyntaxKind.TakeClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class PartitionClauseSyntax Inherits QueryClauseSyntax Friend _count as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), skipOrTakeKeyword As InternalSyntax.KeywordSyntax, count As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PartitionClauseSyntax(kind, errors, annotations, skipOrTakeKeyword, DirectCast(count.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Skip" or "Take" keyword. ''' </summary> Public ReadOnly Property SkipOrTakeKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PartitionClauseSyntax)._skipOrTakeKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the SkipOrTakeKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSkipOrTakeKeyword(skipOrTakeKeyword as SyntaxToken) As PartitionClauseSyntax return Update(Me.Kind, skipOrTakeKeyword, Me.Count) End Function ''' <summary> ''' Represents the expression with the number of items to take or skip. ''' </summary> Public ReadOnly Property Count As ExpressionSyntax Get Return GetRed(_count, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Count property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithCount(count as ExpressionSyntax) As PartitionClauseSyntax return Update(Me.Kind, Me.SkipOrTakeKeyword, count) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._count Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Count Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitPartitionClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitPartitionClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="skipOrTakeKeyword"> ''' The value for the SkipOrTakeKeyword property. ''' </param> ''' <param name="count"> ''' The value for the Count property. ''' </param> Public Function Update(kind As SyntaxKind, skipOrTakeKeyword As SyntaxToken, count As ExpressionSyntax) As PartitionClauseSyntax If kind <> Me.Kind OrElse skipOrTakeKeyword <> Me.SkipOrTakeKeyword OrElse count IsNot Me.Count Then Dim newNode = SyntaxFactory.PartitionClause(kind, skipOrTakeKeyword, count) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Group By" query operator. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.GroupByClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class GroupByClauseSyntax Inherits QueryClauseSyntax Friend _items as SyntaxNode Friend _keys as SyntaxNode Friend _aggregationVariables as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), groupKeyword As InternalSyntax.KeywordSyntax, items As SyntaxNode, byKeyword As InternalSyntax.KeywordSyntax, keys As SyntaxNode, intoKeyword As InternalSyntax.KeywordSyntax, aggregationVariables As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GroupByClauseSyntax(kind, errors, annotations, groupKeyword, if(items IsNot Nothing, items.Green, Nothing), byKeyword, if(keys IsNot Nothing, keys.Green, Nothing), intoKeyword, if(aggregationVariables IsNot Nothing, aggregationVariables.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Group" keyword. ''' </summary> Public ReadOnly Property GroupKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GroupByClauseSyntax)._groupKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the GroupKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithGroupKeyword(groupKeyword as SyntaxToken) As GroupByClauseSyntax return Update(groupKeyword, Me.Items, Me.ByKeyword, Me.Keys, Me.IntoKeyword, Me.AggregationVariables) End Function ''' <summary> ''' The optional list of variables being grouped; the contents of the Group clause. ''' If none were specified, an empty list is returned. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Items As SeparatedSyntaxList(Of ExpressionRangeVariableSyntax) Get Dim listNode = GetRed(_items, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ExpressionRangeVariableSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Items property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithItems(items as SeparatedSyntaxList(Of ExpressionRangeVariableSyntax)) As GroupByClauseSyntax return Update(Me.GroupKeyword, items, Me.ByKeyword, Me.Keys, Me.IntoKeyword, Me.AggregationVariables) End Function Public Shadows Function AddItems(ParamArray items As ExpressionRangeVariableSyntax()) As GroupByClauseSyntax Return Me.WithItems(Me.Items.AddRange(items)) End Function ''' <summary> ''' The "By" keyword. ''' </summary> Public ReadOnly Property ByKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GroupByClauseSyntax)._byKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the ByKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithByKeyword(byKeyword as SyntaxToken) As GroupByClauseSyntax return Update(Me.GroupKeyword, Me.Items, byKeyword, Me.Keys, Me.IntoKeyword, Me.AggregationVariables) End Function ''' <summary> ''' The key values being used for grouping. ''' </summary> Public ReadOnly Property Keys As SeparatedSyntaxList(Of ExpressionRangeVariableSyntax) Get Dim listNode = GetRed(_keys, 3) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ExpressionRangeVariableSyntax)(listNode, Me.GetChildIndex(3)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Keys property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithKeys(keys as SeparatedSyntaxList(Of ExpressionRangeVariableSyntax)) As GroupByClauseSyntax return Update(Me.GroupKeyword, Me.Items, Me.ByKeyword, keys, Me.IntoKeyword, Me.AggregationVariables) End Function Public Shadows Function AddKeys(ParamArray items As ExpressionRangeVariableSyntax()) As GroupByClauseSyntax Return Me.WithKeys(Me.Keys.AddRange(items)) End Function Public ReadOnly Property IntoKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GroupByClauseSyntax)._intoKeyword, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property ''' <summary> ''' Returns a copy of this with the IntoKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIntoKeyword(intoKeyword as SyntaxToken) As GroupByClauseSyntax return Update(Me.GroupKeyword, Me.Items, Me.ByKeyword, Me.Keys, intoKeyword, Me.AggregationVariables) End Function ''' <summary> ''' The list of new variables that calculate aggregations. ''' </summary> Public ReadOnly Property AggregationVariables As SeparatedSyntaxList(Of AggregationRangeVariableSyntax) Get Dim listNode = GetRed(_aggregationVariables, 5) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of AggregationRangeVariableSyntax)(listNode, Me.GetChildIndex(5)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the AggregationVariables property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAggregationVariables(aggregationVariables as SeparatedSyntaxList(Of AggregationRangeVariableSyntax)) As GroupByClauseSyntax return Update(Me.GroupKeyword, Me.Items, Me.ByKeyword, Me.Keys, Me.IntoKeyword, aggregationVariables) End Function Public Shadows Function AddAggregationVariables(ParamArray items As AggregationRangeVariableSyntax()) As GroupByClauseSyntax Return Me.WithAggregationVariables(Me.AggregationVariables.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._items Case 3 Return Me._keys Case 5 Return Me._aggregationVariables Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_items, 1) Case 3 Return GetRed(_keys, 3) Case 5 Return GetRed(_aggregationVariables, 5) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitGroupByClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitGroupByClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="groupKeyword"> ''' The value for the GroupKeyword property. ''' </param> ''' <param name="items"> ''' The value for the Items property. ''' </param> ''' <param name="byKeyword"> ''' The value for the ByKeyword property. ''' </param> ''' <param name="keys"> ''' The value for the Keys property. ''' </param> ''' <param name="intoKeyword"> ''' The value for the IntoKeyword property. ''' </param> ''' <param name="aggregationVariables"> ''' The value for the AggregationVariables property. ''' </param> Public Function Update(groupKeyword As SyntaxToken, items As SeparatedSyntaxList(Of ExpressionRangeVariableSyntax), byKeyword As SyntaxToken, keys As SeparatedSyntaxList(Of ExpressionRangeVariableSyntax), intoKeyword As SyntaxToken, aggregationVariables As SeparatedSyntaxList(Of AggregationRangeVariableSyntax)) As GroupByClauseSyntax If groupKeyword <> Me.GroupKeyword OrElse items <> Me.Items OrElse byKeyword <> Me.ByKeyword OrElse keys <> Me.Keys OrElse intoKeyword <> Me.IntoKeyword OrElse aggregationVariables <> Me.AggregationVariables Then Dim newNode = SyntaxFactory.GroupByClause(groupKeyword, items, byKeyword, keys, intoKeyword, aggregationVariables) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a Join or a Group Join query operator. ''' </summary> Public MustInherit Class JoinClauseSyntax Inherits QueryClauseSyntax Friend _joinedVariables as SyntaxNode Friend _additionalJoins as SyntaxNode Friend _joinConditions as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The "Join" keyword. ''' </summary> Public ReadOnly Property JoinKeyword As SyntaxToken Get Return Me.GetJoinKeywordCore() End Get End Property Friend Overridable Function GetJoinKeywordCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.JoinClauseSyntax)._joinKeyword, Me.Position, 0) End Function ''' <summary> ''' Returns a copy of this with the JoinKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithJoinKeyword(joinKeyword As SyntaxToken) As JoinClauseSyntax Return WithJoinKeywordCore(joinKeyword) End Function Friend MustOverride Function WithJoinKeywordCore(joinKeyword As SyntaxToken) As JoinClauseSyntax ''' <summary> ''' Defines the collection range variables being joined to. ''' </summary> Public Overridable ReadOnly Property JoinedVariables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax) Get Dim listNode = GetRed(_joinedVariables, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of CollectionRangeVariableSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the JoinedVariables property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Function WithJoinedVariables(joinedVariables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax)) As JoinClauseSyntax Return WithJoinedVariablesCore(joinedVariables) End Function Friend MustOverride Function WithJoinedVariablesCore(joinedVariables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax)) As JoinClauseSyntax Public Shadows Function AddJoinedVariables(ParamArray items As CollectionRangeVariableSyntax()) As JoinClauseSyntax Return AddJoinedVariablesCore(items) End Function Friend MustOverride Function AddJoinedVariablesCore(ParamArray items As CollectionRangeVariableSyntax()) As JoinClauseSyntax ''' <summary> ''' An additional Join or Group Join query operator. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property AdditionalJoins As SyntaxList(Of JoinClauseSyntax) Get Return Me.GetAdditionalJoinsCore() End Get End Property Friend Overridable Function GetAdditionalJoinsCore() As SyntaxList(Of JoinClauseSyntax) Dim listNode = GetRed(_additionalJoins, 2) Return new SyntaxList(Of JoinClauseSyntax)(listNode) End Function ''' <summary> ''' Returns a copy of this with the AdditionalJoins property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Function WithAdditionalJoins(additionalJoins As SyntaxList(Of JoinClauseSyntax)) As JoinClauseSyntax Return WithAdditionalJoinsCore(additionalJoins) End Function Friend MustOverride Function WithAdditionalJoinsCore(additionalJoins As SyntaxList(Of JoinClauseSyntax)) As JoinClauseSyntax Public Shadows Function AddAdditionalJoins(ParamArray items As JoinClauseSyntax()) As JoinClauseSyntax Return AddAdditionalJoinsCore(items) End Function Friend MustOverride Function AddAdditionalJoinsCore(ParamArray items As JoinClauseSyntax()) As JoinClauseSyntax ''' <summary> ''' The "On" keyword. ''' </summary> Public ReadOnly Property OnKeyword As SyntaxToken Get Return Me.GetOnKeywordCore() End Get End Property Friend Overridable Function GetOnKeywordCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.JoinClauseSyntax)._onKeyword, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Function ''' <summary> ''' Returns a copy of this with the OnKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithOnKeyword(onKeyword As SyntaxToken) As JoinClauseSyntax Return WithOnKeywordCore(onKeyword) End Function Friend MustOverride Function WithOnKeywordCore(onKeyword As SyntaxToken) As JoinClauseSyntax ''' <summary> ''' The conditions indicating what expressions to compare during the join. Each ''' condition is a JoinCondition, and the separators are "And" keywords. ''' </summary> Public Overridable ReadOnly Property JoinConditions As SeparatedSyntaxList(Of JoinConditionSyntax) Get Dim listNode = GetRed(_joinConditions, 4) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of JoinConditionSyntax)(listNode, Me.GetChildIndex(4)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the JoinConditions property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Function WithJoinConditions(joinConditions As SeparatedSyntaxList(Of JoinConditionSyntax)) As JoinClauseSyntax Return WithJoinConditionsCore(joinConditions) End Function Friend MustOverride Function WithJoinConditionsCore(joinConditions As SeparatedSyntaxList(Of JoinConditionSyntax)) As JoinClauseSyntax Public Shadows Function AddJoinConditions(ParamArray items As JoinConditionSyntax()) As JoinClauseSyntax Return AddJoinConditionsCore(items) End Function Friend MustOverride Function AddJoinConditionsCore(ParamArray items As JoinConditionSyntax()) As JoinClauseSyntax End Class ''' <summary> ''' Represents the "expression Equals expression" condition in a Join. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.JoinCondition"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class JoinConditionSyntax Inherits VisualBasicSyntaxNode Friend _left as ExpressionSyntax Friend _right as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), left As ExpressionSyntax, equalsKeyword As InternalSyntax.KeywordSyntax, right As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.JoinConditionSyntax(kind, errors, annotations, DirectCast(left.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), equalsKeyword, DirectCast(right.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The left expression in the Join condition. ''' </summary> Public ReadOnly Property Left As ExpressionSyntax Get Return GetRedAtZero(_left) End Get End Property ''' <summary> ''' Returns a copy of this with the Left property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithLeft(left as ExpressionSyntax) As JoinConditionSyntax return Update(left, Me.EqualsKeyword, Me.Right) End Function ''' <summary> ''' The "Equals" keyword. ''' </summary> Public ReadOnly Property EqualsKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.JoinConditionSyntax)._equalsKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the EqualsKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEqualsKeyword(equalsKeyword as SyntaxToken) As JoinConditionSyntax return Update(Me.Left, equalsKeyword, Me.Right) End Function ''' <summary> ''' The right expression in the Join condition. ''' </summary> Public ReadOnly Property Right As ExpressionSyntax Get Return GetRed(_right, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Right property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithRight(right as ExpressionSyntax) As JoinConditionSyntax return Update(Me.Left, Me.EqualsKeyword, right) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._left Case 2 Return Me._right Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Left Case 2 Return Me.Right Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitJoinCondition(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitJoinCondition(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="left"> ''' The value for the Left property. ''' </param> ''' <param name="equalsKeyword"> ''' The value for the EqualsKeyword property. ''' </param> ''' <param name="right"> ''' The value for the Right property. ''' </param> Public Function Update(left As ExpressionSyntax, equalsKeyword As SyntaxToken, right As ExpressionSyntax) As JoinConditionSyntax If left IsNot Me.Left OrElse equalsKeyword <> Me.EqualsKeyword OrElse right IsNot Me.Right Then Dim newNode = SyntaxFactory.JoinCondition(left, equalsKeyword, right) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a Join query operator. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SimpleJoinClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SimpleJoinClauseSyntax Inherits JoinClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), joinKeyword As InternalSyntax.KeywordSyntax, joinedVariables As SyntaxNode, additionalJoins As SyntaxNode, onKeyword As InternalSyntax.KeywordSyntax, joinConditions As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleJoinClauseSyntax(kind, errors, annotations, joinKeyword, if(joinedVariables IsNot Nothing, joinedVariables.Green, Nothing), if(additionalJoins IsNot Nothing, additionalJoins.Green, Nothing), onKeyword, if(joinConditions IsNot Nothing, joinConditions.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Join" keyword. ''' </summary> Public Shadows ReadOnly Property JoinKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleJoinClauseSyntax)._joinKeyword, Me.Position, 0) End Get End Property Friend Overrides Function GetJoinKeywordCore() As SyntaxToken Return Me.JoinKeyword End Function Friend Overrides Function WithJoinKeywordCore(joinKeyword As SyntaxToken) As JoinClauseSyntax Return WithJoinKeyword(joinKeyword) End Function ''' <summary> ''' Returns a copy of this with the JoinKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithJoinKeyword(joinKeyword as SyntaxToken) As SimpleJoinClauseSyntax return Update(joinKeyword, Me.JoinedVariables, Me.AdditionalJoins, Me.OnKeyword, Me.JoinConditions) End Function ''' <summary> ''' Defines the collection range variables being joined to. ''' </summary> Public Overrides ReadOnly Property JoinedVariables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax) Get Dim listNode = GetRed(_joinedVariables, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of CollectionRangeVariableSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property Friend Overrides Function WithJoinedVariablesCore(joinedVariables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax)) As JoinClauseSyntax Return WithJoinedVariables(joinedVariables) End Function ''' <summary> ''' Returns a copy of this with the JoinedVariables property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithJoinedVariables(joinedVariables as SeparatedSyntaxList(Of CollectionRangeVariableSyntax)) As SimpleJoinClauseSyntax return Update(Me.JoinKeyword, joinedVariables, Me.AdditionalJoins, Me.OnKeyword, Me.JoinConditions) End Function Public Shadows Function AddJoinedVariables(ParamArray items As CollectionRangeVariableSyntax()) As SimpleJoinClauseSyntax Return Me.WithJoinedVariables(Me.JoinedVariables.AddRange(items)) End Function Friend Overrides Function AddJoinedVariablesCore(ParamArray items As CollectionRangeVariableSyntax()) As JoinClauseSyntax Return AddJoinedVariables(items) End Function ''' <summary> ''' An additional Join or Group Join query operator. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AdditionalJoins As SyntaxList(Of JoinClauseSyntax) Get Dim listNode = GetRed(_additionalJoins, 2) Return new SyntaxList(Of JoinClauseSyntax)(listNode) End Get End Property Friend Overrides Function GetAdditionalJoinsCore() As SyntaxList(Of JoinClauseSyntax) Return Me.AdditionalJoins End Function Friend Overrides Function WithAdditionalJoinsCore(additionalJoins As SyntaxList(Of JoinClauseSyntax)) As JoinClauseSyntax Return WithAdditionalJoins(additionalJoins) End Function ''' <summary> ''' Returns a copy of this with the AdditionalJoins property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAdditionalJoins(additionalJoins as SyntaxList(Of JoinClauseSyntax)) As SimpleJoinClauseSyntax return Update(Me.JoinKeyword, Me.JoinedVariables, additionalJoins, Me.OnKeyword, Me.JoinConditions) End Function Public Shadows Function AddAdditionalJoins(ParamArray items As JoinClauseSyntax()) As SimpleJoinClauseSyntax Return Me.WithAdditionalJoins(Me.AdditionalJoins.AddRange(items)) End Function Friend Overrides Function AddAdditionalJoinsCore(ParamArray items As JoinClauseSyntax()) As JoinClauseSyntax Return AddAdditionalJoins(items) End Function ''' <summary> ''' The "On" keyword. ''' </summary> Public Shadows ReadOnly Property OnKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleJoinClauseSyntax)._onKeyword, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property Friend Overrides Function GetOnKeywordCore() As SyntaxToken Return Me.OnKeyword End Function Friend Overrides Function WithOnKeywordCore(onKeyword As SyntaxToken) As JoinClauseSyntax Return WithOnKeyword(onKeyword) End Function ''' <summary> ''' Returns a copy of this with the OnKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOnKeyword(onKeyword as SyntaxToken) As SimpleJoinClauseSyntax return Update(Me.JoinKeyword, Me.JoinedVariables, Me.AdditionalJoins, onKeyword, Me.JoinConditions) End Function ''' <summary> ''' The conditions indicating what expressions to compare during the join. Each ''' condition is a JoinCondition, and the separators are "And" keywords. ''' </summary> Public Overrides ReadOnly Property JoinConditions As SeparatedSyntaxList(Of JoinConditionSyntax) Get Dim listNode = GetRed(_joinConditions, 4) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of JoinConditionSyntax)(listNode, Me.GetChildIndex(4)) End If Return Nothing End Get End Property Friend Overrides Function WithJoinConditionsCore(joinConditions As SeparatedSyntaxList(Of JoinConditionSyntax)) As JoinClauseSyntax Return WithJoinConditions(joinConditions) End Function ''' <summary> ''' Returns a copy of this with the JoinConditions property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithJoinConditions(joinConditions as SeparatedSyntaxList(Of JoinConditionSyntax)) As SimpleJoinClauseSyntax return Update(Me.JoinKeyword, Me.JoinedVariables, Me.AdditionalJoins, Me.OnKeyword, joinConditions) End Function Public Shadows Function AddJoinConditions(ParamArray items As JoinConditionSyntax()) As SimpleJoinClauseSyntax Return Me.WithJoinConditions(Me.JoinConditions.AddRange(items)) End Function Friend Overrides Function AddJoinConditionsCore(ParamArray items As JoinConditionSyntax()) As JoinClauseSyntax Return AddJoinConditions(items) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._joinedVariables Case 2 Return Me._additionalJoins Case 4 Return Me._joinConditions Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_joinedVariables, 1) Case 2 Return GetRed(_additionalJoins, 2) Case 4 Return GetRed(_joinConditions, 4) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSimpleJoinClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSimpleJoinClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="joinKeyword"> ''' The value for the JoinKeyword property. ''' </param> ''' <param name="joinedVariables"> ''' The value for the JoinedVariables property. ''' </param> ''' <param name="additionalJoins"> ''' The value for the AdditionalJoins property. ''' </param> ''' <param name="onKeyword"> ''' The value for the OnKeyword property. ''' </param> ''' <param name="joinConditions"> ''' The value for the JoinConditions property. ''' </param> Public Function Update(joinKeyword As SyntaxToken, joinedVariables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax), additionalJoins As SyntaxList(of JoinClauseSyntax), onKeyword As SyntaxToken, joinConditions As SeparatedSyntaxList(Of JoinConditionSyntax)) As SimpleJoinClauseSyntax If joinKeyword <> Me.JoinKeyword OrElse joinedVariables <> Me.JoinedVariables OrElse additionalJoins <> Me.AdditionalJoins OrElse onKeyword <> Me.OnKeyword OrElse joinConditions <> Me.JoinConditions Then Dim newNode = SyntaxFactory.SimpleJoinClause(joinKeyword, joinedVariables, additionalJoins, onKeyword, joinConditions) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Group Join" query operator. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.GroupJoinClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class GroupJoinClauseSyntax Inherits JoinClauseSyntax Friend _aggregationVariables as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), groupKeyword As InternalSyntax.KeywordSyntax, joinKeyword As InternalSyntax.KeywordSyntax, joinedVariables As SyntaxNode, additionalJoins As SyntaxNode, onKeyword As InternalSyntax.KeywordSyntax, joinConditions As SyntaxNode, intoKeyword As InternalSyntax.KeywordSyntax, aggregationVariables As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GroupJoinClauseSyntax(kind, errors, annotations, groupKeyword, joinKeyword, if(joinedVariables IsNot Nothing, joinedVariables.Green, Nothing), if(additionalJoins IsNot Nothing, additionalJoins.Green, Nothing), onKeyword, if(joinConditions IsNot Nothing, joinConditions.Green, Nothing), intoKeyword, if(aggregationVariables IsNot Nothing, aggregationVariables.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Group" keyword. ''' </summary> Public ReadOnly Property GroupKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GroupJoinClauseSyntax)._groupKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the GroupKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithGroupKeyword(groupKeyword as SyntaxToken) As GroupJoinClauseSyntax return Update(groupKeyword, Me.JoinKeyword, Me.JoinedVariables, Me.AdditionalJoins, Me.OnKeyword, Me.JoinConditions, Me.IntoKeyword, Me.AggregationVariables) End Function ''' <summary> ''' The "Join" keyword. ''' </summary> Public Shadows ReadOnly Property JoinKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GroupJoinClauseSyntax)._joinKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property Friend Overrides Function GetJoinKeywordCore() As SyntaxToken Return Me.JoinKeyword End Function Friend Overrides Function WithJoinKeywordCore(joinKeyword As SyntaxToken) As JoinClauseSyntax Return WithJoinKeyword(joinKeyword) End Function ''' <summary> ''' Returns a copy of this with the JoinKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithJoinKeyword(joinKeyword as SyntaxToken) As GroupJoinClauseSyntax return Update(Me.GroupKeyword, joinKeyword, Me.JoinedVariables, Me.AdditionalJoins, Me.OnKeyword, Me.JoinConditions, Me.IntoKeyword, Me.AggregationVariables) End Function ''' <summary> ''' Defines the collection range variables being joined to. ''' </summary> Public Overrides ReadOnly Property JoinedVariables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax) Get Dim listNode = GetRed(_joinedVariables, 2) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of CollectionRangeVariableSyntax)(listNode, Me.GetChildIndex(2)) End If Return Nothing End Get End Property Friend Overrides Function WithJoinedVariablesCore(joinedVariables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax)) As JoinClauseSyntax Return WithJoinedVariables(joinedVariables) End Function ''' <summary> ''' Returns a copy of this with the JoinedVariables property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithJoinedVariables(joinedVariables as SeparatedSyntaxList(Of CollectionRangeVariableSyntax)) As GroupJoinClauseSyntax return Update(Me.GroupKeyword, Me.JoinKeyword, joinedVariables, Me.AdditionalJoins, Me.OnKeyword, Me.JoinConditions, Me.IntoKeyword, Me.AggregationVariables) End Function Public Shadows Function AddJoinedVariables(ParamArray items As CollectionRangeVariableSyntax()) As GroupJoinClauseSyntax Return Me.WithJoinedVariables(Me.JoinedVariables.AddRange(items)) End Function Friend Overrides Function AddJoinedVariablesCore(ParamArray items As CollectionRangeVariableSyntax()) As JoinClauseSyntax Return AddJoinedVariables(items) End Function ''' <summary> ''' An additional Join or Group Join query operator. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public Shadows ReadOnly Property AdditionalJoins As SyntaxList(Of JoinClauseSyntax) Get Dim listNode = GetRed(_additionalJoins, 3) Return new SyntaxList(Of JoinClauseSyntax)(listNode) End Get End Property Friend Overrides Function GetAdditionalJoinsCore() As SyntaxList(Of JoinClauseSyntax) Return Me.AdditionalJoins End Function Friend Overrides Function WithAdditionalJoinsCore(additionalJoins As SyntaxList(Of JoinClauseSyntax)) As JoinClauseSyntax Return WithAdditionalJoins(additionalJoins) End Function ''' <summary> ''' Returns a copy of this with the AdditionalJoins property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAdditionalJoins(additionalJoins as SyntaxList(Of JoinClauseSyntax)) As GroupJoinClauseSyntax return Update(Me.GroupKeyword, Me.JoinKeyword, Me.JoinedVariables, additionalJoins, Me.OnKeyword, Me.JoinConditions, Me.IntoKeyword, Me.AggregationVariables) End Function Public Shadows Function AddAdditionalJoins(ParamArray items As JoinClauseSyntax()) As GroupJoinClauseSyntax Return Me.WithAdditionalJoins(Me.AdditionalJoins.AddRange(items)) End Function Friend Overrides Function AddAdditionalJoinsCore(ParamArray items As JoinClauseSyntax()) As JoinClauseSyntax Return AddAdditionalJoins(items) End Function ''' <summary> ''' The "On" keyword. ''' </summary> Public Shadows ReadOnly Property OnKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GroupJoinClauseSyntax)._onKeyword, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property Friend Overrides Function GetOnKeywordCore() As SyntaxToken Return Me.OnKeyword End Function Friend Overrides Function WithOnKeywordCore(onKeyword As SyntaxToken) As JoinClauseSyntax Return WithOnKeyword(onKeyword) End Function ''' <summary> ''' Returns a copy of this with the OnKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOnKeyword(onKeyword as SyntaxToken) As GroupJoinClauseSyntax return Update(Me.GroupKeyword, Me.JoinKeyword, Me.JoinedVariables, Me.AdditionalJoins, onKeyword, Me.JoinConditions, Me.IntoKeyword, Me.AggregationVariables) End Function ''' <summary> ''' The conditions indicating what expressions to compare during the join. Each ''' condition is a JoinCondition, and the separators are "And" keywords. ''' </summary> Public Overrides ReadOnly Property JoinConditions As SeparatedSyntaxList(Of JoinConditionSyntax) Get Dim listNode = GetRed(_joinConditions, 5) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of JoinConditionSyntax)(listNode, Me.GetChildIndex(5)) End If Return Nothing End Get End Property Friend Overrides Function WithJoinConditionsCore(joinConditions As SeparatedSyntaxList(Of JoinConditionSyntax)) As JoinClauseSyntax Return WithJoinConditions(joinConditions) End Function ''' <summary> ''' Returns a copy of this with the JoinConditions property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithJoinConditions(joinConditions as SeparatedSyntaxList(Of JoinConditionSyntax)) As GroupJoinClauseSyntax return Update(Me.GroupKeyword, Me.JoinKeyword, Me.JoinedVariables, Me.AdditionalJoins, Me.OnKeyword, joinConditions, Me.IntoKeyword, Me.AggregationVariables) End Function Public Shadows Function AddJoinConditions(ParamArray items As JoinConditionSyntax()) As GroupJoinClauseSyntax Return Me.WithJoinConditions(Me.JoinConditions.AddRange(items)) End Function Friend Overrides Function AddJoinConditionsCore(ParamArray items As JoinConditionSyntax()) As JoinClauseSyntax Return AddJoinConditions(items) End Function ''' <summary> ''' The "Into" keyword. ''' </summary> Public ReadOnly Property IntoKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GroupJoinClauseSyntax)._intoKeyword, Me.GetChildPosition(6), Me.GetChildIndex(6)) End Get End Property ''' <summary> ''' Returns a copy of this with the IntoKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIntoKeyword(intoKeyword as SyntaxToken) As GroupJoinClauseSyntax return Update(Me.GroupKeyword, Me.JoinKeyword, Me.JoinedVariables, Me.AdditionalJoins, Me.OnKeyword, Me.JoinConditions, intoKeyword, Me.AggregationVariables) End Function ''' <summary> ''' The list of new variables that calculate aggregations. ''' </summary> Public ReadOnly Property AggregationVariables As SeparatedSyntaxList(Of AggregationRangeVariableSyntax) Get Dim listNode = GetRed(_aggregationVariables, 7) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of AggregationRangeVariableSyntax)(listNode, Me.GetChildIndex(7)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the AggregationVariables property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAggregationVariables(aggregationVariables as SeparatedSyntaxList(Of AggregationRangeVariableSyntax)) As GroupJoinClauseSyntax return Update(Me.GroupKeyword, Me.JoinKeyword, Me.JoinedVariables, Me.AdditionalJoins, Me.OnKeyword, Me.JoinConditions, Me.IntoKeyword, aggregationVariables) End Function Public Shadows Function AddAggregationVariables(ParamArray items As AggregationRangeVariableSyntax()) As GroupJoinClauseSyntax Return Me.WithAggregationVariables(Me.AggregationVariables.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._joinedVariables Case 3 Return Me._additionalJoins Case 5 Return Me._joinConditions Case 7 Return Me._aggregationVariables Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return GetRed(_joinedVariables, 2) Case 3 Return GetRed(_additionalJoins, 3) Case 5 Return GetRed(_joinConditions, 5) Case 7 Return GetRed(_aggregationVariables, 7) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitGroupJoinClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitGroupJoinClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="groupKeyword"> ''' The value for the GroupKeyword property. ''' </param> ''' <param name="joinKeyword"> ''' The value for the JoinKeyword property. ''' </param> ''' <param name="joinedVariables"> ''' The value for the JoinedVariables property. ''' </param> ''' <param name="additionalJoins"> ''' The value for the AdditionalJoins property. ''' </param> ''' <param name="onKeyword"> ''' The value for the OnKeyword property. ''' </param> ''' <param name="joinConditions"> ''' The value for the JoinConditions property. ''' </param> ''' <param name="intoKeyword"> ''' The value for the IntoKeyword property. ''' </param> ''' <param name="aggregationVariables"> ''' The value for the AggregationVariables property. ''' </param> Public Function Update(groupKeyword As SyntaxToken, joinKeyword As SyntaxToken, joinedVariables As SeparatedSyntaxList(Of CollectionRangeVariableSyntax), additionalJoins As SyntaxList(of JoinClauseSyntax), onKeyword As SyntaxToken, joinConditions As SeparatedSyntaxList(Of JoinConditionSyntax), intoKeyword As SyntaxToken, aggregationVariables As SeparatedSyntaxList(Of AggregationRangeVariableSyntax)) As GroupJoinClauseSyntax If groupKeyword <> Me.GroupKeyword OrElse joinKeyword <> Me.JoinKeyword OrElse joinedVariables <> Me.JoinedVariables OrElse additionalJoins <> Me.AdditionalJoins OrElse onKeyword <> Me.OnKeyword OrElse joinConditions <> Me.JoinConditions OrElse intoKeyword <> Me.IntoKeyword OrElse aggregationVariables <> Me.AggregationVariables Then Dim newNode = SyntaxFactory.GroupJoinClause(groupKeyword, joinKeyword, joinedVariables, additionalJoins, onKeyword, joinConditions, intoKeyword, aggregationVariables) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Order By" query operator. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.OrderByClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class OrderByClauseSyntax Inherits QueryClauseSyntax Friend _orderings as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), orderKeyword As InternalSyntax.KeywordSyntax, byKeyword As InternalSyntax.KeywordSyntax, orderings As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OrderByClauseSyntax(kind, errors, annotations, orderKeyword, byKeyword, if(orderings IsNot Nothing, orderings.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Order" keyword ''' </summary> Public ReadOnly Property OrderKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OrderByClauseSyntax)._orderKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OrderKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOrderKeyword(orderKeyword as SyntaxToken) As OrderByClauseSyntax return Update(orderKeyword, Me.ByKeyword, Me.Orderings) End Function ''' <summary> ''' The "By" keyword. ''' </summary> Public ReadOnly Property ByKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OrderByClauseSyntax)._byKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ByKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithByKeyword(byKeyword as SyntaxToken) As OrderByClauseSyntax return Update(Me.OrderKeyword, byKeyword, Me.Orderings) End Function ''' <summary> ''' The list of OrderExpression's to sort by. ''' </summary> Public ReadOnly Property Orderings As SeparatedSyntaxList(Of OrderingSyntax) Get Dim listNode = GetRed(_orderings, 2) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of OrderingSyntax)(listNode, Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Orderings property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOrderings(orderings as SeparatedSyntaxList(Of OrderingSyntax)) As OrderByClauseSyntax return Update(Me.OrderKeyword, Me.ByKeyword, orderings) End Function Public Shadows Function AddOrderings(ParamArray items As OrderingSyntax()) As OrderByClauseSyntax Return Me.WithOrderings(Me.Orderings.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._orderings Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return GetRed(_orderings, 2) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitOrderByClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitOrderByClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="orderKeyword"> ''' The value for the OrderKeyword property. ''' </param> ''' <param name="byKeyword"> ''' The value for the ByKeyword property. ''' </param> ''' <param name="orderings"> ''' The value for the Orderings property. ''' </param> Public Function Update(orderKeyword As SyntaxToken, byKeyword As SyntaxToken, orderings As SeparatedSyntaxList(Of OrderingSyntax)) As OrderByClauseSyntax If orderKeyword <> Me.OrderKeyword OrElse byKeyword <> Me.ByKeyword OrElse orderings <> Me.Orderings Then Dim newNode = SyntaxFactory.OrderByClause(orderKeyword, byKeyword, orderings) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' An expression to order by, plus an optional ordering. The Kind indicates ''' whether to order in ascending or descending order. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.AscendingOrdering"/></description></item> ''' <item><description><see cref="SyntaxKind.DescendingOrdering"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class OrderingSyntax Inherits VisualBasicSyntaxNode Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), expression As ExpressionSyntax, ascendingOrDescendingKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OrderingSyntax(kind, errors, annotations, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), ascendingOrDescendingKeyword), Nothing, 0) End Sub ''' <summary> ''' The expression to sort by. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRedAtZero(_expression) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As OrderingSyntax return Update(Me.Kind, expression, Me.AscendingOrDescendingKeyword) End Function ''' <summary> ''' The "Ascending" or "Descending" keyword, if present. To determine whether to ''' sort in ascending or descending order, checking the Kind property is easier. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AscendingOrDescendingKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.OrderingSyntax)._ascendingOrDescendingKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the AscendingOrDescendingKeyword property changed ''' to the specified value. Returns this instance if the specified value is the ''' same as the current value. ''' </summary> Public Shadows Function WithAscendingOrDescendingKeyword(ascendingOrDescendingKeyword as SyntaxToken) As OrderingSyntax return Update(Me.Kind, Me.Expression, ascendingOrDescendingKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitOrdering(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitOrdering(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="ascendingOrDescendingKeyword"> ''' The value for the AscendingOrDescendingKeyword property. ''' </param> Public Function Update(kind As SyntaxKind, expression As ExpressionSyntax, ascendingOrDescendingKeyword As SyntaxToken) As OrderingSyntax If kind <> Me.Kind OrElse expression IsNot Me.Expression OrElse ascendingOrDescendingKeyword <> Me.AscendingOrDescendingKeyword Then Dim newNode = SyntaxFactory.Ordering(kind, expression, ascendingOrDescendingKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the "Select" query operator. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SelectClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SelectClauseSyntax Inherits QueryClauseSyntax Friend _variables as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), selectKeyword As InternalSyntax.KeywordSyntax, variables As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SelectClauseSyntax(kind, errors, annotations, selectKeyword, if(variables IsNot Nothing, variables.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "Select" keyword. ''' </summary> Public ReadOnly Property SelectKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SelectClauseSyntax)._selectKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the SelectKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithSelectKeyword(selectKeyword as SyntaxToken) As SelectClauseSyntax return Update(selectKeyword, Me.Variables) End Function ''' <summary> ''' The list of expression range variables being defined by the Select query ''' operator. ''' </summary> Public ReadOnly Property Variables As SeparatedSyntaxList(Of ExpressionRangeVariableSyntax) Get Dim listNode = GetRed(_variables, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of ExpressionRangeVariableSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Variables property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithVariables(variables as SeparatedSyntaxList(Of ExpressionRangeVariableSyntax)) As SelectClauseSyntax return Update(Me.SelectKeyword, variables) End Function Public Shadows Function AddVariables(ParamArray items As ExpressionRangeVariableSyntax()) As SelectClauseSyntax Return Me.WithVariables(Me.Variables.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._variables Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_variables, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSelectClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSelectClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="selectKeyword"> ''' The value for the SelectKeyword property. ''' </param> ''' <param name="variables"> ''' The value for the Variables property. ''' </param> Public Function Update(selectKeyword As SyntaxToken, variables As SeparatedSyntaxList(Of ExpressionRangeVariableSyntax)) As SelectClauseSyntax If selectKeyword <> Me.SelectKeyword OrElse variables <> Me.Variables Then Dim newNode = SyntaxFactory.SelectClause(selectKeyword, variables) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' This is the base class for all XML expression syntax nodes (XmlDocument and ''' XmlElement). ''' </summary> Public MustInherit Class XmlNodeSyntax Inherits ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents an XML Document literal expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlDocument"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlDocumentSyntax Inherits XmlNodeSyntax Friend _declaration as XmlDeclarationSyntax Friend _precedingMisc as SyntaxNode Friend _root as XmlNodeSyntax Friend _followingMisc as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), declaration As XmlDeclarationSyntax, precedingMisc As SyntaxNode, root As XmlNodeSyntax, followingMisc As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDocumentSyntax(kind, errors, annotations, DirectCast(declaration.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDeclarationSyntax), if(precedingMisc IsNot Nothing, precedingMisc.Green, Nothing), DirectCast(root.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNodeSyntax), if(followingMisc IsNot Nothing, followingMisc.Green, Nothing)), Nothing, 0) End Sub Public ReadOnly Property Declaration As XmlDeclarationSyntax Get Return GetRedAtZero(_declaration) End Get End Property ''' <summary> ''' Returns a copy of this with the Declaration property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithDeclaration(declaration as XmlDeclarationSyntax) As XmlDocumentSyntax return Update(declaration, Me.PrecedingMisc, Me.Root, Me.FollowingMisc) End Function ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property PrecedingMisc As SyntaxList(Of XmlNodeSyntax) Get Dim listNode = GetRed(_precedingMisc, 1) Return new SyntaxList(Of XmlNodeSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the PrecedingMisc property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithPrecedingMisc(precedingMisc as SyntaxList(Of XmlNodeSyntax)) As XmlDocumentSyntax return Update(Me.Declaration, precedingMisc, Me.Root, Me.FollowingMisc) End Function Public Shadows Function AddPrecedingMisc(ParamArray items As XmlNodeSyntax()) As XmlDocumentSyntax Return Me.WithPrecedingMisc(Me.PrecedingMisc.AddRange(items)) End Function Public ReadOnly Property Root As XmlNodeSyntax Get Return GetRed(_root, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Root property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithRoot(root as XmlNodeSyntax) As XmlDocumentSyntax return Update(Me.Declaration, Me.PrecedingMisc, root, Me.FollowingMisc) End Function ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property FollowingMisc As SyntaxList(Of XmlNodeSyntax) Get Dim listNode = GetRed(_followingMisc, 3) Return new SyntaxList(Of XmlNodeSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the FollowingMisc property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithFollowingMisc(followingMisc as SyntaxList(Of XmlNodeSyntax)) As XmlDocumentSyntax return Update(Me.Declaration, Me.PrecedingMisc, Me.Root, followingMisc) End Function Public Shadows Function AddFollowingMisc(ParamArray items As XmlNodeSyntax()) As XmlDocumentSyntax Return Me.WithFollowingMisc(Me.FollowingMisc.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._declaration Case 1 Return Me._precedingMisc Case 2 Return Me._root Case 3 Return Me._followingMisc Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Declaration Case 1 Return GetRed(_precedingMisc, 1) Case 2 Return Me.Root Case 3 Return GetRed(_followingMisc, 3) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlDocument(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlDocument(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="declaration"> ''' The value for the Declaration property. ''' </param> ''' <param name="precedingMisc"> ''' The value for the PrecedingMisc property. ''' </param> ''' <param name="root"> ''' The value for the Root property. ''' </param> ''' <param name="followingMisc"> ''' The value for the FollowingMisc property. ''' </param> Public Function Update(declaration As XmlDeclarationSyntax, precedingMisc As SyntaxList(of XmlNodeSyntax), root As XmlNodeSyntax, followingMisc As SyntaxList(of XmlNodeSyntax)) As XmlDocumentSyntax If declaration IsNot Me.Declaration OrElse precedingMisc <> Me.PrecedingMisc OrElse root IsNot Me.Root OrElse followingMisc <> Me.FollowingMisc Then Dim newNode = SyntaxFactory.XmlDocument(declaration, precedingMisc, root, followingMisc) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the XML declaration prologue in an XML literal expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlDeclaration"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlDeclarationSyntax Inherits VisualBasicSyntaxNode Friend _version as XmlDeclarationOptionSyntax Friend _encoding as XmlDeclarationOptionSyntax Friend _standalone as XmlDeclarationOptionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lessThanQuestionToken As InternalSyntax.PunctuationSyntax, xmlKeyword As InternalSyntax.KeywordSyntax, version As XmlDeclarationOptionSyntax, encoding As XmlDeclarationOptionSyntax, standalone As XmlDeclarationOptionSyntax, questionGreaterThanToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDeclarationSyntax(kind, errors, annotations, lessThanQuestionToken, xmlKeyword, DirectCast(version.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDeclarationOptionSyntax), if(encoding IsNot Nothing, DirectCast(encoding.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDeclarationOptionSyntax), Nothing), if(standalone IsNot Nothing, DirectCast(standalone.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDeclarationOptionSyntax), Nothing), questionGreaterThanToken), Nothing, 0) End Sub Public ReadOnly Property LessThanQuestionToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDeclarationSyntax)._lessThanQuestionToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LessThanQuestionToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithLessThanQuestionToken(lessThanQuestionToken as SyntaxToken) As XmlDeclarationSyntax return Update(lessThanQuestionToken, Me.XmlKeyword, Me.Version, Me.Encoding, Me.Standalone, Me.QuestionGreaterThanToken) End Function Public ReadOnly Property XmlKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDeclarationSyntax)._xmlKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the XmlKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithXmlKeyword(xmlKeyword as SyntaxToken) As XmlDeclarationSyntax return Update(Me.LessThanQuestionToken, xmlKeyword, Me.Version, Me.Encoding, Me.Standalone, Me.QuestionGreaterThanToken) End Function Public ReadOnly Property Version As XmlDeclarationOptionSyntax Get Return GetRed(_version, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Version property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithVersion(version as XmlDeclarationOptionSyntax) As XmlDeclarationSyntax return Update(Me.LessThanQuestionToken, Me.XmlKeyword, version, Me.Encoding, Me.Standalone, Me.QuestionGreaterThanToken) End Function ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Encoding As XmlDeclarationOptionSyntax Get Return GetRed(_encoding, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the Encoding property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEncoding(encoding as XmlDeclarationOptionSyntax) As XmlDeclarationSyntax return Update(Me.LessThanQuestionToken, Me.XmlKeyword, Me.Version, encoding, Me.Standalone, Me.QuestionGreaterThanToken) End Function ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Standalone As XmlDeclarationOptionSyntax Get Return GetRed(_standalone, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the Standalone property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStandalone(standalone as XmlDeclarationOptionSyntax) As XmlDeclarationSyntax return Update(Me.LessThanQuestionToken, Me.XmlKeyword, Me.Version, Me.Encoding, standalone, Me.QuestionGreaterThanToken) End Function Public ReadOnly Property QuestionGreaterThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDeclarationSyntax)._questionGreaterThanToken, Me.GetChildPosition(5), Me.GetChildIndex(5)) End Get End Property ''' <summary> ''' Returns a copy of this with the QuestionGreaterThanToken property changed to ''' the specified value. Returns this instance if the specified value is the same ''' as the current value. ''' </summary> Public Shadows Function WithQuestionGreaterThanToken(questionGreaterThanToken as SyntaxToken) As XmlDeclarationSyntax return Update(Me.LessThanQuestionToken, Me.XmlKeyword, Me.Version, Me.Encoding, Me.Standalone, questionGreaterThanToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._version Case 3 Return Me._encoding Case 4 Return Me._standalone Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Version Case 3 Return Me.Encoding Case 4 Return Me.Standalone Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlDeclaration(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlDeclaration(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lessThanQuestionToken"> ''' The value for the LessThanQuestionToken property. ''' </param> ''' <param name="xmlKeyword"> ''' The value for the XmlKeyword property. ''' </param> ''' <param name="version"> ''' The value for the Version property. ''' </param> ''' <param name="encoding"> ''' The value for the Encoding property. ''' </param> ''' <param name="standalone"> ''' The value for the Standalone property. ''' </param> ''' <param name="questionGreaterThanToken"> ''' The value for the QuestionGreaterThanToken property. ''' </param> Public Function Update(lessThanQuestionToken As SyntaxToken, xmlKeyword As SyntaxToken, version As XmlDeclarationOptionSyntax, encoding As XmlDeclarationOptionSyntax, standalone As XmlDeclarationOptionSyntax, questionGreaterThanToken As SyntaxToken) As XmlDeclarationSyntax If lessThanQuestionToken <> Me.LessThanQuestionToken OrElse xmlKeyword <> Me.XmlKeyword OrElse version IsNot Me.Version OrElse encoding IsNot Me.Encoding OrElse standalone IsNot Me.Standalone OrElse questionGreaterThanToken <> Me.QuestionGreaterThanToken Then Dim newNode = SyntaxFactory.XmlDeclaration(lessThanQuestionToken, xmlKeyword, version, encoding, standalone, questionGreaterThanToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML document prologue option - version, encoding, standalone or ''' whitespace in an XML literal expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlDeclarationOption"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlDeclarationOptionSyntax Inherits VisualBasicSyntaxNode Friend _value as XmlStringSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), name As InternalSyntax.XmlNameTokenSyntax, equals As InternalSyntax.PunctuationSyntax, value As XmlStringSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDeclarationOptionSyntax(kind, errors, annotations, name, equals, DirectCast(value.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlStringSyntax)), Nothing, 0) End Sub Public ReadOnly Property Name As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDeclarationOptionSyntax)._name, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as SyntaxToken) As XmlDeclarationOptionSyntax return Update(name, Me.Equals, Me.Value) End Function Public Shadows ReadOnly Property Equals As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlDeclarationOptionSyntax)._equals, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the Equals property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithEquals(equals as SyntaxToken) As XmlDeclarationOptionSyntax return Update(Me.Name, equals, Me.Value) End Function Public ReadOnly Property Value As XmlStringSyntax Get Return GetRed(_value, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Value property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithValue(value as XmlStringSyntax) As XmlDeclarationOptionSyntax return Update(Me.Name, Me.Equals, value) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._value Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Value Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlDeclarationOption(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlDeclarationOption(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="equals"> ''' The value for the Equals property. ''' </param> ''' <param name="value"> ''' The value for the Value property. ''' </param> Public Function Update(name As SyntaxToken, equals As SyntaxToken, value As XmlStringSyntax) As XmlDeclarationOptionSyntax If name <> Me.Name OrElse equals <> Me.Equals OrElse value IsNot Me.Value Then Dim newNode = SyntaxFactory.XmlDeclarationOption(name, equals, value) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML element with content in an XML literal expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlElement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlElementSyntax Inherits XmlNodeSyntax Friend _startTag as XmlElementStartTagSyntax Friend _content as SyntaxNode Friend _endTag as XmlElementEndTagSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), startTag As XmlElementStartTagSyntax, content As SyntaxNode, endTag As XmlElementEndTagSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlElementSyntax(kind, errors, annotations, DirectCast(startTag.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlElementStartTagSyntax), if(content IsNot Nothing, content.Green, Nothing), DirectCast(endTag.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlElementEndTagSyntax)), Nothing, 0) End Sub Public ReadOnly Property StartTag As XmlElementStartTagSyntax Get Return GetRedAtZero(_startTag) End Get End Property ''' <summary> ''' Returns a copy of this with the StartTag property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithStartTag(startTag as XmlElementStartTagSyntax) As XmlElementSyntax return Update(startTag, Me.Content, Me.EndTag) End Function ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Content As SyntaxList(Of XmlNodeSyntax) Get Dim listNode = GetRed(_content, 1) Return new SyntaxList(Of XmlNodeSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Content property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithContent(content as SyntaxList(Of XmlNodeSyntax)) As XmlElementSyntax return Update(Me.StartTag, content, Me.EndTag) End Function Public Shadows Function AddContent(ParamArray items As XmlNodeSyntax()) As XmlElementSyntax Return Me.WithContent(Me.Content.AddRange(items)) End Function Public ReadOnly Property EndTag As XmlElementEndTagSyntax Get Return GetRed(_endTag, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the EndTag property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithEndTag(endTag as XmlElementEndTagSyntax) As XmlElementSyntax return Update(Me.StartTag, Me.Content, endTag) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._startTag Case 1 Return Me._content Case 2 Return Me._endTag Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.StartTag Case 1 Return GetRed(_content, 1) Case 2 Return Me.EndTag Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlElement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlElement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="startTag"> ''' The value for the StartTag property. ''' </param> ''' <param name="content"> ''' The value for the Content property. ''' </param> ''' <param name="endTag"> ''' The value for the EndTag property. ''' </param> Public Function Update(startTag As XmlElementStartTagSyntax, content As SyntaxList(of XmlNodeSyntax), endTag As XmlElementEndTagSyntax) As XmlElementSyntax If startTag IsNot Me.StartTag OrElse content <> Me.Content OrElse endTag IsNot Me.EndTag Then Dim newNode = SyntaxFactory.XmlElement(startTag, content, endTag) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents Xml text. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlText"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlTextSyntax Inherits XmlNodeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), textTokens As GreenNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlTextSyntax(kind, errors, annotations, textTokens), Nothing, 0) End Sub ''' <summary> ''' A list of all the text tokens in the Xml text. This list always contains at ''' least one token. ''' </summary> Public ReadOnly Property TextTokens As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlTextSyntax)._textTokens If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.Position, 0) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the TextTokens property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithTextTokens(textTokens as SyntaxTokenList) As XmlTextSyntax return Update(textTokens) End Function Public Shadows Function AddTextTokens(ParamArray items As SyntaxToken()) As XmlTextSyntax Return Me.WithTextTokens(Me.TextTokens.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlText(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlText(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="textTokens"> ''' The value for the TextTokens property. ''' </param> Public Function Update(textTokens As SyntaxTokenList) As XmlTextSyntax If textTokens <> Me.TextTokens Then Dim newNode = SyntaxFactory.XmlText(textTokens) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the start tag of an XML element of the form <element>. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlElementStartTag"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlElementStartTagSyntax Inherits XmlNodeSyntax Friend _name as XmlNodeSyntax Friend _attributes as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lessThanToken As InternalSyntax.PunctuationSyntax, name As XmlNodeSyntax, attributes As SyntaxNode, greaterThanToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlElementStartTagSyntax(kind, errors, annotations, lessThanToken, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNodeSyntax), if(attributes IsNot Nothing, attributes.Green, Nothing), greaterThanToken), Nothing, 0) End Sub Public ReadOnly Property LessThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlElementStartTagSyntax)._lessThanToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LessThanToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLessThanToken(lessThanToken as SyntaxToken) As XmlElementStartTagSyntax return Update(lessThanToken, Me.Name, Me.Attributes, Me.GreaterThanToken) End Function Public ReadOnly Property Name As XmlNodeSyntax Get Return GetRed(_name, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as XmlNodeSyntax) As XmlElementStartTagSyntax return Update(Me.LessThanToken, name, Me.Attributes, Me.GreaterThanToken) End Function ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Attributes As SyntaxList(Of XmlNodeSyntax) Get Dim listNode = GetRed(_attributes, 2) Return new SyntaxList(Of XmlNodeSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Attributes property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAttributes(attributes as SyntaxList(Of XmlNodeSyntax)) As XmlElementStartTagSyntax return Update(Me.LessThanToken, Me.Name, attributes, Me.GreaterThanToken) End Function Public Shadows Function AddAttributes(ParamArray items As XmlNodeSyntax()) As XmlElementStartTagSyntax Return Me.WithAttributes(Me.Attributes.AddRange(items)) End Function Public ReadOnly Property GreaterThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlElementStartTagSyntax)._greaterThanToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the GreaterThanToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithGreaterThanToken(greaterThanToken as SyntaxToken) As XmlElementStartTagSyntax return Update(Me.LessThanToken, Me.Name, Me.Attributes, greaterThanToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._name Case 2 Return Me._attributes Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Name Case 2 Return GetRed(_attributes, 2) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlElementStartTag(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlElementStartTag(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lessThanToken"> ''' The value for the LessThanToken property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="attributes"> ''' The value for the Attributes property. ''' </param> ''' <param name="greaterThanToken"> ''' The value for the GreaterThanToken property. ''' </param> Public Function Update(lessThanToken As SyntaxToken, name As XmlNodeSyntax, attributes As SyntaxList(of XmlNodeSyntax), greaterThanToken As SyntaxToken) As XmlElementStartTagSyntax If lessThanToken <> Me.LessThanToken OrElse name IsNot Me.Name OrElse attributes <> Me.Attributes OrElse greaterThanToken <> Me.GreaterThanToken Then Dim newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the end tag of an XML element of the form </element>. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlElementEndTag"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlElementEndTagSyntax Inherits XmlNodeSyntax Friend _name as XmlNameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lessThanSlashToken As InternalSyntax.PunctuationSyntax, name As XmlNameSyntax, greaterThanToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlElementEndTagSyntax(kind, errors, annotations, lessThanSlashToken, if(name IsNot Nothing, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNameSyntax), Nothing), greaterThanToken), Nothing, 0) End Sub Public ReadOnly Property LessThanSlashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlElementEndTagSyntax)._lessThanSlashToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LessThanSlashToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithLessThanSlashToken(lessThanSlashToken as SyntaxToken) As XmlElementEndTagSyntax return Update(lessThanSlashToken, Me.Name, Me.GreaterThanToken) End Function ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Name As XmlNameSyntax Get Return GetRed(_name, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as XmlNameSyntax) As XmlElementEndTagSyntax return Update(Me.LessThanSlashToken, name, Me.GreaterThanToken) End Function Public ReadOnly Property GreaterThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlElementEndTagSyntax)._greaterThanToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the GreaterThanToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithGreaterThanToken(greaterThanToken as SyntaxToken) As XmlElementEndTagSyntax return Update(Me.LessThanSlashToken, Me.Name, greaterThanToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._name Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Name Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlElementEndTag(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlElementEndTag(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lessThanSlashToken"> ''' The value for the LessThanSlashToken property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="greaterThanToken"> ''' The value for the GreaterThanToken property. ''' </param> Public Function Update(lessThanSlashToken As SyntaxToken, name As XmlNameSyntax, greaterThanToken As SyntaxToken) As XmlElementEndTagSyntax If lessThanSlashToken <> Me.LessThanSlashToken OrElse name IsNot Me.Name OrElse greaterThanToken <> Me.GreaterThanToken Then Dim newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an empty XML element of the form <element /> ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlEmptyElement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlEmptyElementSyntax Inherits XmlNodeSyntax Friend _name as XmlNodeSyntax Friend _attributes as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lessThanToken As InternalSyntax.PunctuationSyntax, name As XmlNodeSyntax, attributes As SyntaxNode, slashGreaterThanToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlEmptyElementSyntax(kind, errors, annotations, lessThanToken, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNodeSyntax), if(attributes IsNot Nothing, attributes.Green, Nothing), slashGreaterThanToken), Nothing, 0) End Sub Public ReadOnly Property LessThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlEmptyElementSyntax)._lessThanToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LessThanToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLessThanToken(lessThanToken as SyntaxToken) As XmlEmptyElementSyntax return Update(lessThanToken, Me.Name, Me.Attributes, Me.SlashGreaterThanToken) End Function Public ReadOnly Property Name As XmlNodeSyntax Get Return GetRed(_name, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as XmlNodeSyntax) As XmlEmptyElementSyntax return Update(Me.LessThanToken, name, Me.Attributes, Me.SlashGreaterThanToken) End Function ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Attributes As SyntaxList(Of XmlNodeSyntax) Get Dim listNode = GetRed(_attributes, 2) Return new SyntaxList(Of XmlNodeSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Attributes property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAttributes(attributes as SyntaxList(Of XmlNodeSyntax)) As XmlEmptyElementSyntax return Update(Me.LessThanToken, Me.Name, attributes, Me.SlashGreaterThanToken) End Function Public Shadows Function AddAttributes(ParamArray items As XmlNodeSyntax()) As XmlEmptyElementSyntax Return Me.WithAttributes(Me.Attributes.AddRange(items)) End Function Public ReadOnly Property SlashGreaterThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlEmptyElementSyntax)._slashGreaterThanToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the SlashGreaterThanToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSlashGreaterThanToken(slashGreaterThanToken as SyntaxToken) As XmlEmptyElementSyntax return Update(Me.LessThanToken, Me.Name, Me.Attributes, slashGreaterThanToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._name Case 2 Return Me._attributes Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Name Case 2 Return GetRed(_attributes, 2) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlEmptyElement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlEmptyElement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lessThanToken"> ''' The value for the LessThanToken property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="attributes"> ''' The value for the Attributes property. ''' </param> ''' <param name="slashGreaterThanToken"> ''' The value for the SlashGreaterThanToken property. ''' </param> Public Function Update(lessThanToken As SyntaxToken, name As XmlNodeSyntax, attributes As SyntaxList(of XmlNodeSyntax), slashGreaterThanToken As SyntaxToken) As XmlEmptyElementSyntax If lessThanToken <> Me.LessThanToken OrElse name IsNot Me.Name OrElse attributes <> Me.Attributes OrElse slashGreaterThanToken <> Me.SlashGreaterThanToken Then Dim newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML attribute in an XML literal expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlAttribute"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlAttributeSyntax Inherits BaseXmlAttributeSyntax Friend _name as XmlNodeSyntax Friend _value as XmlNodeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), name As XmlNodeSyntax, equalsToken As InternalSyntax.PunctuationSyntax, value As XmlNodeSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlAttributeSyntax(kind, errors, annotations, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNodeSyntax), equalsToken, DirectCast(value.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNodeSyntax)), Nothing, 0) End Sub Public ReadOnly Property Name As XmlNodeSyntax Get Return GetRedAtZero(_name) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as XmlNodeSyntax) As XmlAttributeSyntax return Update(name, Me.EqualsToken, Me.Value) End Function Public ReadOnly Property EqualsToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlAttributeSyntax)._equalsToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the EqualsToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEqualsToken(equalsToken as SyntaxToken) As XmlAttributeSyntax return Update(Me.Name, equalsToken, Me.Value) End Function Public ReadOnly Property Value As XmlNodeSyntax Get Return GetRed(_value, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Value property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithValue(value as XmlNodeSyntax) As XmlAttributeSyntax return Update(Me.Name, Me.EqualsToken, value) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._name Case 2 Return Me._value Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Name Case 2 Return Me.Value Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlAttribute(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlAttribute(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="equalsToken"> ''' The value for the EqualsToken property. ''' </param> ''' <param name="value"> ''' The value for the Value property. ''' </param> Public Function Update(name As XmlNodeSyntax, equalsToken As SyntaxToken, value As XmlNodeSyntax) As XmlAttributeSyntax If name IsNot Me.Name OrElse equalsToken <> Me.EqualsToken OrElse value IsNot Me.Value Then Dim newNode = SyntaxFactory.XmlAttribute(name, equalsToken, value) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML attribute in an XML literal expression. ''' </summary> Public MustInherit Class BaseXmlAttributeSyntax Inherits XmlNodeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents a string of XML characters embedded as the content of an XML ''' element. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlString"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlStringSyntax Inherits XmlNodeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), startQuoteToken As InternalSyntax.PunctuationSyntax, textTokens As GreenNode, endQuoteToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlStringSyntax(kind, errors, annotations, startQuoteToken, textTokens, endQuoteToken), Nothing, 0) End Sub Public ReadOnly Property StartQuoteToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlStringSyntax)._startQuoteToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the StartQuoteToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithStartQuoteToken(startQuoteToken as SyntaxToken) As XmlStringSyntax return Update(startQuoteToken, Me.TextTokens, Me.EndQuoteToken) End Function ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property TextTokens As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlStringSyntax)._textTokens If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the TextTokens property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithTextTokens(textTokens as SyntaxTokenList) As XmlStringSyntax return Update(Me.StartQuoteToken, textTokens, Me.EndQuoteToken) End Function Public Shadows Function AddTextTokens(ParamArray items As SyntaxToken()) As XmlStringSyntax Return Me.WithTextTokens(Me.TextTokens.AddRange(items)) End Function Public ReadOnly Property EndQuoteToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlStringSyntax)._endQuoteToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the EndQuoteToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEndQuoteToken(endQuoteToken as SyntaxToken) As XmlStringSyntax return Update(Me.StartQuoteToken, Me.TextTokens, endQuoteToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlString(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlString(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="startQuoteToken"> ''' The value for the StartQuoteToken property. ''' </param> ''' <param name="textTokens"> ''' The value for the TextTokens property. ''' </param> ''' <param name="endQuoteToken"> ''' The value for the EndQuoteToken property. ''' </param> Public Function Update(startQuoteToken As SyntaxToken, textTokens As SyntaxTokenList, endQuoteToken As SyntaxToken) As XmlStringSyntax If startQuoteToken <> Me.StartQuoteToken OrElse textTokens <> Me.TextTokens OrElse endQuoteToken <> Me.EndQuoteToken Then Dim newNode = SyntaxFactory.XmlString(startQuoteToken, textTokens, endQuoteToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML name of the form 'name' appearing in GetXmlNamespace(). ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlPrefixName"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlPrefixNameSyntax Inherits XmlNodeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), name As InternalSyntax.XmlNameTokenSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlPrefixNameSyntax(kind, errors, annotations, name), Nothing, 0) End Sub Public ReadOnly Property Name As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlPrefixNameSyntax)._name, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as SyntaxToken) As XmlPrefixNameSyntax return Update(name) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlPrefixName(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlPrefixName(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="name"> ''' The value for the Name property. ''' </param> Public Function Update(name As SyntaxToken) As XmlPrefixNameSyntax If name <> Me.Name Then Dim newNode = SyntaxFactory.XmlPrefixName(name) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML name of the form 'name' or 'namespace:name' appearing in ''' source as part of an XML literal or member access expression or an XML ''' namespace import clause. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlName"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlNameSyntax Inherits XmlNodeSyntax Friend _prefix as XmlPrefixSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), prefix As XmlPrefixSyntax, localName As InternalSyntax.XmlNameTokenSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNameSyntax(kind, errors, annotations, if(prefix IsNot Nothing, DirectCast(prefix.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlPrefixSyntax), Nothing), localName), Nothing, 0) End Sub ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Prefix As XmlPrefixSyntax Get Return GetRedAtZero(_prefix) End Get End Property ''' <summary> ''' Returns a copy of this with the Prefix property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithPrefix(prefix as XmlPrefixSyntax) As XmlNameSyntax return Update(prefix, Me.LocalName) End Function Public ReadOnly Property LocalName As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNameSyntax)._localName, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the LocalName property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLocalName(localName as SyntaxToken) As XmlNameSyntax return Update(Me.Prefix, localName) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._prefix Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Prefix Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlName(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlName(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="prefix"> ''' The value for the Prefix property. ''' </param> ''' <param name="localName"> ''' The value for the LocalName property. ''' </param> Public Function Update(prefix As XmlPrefixSyntax, localName As SyntaxToken) As XmlNameSyntax If prefix IsNot Me.Prefix OrElse localName <> Me.LocalName Then Dim newNode = SyntaxFactory.XmlName(prefix, localName) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML name of the form <xml-name> appearing in source as part ''' of an XML literal or member access expression or an XML namespace import ''' clause. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlBracketedName"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlBracketedNameSyntax Inherits XmlNodeSyntax Friend _name as XmlNameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lessThanToken As InternalSyntax.PunctuationSyntax, name As XmlNameSyntax, greaterThanToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlBracketedNameSyntax(kind, errors, annotations, lessThanToken, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNameSyntax), greaterThanToken), Nothing, 0) End Sub Public ReadOnly Property LessThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlBracketedNameSyntax)._lessThanToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LessThanToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLessThanToken(lessThanToken as SyntaxToken) As XmlBracketedNameSyntax return Update(lessThanToken, Me.Name, Me.GreaterThanToken) End Function Public ReadOnly Property Name As XmlNameSyntax Get Return GetRed(_name, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as XmlNameSyntax) As XmlBracketedNameSyntax return Update(Me.LessThanToken, name, Me.GreaterThanToken) End Function Public ReadOnly Property GreaterThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlBracketedNameSyntax)._greaterThanToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the GreaterThanToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithGreaterThanToken(greaterThanToken as SyntaxToken) As XmlBracketedNameSyntax return Update(Me.LessThanToken, Me.Name, greaterThanToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._name Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Name Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlBracketedName(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlBracketedName(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lessThanToken"> ''' The value for the LessThanToken property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="greaterThanToken"> ''' The value for the GreaterThanToken property. ''' </param> Public Function Update(lessThanToken As SyntaxToken, name As XmlNameSyntax, greaterThanToken As SyntaxToken) As XmlBracketedNameSyntax If lessThanToken <> Me.LessThanToken OrElse name IsNot Me.Name OrElse greaterThanToken <> Me.GreaterThanToken Then Dim newNode = SyntaxFactory.XmlBracketedName(lessThanToken, name, greaterThanToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML namespace prefix of the form 'prefix:' as in xml:ns="". ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlPrefix"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlPrefixSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), name As InternalSyntax.XmlNameTokenSyntax, colonToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlPrefixSyntax(kind, errors, annotations, name, colonToken), Nothing, 0) End Sub Public ReadOnly Property Name As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlPrefixSyntax)._name, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as SyntaxToken) As XmlPrefixSyntax return Update(name, Me.ColonToken) End Function Public ReadOnly Property ColonToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlPrefixSyntax)._colonToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ColonToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithColonToken(colonToken as SyntaxToken) As XmlPrefixSyntax return Update(Me.Name, colonToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlPrefix(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlPrefix(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="colonToken"> ''' The value for the ColonToken property. ''' </param> Public Function Update(name As SyntaxToken, colonToken As SyntaxToken) As XmlPrefixSyntax If name <> Me.Name OrElse colonToken <> Me.ColonToken Then Dim newNode = SyntaxFactory.XmlPrefix(name, colonToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML comment of the form <!-- Comment --> appearing in an ''' XML literal expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlComment"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlCommentSyntax Inherits XmlNodeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lessThanExclamationMinusMinusToken As InternalSyntax.PunctuationSyntax, textTokens As GreenNode, minusMinusGreaterThanToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCommentSyntax(kind, errors, annotations, lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken), Nothing, 0) End Sub Public ReadOnly Property LessThanExclamationMinusMinusToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCommentSyntax)._lessThanExclamationMinusMinusToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LessThanExclamationMinusMinusToken property ''' changed to the specified value. Returns this instance if the specified value is ''' the same as the current value. ''' </summary> Public Shadows Function WithLessThanExclamationMinusMinusToken(lessThanExclamationMinusMinusToken as SyntaxToken) As XmlCommentSyntax return Update(lessThanExclamationMinusMinusToken, Me.TextTokens, Me.MinusMinusGreaterThanToken) End Function Public ReadOnly Property TextTokens As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCommentSyntax)._textTokens If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the TextTokens property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithTextTokens(textTokens as SyntaxTokenList) As XmlCommentSyntax return Update(Me.LessThanExclamationMinusMinusToken, textTokens, Me.MinusMinusGreaterThanToken) End Function Public Shadows Function AddTextTokens(ParamArray items As SyntaxToken()) As XmlCommentSyntax Return Me.WithTextTokens(Me.TextTokens.AddRange(items)) End Function Public ReadOnly Property MinusMinusGreaterThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCommentSyntax)._minusMinusGreaterThanToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the MinusMinusGreaterThanToken property changed to ''' the specified value. Returns this instance if the specified value is the same ''' as the current value. ''' </summary> Public Shadows Function WithMinusMinusGreaterThanToken(minusMinusGreaterThanToken as SyntaxToken) As XmlCommentSyntax return Update(Me.LessThanExclamationMinusMinusToken, Me.TextTokens, minusMinusGreaterThanToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlComment(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlComment(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lessThanExclamationMinusMinusToken"> ''' The value for the LessThanExclamationMinusMinusToken property. ''' </param> ''' <param name="textTokens"> ''' The value for the TextTokens property. ''' </param> ''' <param name="minusMinusGreaterThanToken"> ''' The value for the MinusMinusGreaterThanToken property. ''' </param> Public Function Update(lessThanExclamationMinusMinusToken As SyntaxToken, textTokens As SyntaxTokenList, minusMinusGreaterThanToken As SyntaxToken) As XmlCommentSyntax If lessThanExclamationMinusMinusToken <> Me.LessThanExclamationMinusMinusToken OrElse textTokens <> Me.TextTokens OrElse minusMinusGreaterThanToken <> Me.MinusMinusGreaterThanToken Then Dim newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML processing instruction of the form '<? XMLProcessingTarget ''' XMLProcessingValue ?>'. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlProcessingInstruction"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlProcessingInstructionSyntax Inherits XmlNodeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lessThanQuestionToken As InternalSyntax.PunctuationSyntax, name As InternalSyntax.XmlNameTokenSyntax, textTokens As GreenNode, questionGreaterThanToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlProcessingInstructionSyntax(kind, errors, annotations, lessThanQuestionToken, name, textTokens, questionGreaterThanToken), Nothing, 0) End Sub Public ReadOnly Property LessThanQuestionToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlProcessingInstructionSyntax)._lessThanQuestionToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LessThanQuestionToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithLessThanQuestionToken(lessThanQuestionToken as SyntaxToken) As XmlProcessingInstructionSyntax return Update(lessThanQuestionToken, Me.Name, Me.TextTokens, Me.QuestionGreaterThanToken) End Function Public ReadOnly Property Name As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlProcessingInstructionSyntax)._name, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as SyntaxToken) As XmlProcessingInstructionSyntax return Update(Me.LessThanQuestionToken, name, Me.TextTokens, Me.QuestionGreaterThanToken) End Function Public ReadOnly Property TextTokens As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlProcessingInstructionSyntax)._textTokens If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(2), Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the TextTokens property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithTextTokens(textTokens as SyntaxTokenList) As XmlProcessingInstructionSyntax return Update(Me.LessThanQuestionToken, Me.Name, textTokens, Me.QuestionGreaterThanToken) End Function Public Shadows Function AddTextTokens(ParamArray items As SyntaxToken()) As XmlProcessingInstructionSyntax Return Me.WithTextTokens(Me.TextTokens.AddRange(items)) End Function Public ReadOnly Property QuestionGreaterThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlProcessingInstructionSyntax)._questionGreaterThanToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the QuestionGreaterThanToken property changed to ''' the specified value. Returns this instance if the specified value is the same ''' as the current value. ''' </summary> Public Shadows Function WithQuestionGreaterThanToken(questionGreaterThanToken as SyntaxToken) As XmlProcessingInstructionSyntax return Update(Me.LessThanQuestionToken, Me.Name, Me.TextTokens, questionGreaterThanToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlProcessingInstruction(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlProcessingInstruction(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lessThanQuestionToken"> ''' The value for the LessThanQuestionToken property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="textTokens"> ''' The value for the TextTokens property. ''' </param> ''' <param name="questionGreaterThanToken"> ''' The value for the QuestionGreaterThanToken property. ''' </param> Public Function Update(lessThanQuestionToken As SyntaxToken, name As SyntaxToken, textTokens As SyntaxTokenList, questionGreaterThanToken As SyntaxToken) As XmlProcessingInstructionSyntax If lessThanQuestionToken <> Me.LessThanQuestionToken OrElse name <> Me.Name OrElse textTokens <> Me.TextTokens OrElse questionGreaterThanToken <> Me.QuestionGreaterThanToken Then Dim newNode = SyntaxFactory.XmlProcessingInstruction(lessThanQuestionToken, name, textTokens, questionGreaterThanToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an XML CDATA section in an XML literal expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlCDataSection"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlCDataSectionSyntax Inherits XmlNodeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), beginCDataToken As InternalSyntax.PunctuationSyntax, textTokens As GreenNode, endCDataToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCDataSectionSyntax(kind, errors, annotations, beginCDataToken, textTokens, endCDataToken), Nothing, 0) End Sub Public ReadOnly Property BeginCDataToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCDataSectionSyntax)._beginCDataToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the BeginCDataToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithBeginCDataToken(beginCDataToken as SyntaxToken) As XmlCDataSectionSyntax return Update(beginCDataToken, Me.TextTokens, Me.EndCDataToken) End Function Public ReadOnly Property TextTokens As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCDataSectionSyntax)._textTokens If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the TextTokens property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithTextTokens(textTokens as SyntaxTokenList) As XmlCDataSectionSyntax return Update(Me.BeginCDataToken, textTokens, Me.EndCDataToken) End Function Public Shadows Function AddTextTokens(ParamArray items As SyntaxToken()) As XmlCDataSectionSyntax Return Me.WithTextTokens(Me.TextTokens.AddRange(items)) End Function Public ReadOnly Property EndCDataToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCDataSectionSyntax)._endCDataToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the EndCDataToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEndCDataToken(endCDataToken as SyntaxToken) As XmlCDataSectionSyntax return Update(Me.BeginCDataToken, Me.TextTokens, endCDataToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlCDataSection(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlCDataSection(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="beginCDataToken"> ''' The value for the BeginCDataToken property. ''' </param> ''' <param name="textTokens"> ''' The value for the TextTokens property. ''' </param> ''' <param name="endCDataToken"> ''' The value for the EndCDataToken property. ''' </param> Public Function Update(beginCDataToken As SyntaxToken, textTokens As SyntaxTokenList, endCDataToken As SyntaxToken) As XmlCDataSectionSyntax If beginCDataToken <> Me.BeginCDataToken OrElse textTokens <> Me.TextTokens OrElse endCDataToken <> Me.EndCDataToken Then Dim newNode = SyntaxFactory.XmlCDataSection(beginCDataToken, textTokens, endCDataToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an embedded expression in an XML literal e.g. '<name><%= ''' obj.Name =%></name>'. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlEmbeddedExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlEmbeddedExpressionSyntax Inherits XmlNodeSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), lessThanPercentEqualsToken As InternalSyntax.PunctuationSyntax, expression As ExpressionSyntax, percentGreaterThanToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlEmbeddedExpressionSyntax(kind, errors, annotations, lessThanPercentEqualsToken, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), percentGreaterThanToken), Nothing, 0) End Sub Public ReadOnly Property LessThanPercentEqualsToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlEmbeddedExpressionSyntax)._lessThanPercentEqualsToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the LessThanPercentEqualsToken property changed to ''' the specified value. Returns this instance if the specified value is the same ''' as the current value. ''' </summary> Public Shadows Function WithLessThanPercentEqualsToken(lessThanPercentEqualsToken as SyntaxToken) As XmlEmbeddedExpressionSyntax return Update(lessThanPercentEqualsToken, Me.Expression, Me.PercentGreaterThanToken) End Function Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As XmlEmbeddedExpressionSyntax return Update(Me.LessThanPercentEqualsToken, expression, Me.PercentGreaterThanToken) End Function Public ReadOnly Property PercentGreaterThanToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlEmbeddedExpressionSyntax)._percentGreaterThanToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the PercentGreaterThanToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithPercentGreaterThanToken(percentGreaterThanToken as SyntaxToken) As XmlEmbeddedExpressionSyntax return Update(Me.LessThanPercentEqualsToken, Me.Expression, percentGreaterThanToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlEmbeddedExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlEmbeddedExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="lessThanPercentEqualsToken"> ''' The value for the LessThanPercentEqualsToken property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="percentGreaterThanToken"> ''' The value for the PercentGreaterThanToken property. ''' </param> Public Function Update(lessThanPercentEqualsToken As SyntaxToken, expression As ExpressionSyntax, percentGreaterThanToken As SyntaxToken) As XmlEmbeddedExpressionSyntax If lessThanPercentEqualsToken <> Me.LessThanPercentEqualsToken OrElse expression IsNot Me.Expression OrElse percentGreaterThanToken <> Me.PercentGreaterThanToken Then Dim newNode = SyntaxFactory.XmlEmbeddedExpression(lessThanPercentEqualsToken, expression, percentGreaterThanToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Abstract node class that represents the textual description of a type, possibly ''' include generic type arguments, qualified names, array specifiers, nullable ''' specifier and the like. ''' </summary> Public MustInherit Class TypeSyntax Inherits ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents an array type, such as "A() or "A(,)", without bounds specified for ''' the array. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ArrayType"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ArrayTypeSyntax Inherits TypeSyntax Friend _elementType as TypeSyntax Friend _rankSpecifiers as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), elementType As TypeSyntax, rankSpecifiers As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ArrayTypeSyntax(kind, errors, annotations, DirectCast(elementType.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax), if(rankSpecifiers IsNot Nothing, rankSpecifiers.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The type of the elements of the array. ''' </summary> Public ReadOnly Property ElementType As TypeSyntax Get Return GetRedAtZero(_elementType) End Get End Property ''' <summary> ''' Returns a copy of this with the ElementType property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElementType(elementType as TypeSyntax) As ArrayTypeSyntax return Update(elementType, Me.RankSpecifiers) End Function ''' <summary> ''' Represents the list of "()" or "(,,)" modifiers on the array type. ''' </summary> Public ReadOnly Property RankSpecifiers As SyntaxList(Of ArrayRankSpecifierSyntax) Get Dim listNode = GetRed(_rankSpecifiers, 1) Return new SyntaxList(Of ArrayRankSpecifierSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the RankSpecifiers property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithRankSpecifiers(rankSpecifiers as SyntaxList(Of ArrayRankSpecifierSyntax)) As ArrayTypeSyntax return Update(Me.ElementType, rankSpecifiers) End Function Public Shadows Function AddRankSpecifiers(ParamArray items As ArrayRankSpecifierSyntax()) As ArrayTypeSyntax Return Me.WithRankSpecifiers(Me.RankSpecifiers.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._elementType Case 1 Return Me._rankSpecifiers Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.ElementType Case 1 Return GetRed(_rankSpecifiers, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitArrayType(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitArrayType(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="elementType"> ''' The value for the ElementType property. ''' </param> ''' <param name="rankSpecifiers"> ''' The value for the RankSpecifiers property. ''' </param> Public Function Update(elementType As TypeSyntax, rankSpecifiers As SyntaxList(of ArrayRankSpecifierSyntax)) As ArrayTypeSyntax If elementType IsNot Me.ElementType OrElse rankSpecifiers <> Me.RankSpecifiers Then Dim newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' A type name that represents a nullable type, such as "Integer?". ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.NullableType"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class NullableTypeSyntax Inherits TypeSyntax Friend _elementType as TypeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), elementType As TypeSyntax, questionMarkToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NullableTypeSyntax(kind, errors, annotations, DirectCast(elementType.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax), questionMarkToken), Nothing, 0) End Sub ''' <summary> ''' The kind of type that is this type is a nullable of. Cannot be an array type or ''' a nullable type. ''' </summary> Public ReadOnly Property ElementType As TypeSyntax Get Return GetRedAtZero(_elementType) End Get End Property ''' <summary> ''' Returns a copy of this with the ElementType property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElementType(elementType as TypeSyntax) As NullableTypeSyntax return Update(elementType, Me.QuestionMarkToken) End Function ''' <summary> ''' The "?" token. ''' </summary> Public ReadOnly Property QuestionMarkToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NullableTypeSyntax)._questionMarkToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the QuestionMarkToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithQuestionMarkToken(questionMarkToken as SyntaxToken) As NullableTypeSyntax return Update(Me.ElementType, questionMarkToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._elementType Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.ElementType Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitNullableType(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitNullableType(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="elementType"> ''' The value for the ElementType property. ''' </param> ''' <param name="questionMarkToken"> ''' The value for the QuestionMarkToken property. ''' </param> Public Function Update(elementType As TypeSyntax, questionMarkToken As SyntaxToken) As NullableTypeSyntax If elementType IsNot Me.ElementType OrElse questionMarkToken <> Me.QuestionMarkToken Then Dim newNode = SyntaxFactory.NullableType(elementType, questionMarkToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an occurrence of a Visual Basic built-in type such as Integer or ''' String in source code. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.PredefinedType"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class PredefinedTypeSyntax Inherits TypeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), keyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PredefinedTypeSyntax(kind, errors, annotations, keyword), Nothing, 0) End Sub ''' <summary> ''' The keyword that was used to describe the built-in type. ''' </summary> Public ReadOnly Property Keyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.PredefinedTypeSyntax)._keyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the Keyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithKeyword(keyword as SyntaxToken) As PredefinedTypeSyntax return Update(keyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitPredefinedType(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitPredefinedType(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="keyword"> ''' The value for the Keyword property. ''' </param> Public Function Update(keyword As SyntaxToken) As PredefinedTypeSyntax If keyword <> Me.Keyword Then Dim newNode = SyntaxFactory.PredefinedType(keyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Abstract node class that represents a name, possibly include generic arguments ''' and qualified names. ''' </summary> Public MustInherit Class NameSyntax Inherits TypeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Abstract node class that represents a name, possibly include generic arguments. ''' </summary> Public MustInherit Class SimpleNameSyntax Inherits NameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The identifier in the name. ''' </summary> Public ReadOnly Property Identifier As SyntaxToken Get Return Me.GetIdentifierCore() End Get End Property Friend Overridable Function GetIdentifierCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleNameSyntax)._identifier, Me.Position, 0) End Function ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithIdentifier(identifier As SyntaxToken) As SimpleNameSyntax Return WithIdentifierCore(identifier) End Function Friend MustOverride Function WithIdentifierCore(identifier As SyntaxToken) As SimpleNameSyntax End Class ''' <summary> ''' Represents a type name consisting of a single identifier (which might include ''' brackets or a type character). ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.IdentifierName"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class IdentifierNameSyntax Inherits SimpleNameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), identifier As InternalSyntax.IdentifierTokenSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IdentifierNameSyntax(kind, errors, annotations, identifier), Nothing, 0) End Sub ''' <summary> ''' The identifier in the name. ''' </summary> Public Shadows ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IdentifierNameSyntax)._identifier, Me.Position, 0) End Get End Property Friend Overrides Function GetIdentifierCore() As SyntaxToken Return Me.Identifier End Function Friend Overrides Function WithIdentifierCore(identifier As SyntaxToken) As SimpleNameSyntax Return WithIdentifier(identifier) End Function ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As IdentifierNameSyntax return Update(identifier) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitIdentifierName(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitIdentifierName(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> Public Function Update(identifier As SyntaxToken) As IdentifierNameSyntax If identifier <> Me.Identifier Then Dim newNode = SyntaxFactory.IdentifierName(identifier) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a simple type name with one or more generic arguments, such as "X(Of ''' Y, Z). ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.GenericName"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class GenericNameSyntax Inherits SimpleNameSyntax Friend _typeArgumentList as TypeArgumentListSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), identifier As InternalSyntax.IdentifierTokenSyntax, typeArgumentList As TypeArgumentListSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GenericNameSyntax(kind, errors, annotations, identifier, DirectCast(typeArgumentList.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeArgumentListSyntax)), Nothing, 0) End Sub ''' <summary> ''' The identifier in the name. ''' </summary> Public Shadows ReadOnly Property Identifier As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GenericNameSyntax)._identifier, Me.Position, 0) End Get End Property Friend Overrides Function GetIdentifierCore() As SyntaxToken Return Me.Identifier End Function Friend Overrides Function WithIdentifierCore(identifier As SyntaxToken) As SimpleNameSyntax Return WithIdentifier(identifier) End Function ''' <summary> ''' Returns a copy of this with the Identifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIdentifier(identifier as SyntaxToken) As GenericNameSyntax return Update(identifier, Me.TypeArgumentList) End Function ''' <summary> ''' The generic argument list. ''' </summary> Public ReadOnly Property TypeArgumentList As TypeArgumentListSyntax Get Return GetRed(_typeArgumentList, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the TypeArgumentList property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithTypeArgumentList(typeArgumentList as TypeArgumentListSyntax) As GenericNameSyntax return Update(Me.Identifier, typeArgumentList) End Function Public Shadows Function AddTypeArgumentListArguments(ParamArray items As TypeSyntax()) As GenericNameSyntax Dim _child = If(Me.TypeArgumentList IsNot Nothing, Me.TypeArgumentList, SyntaxFactory.TypeArgumentList()) Return Me.WithTypeArgumentList(_child.AddArguments(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._typeArgumentList Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.TypeArgumentList Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitGenericName(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitGenericName(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="identifier"> ''' The value for the Identifier property. ''' </param> ''' <param name="typeArgumentList"> ''' The value for the TypeArgumentList property. ''' </param> Public Function Update(identifier As SyntaxToken, typeArgumentList As TypeArgumentListSyntax) As GenericNameSyntax If identifier <> Me.Identifier OrElse typeArgumentList IsNot Me.TypeArgumentList Then Dim newNode = SyntaxFactory.GenericName(identifier, typeArgumentList) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a qualified type name, for example X.Y or X(Of Z).Y. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.QualifiedName"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class QualifiedNameSyntax Inherits NameSyntax Friend _left as NameSyntax Friend _right as SimpleNameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), left As NameSyntax, dotToken As InternalSyntax.PunctuationSyntax, right As SimpleNameSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.QualifiedNameSyntax(kind, errors, annotations, DirectCast(left.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NameSyntax), dotToken, DirectCast(right.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleNameSyntax)), Nothing, 0) End Sub ''' <summary> ''' The part of the name that appears to the left of the dot. This can itself be ''' any name. ''' </summary> Public ReadOnly Property Left As NameSyntax Get Return GetRedAtZero(_left) End Get End Property ''' <summary> ''' Returns a copy of this with the Left property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithLeft(left as NameSyntax) As QualifiedNameSyntax return Update(left, Me.DotToken, Me.Right) End Function ''' <summary> ''' The "." token that separates the names. ''' </summary> Public ReadOnly Property DotToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.QualifiedNameSyntax)._dotToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the DotToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithDotToken(dotToken as SyntaxToken) As QualifiedNameSyntax return Update(Me.Left, dotToken, Me.Right) End Function ''' <summary> ''' The part of the name that appears to the right of the dot. This must be a ''' simple identifier. ''' </summary> Public ReadOnly Property Right As SimpleNameSyntax Get Return GetRed(_right, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Right property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithRight(right as SimpleNameSyntax) As QualifiedNameSyntax return Update(Me.Left, Me.DotToken, right) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._left Case 2 Return Me._right Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Left Case 2 Return Me.Right Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitQualifiedName(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitQualifiedName(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="left"> ''' The value for the Left property. ''' </param> ''' <param name="dotToken"> ''' The value for the DotToken property. ''' </param> ''' <param name="right"> ''' The value for the Right property. ''' </param> Public Function Update(left As NameSyntax, dotToken As SyntaxToken, right As SimpleNameSyntax) As QualifiedNameSyntax If left IsNot Me.Left OrElse dotToken <> Me.DotToken OrElse right IsNot Me.Right Then Dim newNode = SyntaxFactory.QualifiedName(left, dotToken, right) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a name in the global namespace. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.GlobalName"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class GlobalNameSyntax Inherits NameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), globalKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GlobalNameSyntax(kind, errors, annotations, globalKeyword), Nothing, 0) End Sub ''' <summary> ''' The "Global" keyword. ''' </summary> Public ReadOnly Property GlobalKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.GlobalNameSyntax)._globalKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the GlobalKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithGlobalKeyword(globalKeyword as SyntaxToken) As GlobalNameSyntax return Update(globalKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitGlobalName(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitGlobalName(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="globalKeyword"> ''' The value for the GlobalKeyword property. ''' </param> Public Function Update(globalKeyword As SyntaxToken) As GlobalNameSyntax If globalKeyword <> Me.GlobalKeyword Then Dim newNode = SyntaxFactory.GlobalName(globalKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a parenthesized list of generic type arguments. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.TypeArgumentList"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class TypeArgumentListSyntax Inherits VisualBasicSyntaxNode Friend _arguments as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), openParenToken As InternalSyntax.PunctuationSyntax, ofKeyword As InternalSyntax.KeywordSyntax, arguments As SyntaxNode, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeArgumentListSyntax(kind, errors, annotations, openParenToken, ofKeyword, if(arguments IsNot Nothing, arguments.Green, Nothing), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "(" token. ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeArgumentListSyntax)._openParenToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As TypeArgumentListSyntax return Update(openParenToken, Me.OfKeyword, Me.Arguments, Me.CloseParenToken) End Function ''' <summary> ''' The "Of" keyword. ''' </summary> Public ReadOnly Property OfKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeArgumentListSyntax)._ofKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OfKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOfKeyword(ofKeyword as SyntaxToken) As TypeArgumentListSyntax return Update(Me.OpenParenToken, ofKeyword, Me.Arguments, Me.CloseParenToken) End Function ''' <summary> ''' A list of all the type arguments. ''' </summary> Public ReadOnly Property Arguments As SeparatedSyntaxList(Of TypeSyntax) Get Dim listNode = GetRed(_arguments, 2) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of TypeSyntax)(listNode, Me.GetChildIndex(2)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Arguments property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArguments(arguments as SeparatedSyntaxList(Of TypeSyntax)) As TypeArgumentListSyntax return Update(Me.OpenParenToken, Me.OfKeyword, arguments, Me.CloseParenToken) End Function Public Shadows Function AddArguments(ParamArray items As TypeSyntax()) As TypeArgumentListSyntax Return Me.WithArguments(Me.Arguments.AddRange(items)) End Function ''' <summary> ''' The ")" token. ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeArgumentListSyntax)._closeParenToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As TypeArgumentListSyntax return Update(Me.OpenParenToken, Me.OfKeyword, Me.Arguments, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._arguments Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return GetRed(_arguments, 2) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitTypeArgumentList(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitTypeArgumentList(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="ofKeyword"> ''' The value for the OfKeyword property. ''' </param> ''' <param name="arguments"> ''' The value for the Arguments property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(openParenToken As SyntaxToken, ofKeyword As SyntaxToken, arguments As SeparatedSyntaxList(Of TypeSyntax), closeParenToken As SyntaxToken) As TypeArgumentListSyntax If openParenToken <> Me.OpenParenToken OrElse ofKeyword <> Me.OfKeyword OrElse arguments <> Me.Arguments OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.TypeArgumentList(openParenToken, ofKeyword, arguments, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Syntax node class that represents a value of 'cref' attribute inside ''' documentation comment trivia. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CrefReference"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CrefReferenceSyntax Inherits VisualBasicSyntaxNode Friend _name as TypeSyntax Friend _signature as CrefSignatureSyntax Friend _asClause as SimpleAsClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), name As TypeSyntax, signature As CrefSignatureSyntax, asClause As SimpleAsClauseSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefReferenceSyntax(kind, errors, annotations, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax), if(signature IsNot Nothing, DirectCast(signature.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefSignatureSyntax), Nothing), if(asClause IsNot Nothing, DirectCast(asClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SimpleAsClauseSyntax), Nothing)), Nothing, 0) End Sub Public ReadOnly Property Name As TypeSyntax Get Return GetRedAtZero(_name) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as TypeSyntax) As CrefReferenceSyntax return Update(name, Me.Signature, Me.AsClause) End Function ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Signature As CrefSignatureSyntax Get Return GetRed(_signature, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Signature property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithSignature(signature as CrefSignatureSyntax) As CrefReferenceSyntax return Update(Me.Name, signature, Me.AsClause) End Function Public Shadows Function AddSignatureArgumentTypes(ParamArray items As CrefSignaturePartSyntax()) As CrefReferenceSyntax Dim _child = If(Me.Signature IsNot Nothing, Me.Signature, SyntaxFactory.CrefSignature()) Return Me.WithSignature(_child.AddArgumentTypes(items)) End Function ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AsClause As SimpleAsClauseSyntax Get Return GetRed(_asClause, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the AsClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAsClause(asClause as SimpleAsClauseSyntax) As CrefReferenceSyntax return Update(Me.Name, Me.Signature, asClause) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._name Case 1 Return Me._signature Case 2 Return Me._asClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Name Case 1 Return Me.Signature Case 2 Return Me.AsClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCrefReference(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCrefReference(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="signature"> ''' The value for the Signature property. ''' </param> ''' <param name="asClause"> ''' The value for the AsClause property. ''' </param> Public Function Update(name As TypeSyntax, signature As CrefSignatureSyntax, asClause As SimpleAsClauseSyntax) As CrefReferenceSyntax If name IsNot Me.Name OrElse signature IsNot Me.Signature OrElse asClause IsNot Me.AsClause Then Dim newNode = SyntaxFactory.CrefReference(name, signature, asClause) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a parenthesized list of argument types for a signature inside ''' CrefReferenceSyntax syntax. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CrefSignature"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CrefSignatureSyntax Inherits VisualBasicSyntaxNode Friend _argumentTypes as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), openParenToken As InternalSyntax.PunctuationSyntax, argumentTypes As SyntaxNode, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefSignatureSyntax(kind, errors, annotations, openParenToken, if(argumentTypes IsNot Nothing, argumentTypes.Green, Nothing), closeParenToken), Nothing, 0) End Sub Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefSignatureSyntax)._openParenToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As CrefSignatureSyntax return Update(openParenToken, Me.ArgumentTypes, Me.CloseParenToken) End Function Public ReadOnly Property ArgumentTypes As SeparatedSyntaxList(Of CrefSignaturePartSyntax) Get Dim listNode = GetRed(_argumentTypes, 1) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of CrefSignaturePartSyntax)(listNode, Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the ArgumentTypes property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArgumentTypes(argumentTypes as SeparatedSyntaxList(Of CrefSignaturePartSyntax)) As CrefSignatureSyntax return Update(Me.OpenParenToken, argumentTypes, Me.CloseParenToken) End Function Public Shadows Function AddArgumentTypes(ParamArray items As CrefSignaturePartSyntax()) As CrefSignatureSyntax Return Me.WithArgumentTypes(Me.ArgumentTypes.AddRange(items)) End Function Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefSignatureSyntax)._closeParenToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As CrefSignatureSyntax return Update(Me.OpenParenToken, Me.ArgumentTypes, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._argumentTypes Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_argumentTypes, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCrefSignature(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCrefSignature(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="argumentTypes"> ''' The value for the ArgumentTypes property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(openParenToken As SyntaxToken, argumentTypes As SeparatedSyntaxList(Of CrefSignaturePartSyntax), closeParenToken As SyntaxToken) As CrefSignatureSyntax If openParenToken <> Me.OpenParenToken OrElse argumentTypes <> Me.ArgumentTypes OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.CrefSignature(openParenToken, argumentTypes, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CrefSignaturePart"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CrefSignaturePartSyntax Inherits VisualBasicSyntaxNode Friend _type as TypeSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), modifier As InternalSyntax.KeywordSyntax, type As TypeSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefSignaturePartSyntax(kind, errors, annotations, modifier, if(type IsNot Nothing, DirectCast(type.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.TypeSyntax), Nothing)), Nothing, 0) End Sub ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Modifier As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefSignaturePartSyntax)._modifier If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.Position, 0) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Modifier property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithModifier(modifier as SyntaxToken) As CrefSignaturePartSyntax return Update(modifier, Me.Type) End Function ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Type As TypeSyntax Get Return GetRed(_type, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Type property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithType(type as TypeSyntax) As CrefSignaturePartSyntax return Update(Me.Modifier, type) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._type Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Type Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCrefSignaturePart(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCrefSignaturePart(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="modifier"> ''' The value for the Modifier property. ''' </param> ''' <param name="type"> ''' The value for the Type property. ''' </param> Public Function Update(modifier As SyntaxToken, type As TypeSyntax) As CrefSignaturePartSyntax If modifier <> Me.Modifier OrElse type IsNot Me.Type Then Dim newNode = SyntaxFactory.CrefSignaturePart(modifier, type) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.CrefOperatorReference"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class CrefOperatorReferenceSyntax Inherits NameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), operatorKeyword As InternalSyntax.KeywordSyntax, operatorToken As InternalSyntax.SyntaxToken) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefOperatorReferenceSyntax(kind, errors, annotations, operatorKeyword, operatorToken), Nothing, 0) End Sub Public ReadOnly Property OperatorKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefOperatorReferenceSyntax)._operatorKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OperatorKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOperatorKeyword(operatorKeyword as SyntaxToken) As CrefOperatorReferenceSyntax return Update(operatorKeyword, Me.OperatorToken) End Function Public ReadOnly Property OperatorToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefOperatorReferenceSyntax)._operatorToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OperatorToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithOperatorToken(operatorToken as SyntaxToken) As CrefOperatorReferenceSyntax return Update(Me.OperatorKeyword, operatorToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitCrefOperatorReference(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitCrefOperatorReference(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="operatorKeyword"> ''' The value for the OperatorKeyword property. ''' </param> ''' <param name="operatorToken"> ''' The value for the OperatorToken property. ''' </param> Public Function Update(operatorKeyword As SyntaxToken, operatorToken As SyntaxToken) As CrefOperatorReferenceSyntax If operatorKeyword <> Me.OperatorKeyword OrElse operatorToken <> Me.OperatorToken Then Dim newNode = SyntaxFactory.CrefOperatorReference(operatorKeyword, operatorToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.QualifiedCrefOperatorReference"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class QualifiedCrefOperatorReferenceSyntax Inherits NameSyntax Friend _left as NameSyntax Friend _right as CrefOperatorReferenceSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), left As NameSyntax, dotToken As InternalSyntax.PunctuationSyntax, right As CrefOperatorReferenceSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.QualifiedCrefOperatorReferenceSyntax(kind, errors, annotations, DirectCast(left.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NameSyntax), dotToken, DirectCast(right.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefOperatorReferenceSyntax)), Nothing, 0) End Sub Public ReadOnly Property Left As NameSyntax Get Return GetRedAtZero(_left) End Get End Property ''' <summary> ''' Returns a copy of this with the Left property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithLeft(left as NameSyntax) As QualifiedCrefOperatorReferenceSyntax return Update(left, Me.DotToken, Me.Right) End Function Public ReadOnly Property DotToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.QualifiedCrefOperatorReferenceSyntax)._dotToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the DotToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithDotToken(dotToken as SyntaxToken) As QualifiedCrefOperatorReferenceSyntax return Update(Me.Left, dotToken, Me.Right) End Function Public ReadOnly Property Right As CrefOperatorReferenceSyntax Get Return GetRed(_right, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Right property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithRight(right as CrefOperatorReferenceSyntax) As QualifiedCrefOperatorReferenceSyntax return Update(Me.Left, Me.DotToken, right) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._left Case 2 Return Me._right Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Left Case 2 Return Me.Right Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitQualifiedCrefOperatorReference(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitQualifiedCrefOperatorReference(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="left"> ''' The value for the Left property. ''' </param> ''' <param name="dotToken"> ''' The value for the DotToken property. ''' </param> ''' <param name="right"> ''' The value for the Right property. ''' </param> Public Function Update(left As NameSyntax, dotToken As SyntaxToken, right As CrefOperatorReferenceSyntax) As QualifiedCrefOperatorReferenceSyntax If left IsNot Me.Left OrElse dotToken <> Me.DotToken OrElse right IsNot Me.Right Then Dim newNode = SyntaxFactory.QualifiedCrefOperatorReference(left, dotToken, right) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represent a Yield statement. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.YieldStatement"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class YieldStatementSyntax Inherits ExecutableStatementSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), yieldKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.YieldStatementSyntax(kind, errors, annotations, yieldKeyword, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Yield" keyword. ''' </summary> Public ReadOnly Property YieldKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.YieldStatementSyntax)._yieldKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the YieldKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithYieldKeyword(yieldKeyword as SyntaxToken) As YieldStatementSyntax return Update(yieldKeyword, Me.Expression) End Function ''' <summary> ''' The expression whose value is being yielded. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As YieldStatementSyntax return Update(Me.YieldKeyword, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitYieldStatement(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitYieldStatement(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="yieldKeyword"> ''' The value for the YieldKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(yieldKeyword As SyntaxToken, expression As ExpressionSyntax) As YieldStatementSyntax If yieldKeyword <> Me.YieldKeyword OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.YieldStatement(yieldKeyword, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an Await expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.AwaitExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class AwaitExpressionSyntax Inherits ExpressionSyntax Friend _expression as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), awaitKeyword As InternalSyntax.KeywordSyntax, expression As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AwaitExpressionSyntax(kind, errors, annotations, awaitKeyword, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "Await" keyword. ''' </summary> Public ReadOnly Property AwaitKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.AwaitExpressionSyntax)._awaitKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the AwaitKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithAwaitKeyword(awaitKeyword as SyntaxToken) As AwaitExpressionSyntax return Update(awaitKeyword, Me.Expression) End Function ''' <summary> ''' The expression being awaited. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As AwaitExpressionSyntax return Update(Me.AwaitKeyword, expression) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitAwaitExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitAwaitExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="awaitKeyword"> ''' The value for the AwaitKeyword property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> Public Function Update(awaitKeyword As SyntaxToken, expression As ExpressionSyntax) As AwaitExpressionSyntax If awaitKeyword <> Me.AwaitKeyword OrElse expression IsNot Me.Expression Then Dim newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Abstract class that represent structured trivia. ''' </summary> Public MustInherit Class StructuredTriviaSyntax Inherits VisualBasicSyntaxNode End Class ''' <summary> ''' Represents tokens that were skipped by the parser as part of error recovery, ''' and thus are not part of any syntactic structure. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.SkippedTokensTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class SkippedTokensTriviaSyntax Inherits StructuredTriviaSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), tokens As GreenNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SkippedTokensTriviaSyntax(kind, errors, annotations, tokens), Nothing, 0) End Sub ''' <summary> ''' The list of tokens that were skipped by the parser. ''' </summary> ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Tokens As SyntaxTokenList Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.SkippedTokensTriviaSyntax)._tokens If slot IsNot Nothing return new SyntaxTokenList(Me, slot, Me.Position, 0) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the Tokens property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithTokens(tokens as SyntaxTokenList) As SkippedTokensTriviaSyntax return Update(tokens) End Function Public Shadows Function AddTokens(ParamArray items As SyntaxToken()) As SkippedTokensTriviaSyntax Return Me.WithTokens(Me.Tokens.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitSkippedTokensTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitSkippedTokensTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="tokens"> ''' The value for the Tokens property. ''' </param> Public Function Update(tokens As SyntaxTokenList) As SkippedTokensTriviaSyntax If tokens <> Me.Tokens Then Dim newNode = SyntaxFactory.SkippedTokensTrivia(tokens) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a documentation comment e.g. ''' <Summary> appearing in ''' source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.DocumentationCommentTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class DocumentationCommentTriviaSyntax Inherits StructuredTriviaSyntax Friend _content as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), content As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DocumentationCommentTriviaSyntax(kind, errors, annotations, if(content IsNot Nothing, content.Green, Nothing)), Nothing, 0) End Sub ''' <remarks> ''' If nothing is present, an empty list is returned. ''' </remarks> Public ReadOnly Property Content As SyntaxList(Of XmlNodeSyntax) Get Dim listNode = GetRedAtZero(_content) Return new SyntaxList(Of XmlNodeSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Content property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithContent(content as SyntaxList(Of XmlNodeSyntax)) As DocumentationCommentTriviaSyntax return Update(content) End Function Public Shadows Function AddContent(ParamArray items As XmlNodeSyntax()) As DocumentationCommentTriviaSyntax Return Me.WithContent(Me.Content.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Me._content Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode If i = 0 Then Return GetRedAtZero(_content) Else Return Nothing End If End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitDocumentationCommentTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitDocumentationCommentTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="content"> ''' The value for the Content property. ''' </param> Public Function Update(content As SyntaxList(of XmlNodeSyntax)) As DocumentationCommentTriviaSyntax If content <> Me.Content Then Dim newNode = SyntaxFactory.DocumentationCommentTrivia(content) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' A symbol referenced by a cref attribute (e.g. in a <see> or ''' <seealso> documentation comment tag). For example, the M in <see ''' cref="M" />. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlCrefAttribute"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlCrefAttributeSyntax Inherits BaseXmlAttributeSyntax Friend _name as XmlNameSyntax Friend _reference as CrefReferenceSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), name As XmlNameSyntax, equalsToken As InternalSyntax.PunctuationSyntax, startQuoteToken As InternalSyntax.PunctuationSyntax, reference As CrefReferenceSyntax, endQuoteToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCrefAttributeSyntax(kind, errors, annotations, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNameSyntax), equalsToken, startQuoteToken, DirectCast(reference.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.CrefReferenceSyntax), endQuoteToken), Nothing, 0) End Sub Public ReadOnly Property Name As XmlNameSyntax Get Return GetRedAtZero(_name) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as XmlNameSyntax) As XmlCrefAttributeSyntax return Update(name, Me.EqualsToken, Me.StartQuoteToken, Me.Reference, Me.EndQuoteToken) End Function Public ReadOnly Property EqualsToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCrefAttributeSyntax)._equalsToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the EqualsToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEqualsToken(equalsToken as SyntaxToken) As XmlCrefAttributeSyntax return Update(Me.Name, equalsToken, Me.StartQuoteToken, Me.Reference, Me.EndQuoteToken) End Function Public ReadOnly Property StartQuoteToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCrefAttributeSyntax)._startQuoteToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the StartQuoteToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithStartQuoteToken(startQuoteToken as SyntaxToken) As XmlCrefAttributeSyntax return Update(Me.Name, Me.EqualsToken, startQuoteToken, Me.Reference, Me.EndQuoteToken) End Function Public ReadOnly Property Reference As CrefReferenceSyntax Get Return GetRed(_reference, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the Reference property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithReference(reference as CrefReferenceSyntax) As XmlCrefAttributeSyntax return Update(Me.Name, Me.EqualsToken, Me.StartQuoteToken, reference, Me.EndQuoteToken) End Function Public ReadOnly Property EndQuoteToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlCrefAttributeSyntax)._endQuoteToken, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property ''' <summary> ''' Returns a copy of this with the EndQuoteToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEndQuoteToken(endQuoteToken as SyntaxToken) As XmlCrefAttributeSyntax return Update(Me.Name, Me.EqualsToken, Me.StartQuoteToken, Me.Reference, endQuoteToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._name Case 3 Return Me._reference Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Name Case 3 Return Me.Reference Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlCrefAttribute(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlCrefAttribute(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="equalsToken"> ''' The value for the EqualsToken property. ''' </param> ''' <param name="startQuoteToken"> ''' The value for the StartQuoteToken property. ''' </param> ''' <param name="reference"> ''' The value for the Reference property. ''' </param> ''' <param name="endQuoteToken"> ''' The value for the EndQuoteToken property. ''' </param> Public Function Update(name As XmlNameSyntax, equalsToken As SyntaxToken, startQuoteToken As SyntaxToken, reference As CrefReferenceSyntax, endQuoteToken As SyntaxToken) As XmlCrefAttributeSyntax If name IsNot Me.Name OrElse equalsToken <> Me.EqualsToken OrElse startQuoteToken <> Me.StartQuoteToken OrElse reference IsNot Me.Reference OrElse endQuoteToken <> Me.EndQuoteToken Then Dim newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, reference, endQuoteToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' A param or type param symbol referenced by a name attribute (e.g. in a ''' <param> or <typeparam> documentation comment tag). For example, the ''' M in <param name="M" />. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.XmlNameAttribute"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class XmlNameAttributeSyntax Inherits BaseXmlAttributeSyntax Friend _name as XmlNameSyntax Friend _reference as IdentifierNameSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), name As XmlNameSyntax, equalsToken As InternalSyntax.PunctuationSyntax, startQuoteToken As InternalSyntax.PunctuationSyntax, reference As IdentifierNameSyntax, endQuoteToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNameAttributeSyntax(kind, errors, annotations, DirectCast(name.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNameSyntax), equalsToken, startQuoteToken, DirectCast(reference.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IdentifierNameSyntax), endQuoteToken), Nothing, 0) End Sub Public ReadOnly Property Name As XmlNameSyntax Get Return GetRedAtZero(_name) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as XmlNameSyntax) As XmlNameAttributeSyntax return Update(name, Me.EqualsToken, Me.StartQuoteToken, Me.Reference, Me.EndQuoteToken) End Function Public ReadOnly Property EqualsToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNameAttributeSyntax)._equalsToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the EqualsToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEqualsToken(equalsToken as SyntaxToken) As XmlNameAttributeSyntax return Update(Me.Name, equalsToken, Me.StartQuoteToken, Me.Reference, Me.EndQuoteToken) End Function Public ReadOnly Property StartQuoteToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNameAttributeSyntax)._startQuoteToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the StartQuoteToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithStartQuoteToken(startQuoteToken as SyntaxToken) As XmlNameAttributeSyntax return Update(Me.Name, Me.EqualsToken, startQuoteToken, Me.Reference, Me.EndQuoteToken) End Function Public ReadOnly Property Reference As IdentifierNameSyntax Get Return GetRed(_reference, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the Reference property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithReference(reference as IdentifierNameSyntax) As XmlNameAttributeSyntax return Update(Me.Name, Me.EqualsToken, Me.StartQuoteToken, reference, Me.EndQuoteToken) End Function Public ReadOnly Property EndQuoteToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.XmlNameAttributeSyntax)._endQuoteToken, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property ''' <summary> ''' Returns a copy of this with the EndQuoteToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEndQuoteToken(endQuoteToken as SyntaxToken) As XmlNameAttributeSyntax return Update(Me.Name, Me.EqualsToken, Me.StartQuoteToken, Me.Reference, endQuoteToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._name Case 3 Return Me._reference Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Name Case 3 Return Me.Reference Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitXmlNameAttribute(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitXmlNameAttribute(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="equalsToken"> ''' The value for the EqualsToken property. ''' </param> ''' <param name="startQuoteToken"> ''' The value for the StartQuoteToken property. ''' </param> ''' <param name="reference"> ''' The value for the Reference property. ''' </param> ''' <param name="endQuoteToken"> ''' The value for the EndQuoteToken property. ''' </param> Public Function Update(name As XmlNameSyntax, equalsToken As SyntaxToken, startQuoteToken As SyntaxToken, reference As IdentifierNameSyntax, endQuoteToken As SyntaxToken) As XmlNameAttributeSyntax If name IsNot Me.Name OrElse equalsToken <> Me.EqualsToken OrElse startQuoteToken <> Me.StartQuoteToken OrElse reference IsNot Me.Reference OrElse endQuoteToken <> Me.EndQuoteToken Then Dim newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, reference, endQuoteToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' ExpressionSyntax node representing the object conditionally accessed. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ConditionalAccessExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ConditionalAccessExpressionSyntax Inherits ExpressionSyntax Friend _expression as ExpressionSyntax Friend _whenNotNull as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), expression As ExpressionSyntax, questionMarkToken As InternalSyntax.PunctuationSyntax, whenNotNull As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ConditionalAccessExpressionSyntax(kind, errors, annotations, if(expression IsNot Nothing, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), Nothing), questionMarkToken, DirectCast(whenNotNull.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The expression on the left-hand-side of the "?". ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRedAtZero(_expression) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As ConditionalAccessExpressionSyntax return Update(expression, Me.QuestionMarkToken, Me.WhenNotNull) End Function ''' <summary> ''' "?" token. ''' </summary> Public ReadOnly Property QuestionMarkToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ConditionalAccessExpressionSyntax)._questionMarkToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the QuestionMarkToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithQuestionMarkToken(questionMarkToken as SyntaxToken) As ConditionalAccessExpressionSyntax return Update(Me.Expression, questionMarkToken, Me.WhenNotNull) End Function ''' <summary> ''' ExpressionSyntax node representing the access expression to be executed when ''' the object is not null." ''' </summary> Public ReadOnly Property WhenNotNull As ExpressionSyntax Get Return GetRed(_whenNotNull, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the WhenNotNull property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithWhenNotNull(whenNotNull as ExpressionSyntax) As ConditionalAccessExpressionSyntax return Update(Me.Expression, Me.QuestionMarkToken, whenNotNull) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me._expression Case 2 Return Me._whenNotNull Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 0 Return Me.Expression Case 2 Return Me.WhenNotNull Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitConditionalAccessExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitConditionalAccessExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="questionMarkToken"> ''' The value for the QuestionMarkToken property. ''' </param> ''' <param name="whenNotNull"> ''' The value for the WhenNotNull property. ''' </param> Public Function Update(expression As ExpressionSyntax, questionMarkToken As SyntaxToken, whenNotNull As ExpressionSyntax) As ConditionalAccessExpressionSyntax If expression IsNot Me.Expression OrElse questionMarkToken <> Me.QuestionMarkToken OrElse whenNotNull IsNot Me.WhenNotNull Then Dim newNode = SyntaxFactory.ConditionalAccessExpression(expression, questionMarkToken, whenNotNull) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a NameOf expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.NameOfExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class NameOfExpressionSyntax Inherits ExpressionSyntax Friend _argument as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), nameOfKeyword As InternalSyntax.KeywordSyntax, openParenToken As InternalSyntax.PunctuationSyntax, argument As ExpressionSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NameOfExpressionSyntax(kind, errors, annotations, nameOfKeyword, openParenToken, DirectCast(argument.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "NameOf" keyword. ''' </summary> Public ReadOnly Property NameOfKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NameOfExpressionSyntax)._nameOfKeyword, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the NameOfKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithNameOfKeyword(nameOfKeyword as SyntaxToken) As NameOfExpressionSyntax return Update(nameOfKeyword, Me.OpenParenToken, Me.Argument, Me.CloseParenToken) End Function ''' <summary> ''' The "(" token. ''' </summary> Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NameOfExpressionSyntax)._openParenToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As NameOfExpressionSyntax return Update(Me.NameOfKeyword, openParenToken, Me.Argument, Me.CloseParenToken) End Function ''' <summary> ''' The argument. ''' </summary> Public ReadOnly Property Argument As ExpressionSyntax Get Return GetRed(_argument, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the Argument property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithArgument(argument as ExpressionSyntax) As NameOfExpressionSyntax return Update(Me.NameOfKeyword, Me.OpenParenToken, argument, Me.CloseParenToken) End Function ''' <summary> ''' The ")" token. ''' </summary> Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.NameOfExpressionSyntax)._closeParenToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As NameOfExpressionSyntax return Update(Me.NameOfKeyword, Me.OpenParenToken, Me.Argument, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me._argument Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 2 Return Me.Argument Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitNameOfExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitNameOfExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="nameOfKeyword"> ''' The value for the NameOfKeyword property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="argument"> ''' The value for the Argument property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(nameOfKeyword As SyntaxToken, openParenToken As SyntaxToken, argument As ExpressionSyntax, closeParenToken As SyntaxToken) As NameOfExpressionSyntax If nameOfKeyword <> Me.NameOfKeyword OrElse openParenToken <> Me.OpenParenToken OrElse argument IsNot Me.Argument OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.NameOfExpression(nameOfKeyword, openParenToken, argument, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an interpolated string expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.InterpolatedStringExpression"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class InterpolatedStringExpressionSyntax Inherits ExpressionSyntax Friend _contents as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), dollarSignDoubleQuoteToken As InternalSyntax.PunctuationSyntax, contents As SyntaxNode, doubleQuoteToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolatedStringExpressionSyntax(kind, errors, annotations, dollarSignDoubleQuoteToken, if(contents IsNot Nothing, contents.Green, Nothing), doubleQuoteToken), Nothing, 0) End Sub ''' <summary> ''' The opening '$"', '$“', or '$”' token. ''' </summary> Public ReadOnly Property DollarSignDoubleQuoteToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)._dollarSignDoubleQuoteToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the DollarSignDoubleQuoteToken property changed to ''' the specified value. Returns this instance if the specified value is the same ''' as the current value. ''' </summary> Public Shadows Function WithDollarSignDoubleQuoteToken(dollarSignDoubleQuoteToken as SyntaxToken) As InterpolatedStringExpressionSyntax return Update(dollarSignDoubleQuoteToken, Me.Contents, Me.DoubleQuoteToken) End Function ''' <summary> ''' The contents of the interpolated string. ''' </summary> Public ReadOnly Property Contents As SyntaxList(Of InterpolatedStringContentSyntax) Get Dim listNode = GetRed(_contents, 1) Return new SyntaxList(Of InterpolatedStringContentSyntax)(listNode) End Get End Property ''' <summary> ''' Returns a copy of this with the Contents property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithContents(contents as SyntaxList(Of InterpolatedStringContentSyntax)) As InterpolatedStringExpressionSyntax return Update(Me.DollarSignDoubleQuoteToken, contents, Me.DoubleQuoteToken) End Function Public Shadows Function AddContents(ParamArray items As InterpolatedStringContentSyntax()) As InterpolatedStringExpressionSyntax Return Me.WithContents(Me.Contents.AddRange(items)) End Function ''' <summary> ''' The closing '"', '”', or '“' token. ''' </summary> Public ReadOnly Property DoubleQuoteToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)._doubleQuoteToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the DoubleQuoteToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithDoubleQuoteToken(doubleQuoteToken as SyntaxToken) As InterpolatedStringExpressionSyntax return Update(Me.DollarSignDoubleQuoteToken, Me.Contents, doubleQuoteToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._contents Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return GetRed(_contents, 1) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitInterpolatedStringExpression(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitInterpolatedStringExpression(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="dollarSignDoubleQuoteToken"> ''' The value for the DollarSignDoubleQuoteToken property. ''' </param> ''' <param name="contents"> ''' The value for the Contents property. ''' </param> ''' <param name="doubleQuoteToken"> ''' The value for the DoubleQuoteToken property. ''' </param> Public Function Update(dollarSignDoubleQuoteToken As SyntaxToken, contents As SyntaxList(of InterpolatedStringContentSyntax), doubleQuoteToken As SyntaxToken) As InterpolatedStringExpressionSyntax If dollarSignDoubleQuoteToken <> Me.DollarSignDoubleQuoteToken OrElse contents <> Me.Contents OrElse doubleQuoteToken <> Me.DoubleQuoteToken Then Dim newNode = SyntaxFactory.InterpolatedStringExpression(dollarSignDoubleQuoteToken, contents, doubleQuoteToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents either text content or an interpolation. ''' </summary> Public MustInherit Class InterpolatedStringContentSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub End Class ''' <summary> ''' Represents literal text content in an interpolated string. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.InterpolatedStringText"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class InterpolatedStringTextSyntax Inherits InterpolatedStringContentSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), textToken As InternalSyntax.InterpolatedStringTextTokenSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolatedStringTextSyntax(kind, errors, annotations, textToken), Nothing, 0) End Sub ''' <summary> ''' The text token. ''' </summary> Public ReadOnly Property TextToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolatedStringTextSyntax)._textToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the TextToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithTextToken(textToken as SyntaxToken) As InterpolatedStringTextSyntax return Update(textToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitInterpolatedStringText(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitInterpolatedStringText(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="textToken"> ''' The value for the TextToken property. ''' </param> Public Function Update(textToken As SyntaxToken) As InterpolatedStringTextSyntax If textToken <> Me.TextToken Then Dim newNode = SyntaxFactory.InterpolatedStringText(textToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an interpolation of an expression in an interpolated string ''' expression e.g. '{expression[,alignment][:formatString]}'. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.Interpolation"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class InterpolationSyntax Inherits InterpolatedStringContentSyntax Friend _expression as ExpressionSyntax Friend _alignmentClause as InterpolationAlignmentClauseSyntax Friend _formatClause as InterpolationFormatClauseSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), openBraceToken As InternalSyntax.PunctuationSyntax, expression As ExpressionSyntax, alignmentClause As InterpolationAlignmentClauseSyntax, formatClause As InterpolationFormatClauseSyntax, closeBraceToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolationSyntax(kind, errors, annotations, openBraceToken, DirectCast(expression.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), if(alignmentClause IsNot Nothing, DirectCast(alignmentClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolationAlignmentClauseSyntax), Nothing), if(formatClause IsNot Nothing, DirectCast(formatClause.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolationFormatClauseSyntax), Nothing), closeBraceToken), Nothing, 0) End Sub ''' <summary> ''' The opening curly brace '{' token. ''' </summary> Public ReadOnly Property OpenBraceToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolationSyntax)._openBraceToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenBraceToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenBraceToken(openBraceToken as SyntaxToken) As InterpolationSyntax return Update(openBraceToken, Me.Expression, Me.AlignmentClause, Me.FormatClause, Me.CloseBraceToken) End Function ''' <summary> ''' The expression whose formatted value should be embedded in the resultant ''' string. ''' </summary> Public ReadOnly Property Expression As ExpressionSyntax Get Return GetRed(_expression, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Expression property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithExpression(expression as ExpressionSyntax) As InterpolationSyntax return Update(Me.OpenBraceToken, expression, Me.AlignmentClause, Me.FormatClause, Me.CloseBraceToken) End Function ''' <summary> ''' Optional. The alignment clause ',alignment' of the embedded expression. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property AlignmentClause As InterpolationAlignmentClauseSyntax Get Return GetRed(_alignmentClause, 2) End Get End Property ''' <summary> ''' Returns a copy of this with the AlignmentClause property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithAlignmentClause(alignmentClause as InterpolationAlignmentClauseSyntax) As InterpolationSyntax return Update(Me.OpenBraceToken, Me.Expression, alignmentClause, Me.FormatClause, Me.CloseBraceToken) End Function ''' <summary> ''' Optional. The format string clause ':formatString' of the embedded expression. ''' </summary> ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property FormatClause As InterpolationFormatClauseSyntax Get Return GetRed(_formatClause, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the FormatClause property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithFormatClause(formatClause as InterpolationFormatClauseSyntax) As InterpolationSyntax return Update(Me.OpenBraceToken, Me.Expression, Me.AlignmentClause, formatClause, Me.CloseBraceToken) End Function ''' <summary> ''' The closing curly brace '}' token of the embedded expression. ''' </summary> Public ReadOnly Property CloseBraceToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolationSyntax)._closeBraceToken, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseBraceToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseBraceToken(closeBraceToken as SyntaxToken) As InterpolationSyntax return Update(Me.OpenBraceToken, Me.Expression, Me.AlignmentClause, Me.FormatClause, closeBraceToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._expression Case 2 Return Me._alignmentClause Case 3 Return Me._formatClause Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Expression Case 2 Return Me.AlignmentClause Case 3 Return Me.FormatClause Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitInterpolation(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitInterpolation(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="openBraceToken"> ''' The value for the OpenBraceToken property. ''' </param> ''' <param name="expression"> ''' The value for the Expression property. ''' </param> ''' <param name="alignmentClause"> ''' The value for the AlignmentClause property. ''' </param> ''' <param name="formatClause"> ''' The value for the FormatClause property. ''' </param> ''' <param name="closeBraceToken"> ''' The value for the CloseBraceToken property. ''' </param> Public Function Update(openBraceToken As SyntaxToken, expression As ExpressionSyntax, alignmentClause As InterpolationAlignmentClauseSyntax, formatClause As InterpolationFormatClauseSyntax, closeBraceToken As SyntaxToken) As InterpolationSyntax If openBraceToken <> Me.OpenBraceToken OrElse expression IsNot Me.Expression OrElse alignmentClause IsNot Me.AlignmentClause OrElse formatClause IsNot Me.FormatClause OrElse closeBraceToken <> Me.CloseBraceToken Then Dim newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an alignment clause ',alignment' of an interpolated string embedded ''' expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.InterpolationAlignmentClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class InterpolationAlignmentClauseSyntax Inherits VisualBasicSyntaxNode Friend _value as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), commaToken As InternalSyntax.PunctuationSyntax, value As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolationAlignmentClauseSyntax(kind, errors, annotations, commaToken, DirectCast(value.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The comma ',' token. ''' </summary> Public ReadOnly Property CommaToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolationAlignmentClauseSyntax)._commaToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the CommaToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCommaToken(commaToken as SyntaxToken) As InterpolationAlignmentClauseSyntax return Update(commaToken, Me.Value) End Function ''' <summary> ''' An expression representing the alignment of the interpolated expression. ''' </summary> Public ReadOnly Property Value As ExpressionSyntax Get Return GetRed(_value, 1) End Get End Property ''' <summary> ''' Returns a copy of this with the Value property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithValue(value as ExpressionSyntax) As InterpolationAlignmentClauseSyntax return Update(Me.CommaToken, value) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me._value Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 1 Return Me.Value Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitInterpolationAlignmentClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitInterpolationAlignmentClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="commaToken"> ''' The value for the CommaToken property. ''' </param> ''' <param name="value"> ''' The value for the Value property. ''' </param> Public Function Update(commaToken As SyntaxToken, value As ExpressionSyntax) As InterpolationAlignmentClauseSyntax If commaToken <> Me.CommaToken OrElse value IsNot Me.Value Then Dim newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a format string clause ':formatString' of an interpolated string ''' embedded expression. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.InterpolationFormatClause"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class InterpolationFormatClauseSyntax Inherits VisualBasicSyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), colonToken As InternalSyntax.PunctuationSyntax, formatStringToken As InternalSyntax.InterpolatedStringTextTokenSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolationFormatClauseSyntax(kind, errors, annotations, colonToken, formatStringToken), Nothing, 0) End Sub ''' <summary> ''' The ':' token. ''' </summary> Public ReadOnly Property ColonToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolationFormatClauseSyntax)._colonToken, Me.Position, 0) End Get End Property ''' <summary> ''' Returns a copy of this with the ColonToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithColonToken(colonToken as SyntaxToken) As InterpolationFormatClauseSyntax return Update(colonToken, Me.FormatStringToken) End Function ''' <summary> ''' The format string. ''' </summary> Public ReadOnly Property FormatStringToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.InterpolationFormatClauseSyntax)._formatStringToken, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the FormatStringToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithFormatStringToken(formatStringToken as SyntaxToken) As InterpolationFormatClauseSyntax return Update(Me.ColonToken, formatStringToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitInterpolationFormatClause(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitInterpolationFormatClause(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="colonToken"> ''' The value for the ColonToken property. ''' </param> ''' <param name="formatStringToken"> ''' The value for the FormatStringToken property. ''' </param> Public Function Update(colonToken As SyntaxToken, formatStringToken As SyntaxToken) As InterpolationFormatClauseSyntax If colonToken <> Me.ColonToken OrElse formatStringToken <> Me.FormatStringToken Then Dim newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents a pre-processing directive (such as #If, #Const or #Region) ''' appearing in source. ''' </summary> Public MustInherit Class DirectiveTriviaSyntax Inherits StructuredTriviaSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public ReadOnly Property HashToken As SyntaxToken Get Return Me.GetHashTokenCore() End Get End Property Friend Overridable Function GetHashTokenCore() As SyntaxToken return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Function WithHashToken(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashTokenCore(hashToken) End Function Friend MustOverride Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax End Class ''' <summary> ''' Represents a #Const pre-processing constant declaration appearing in source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ConstDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ConstDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend _value as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, constKeyword As InternalSyntax.KeywordSyntax, name As InternalSyntax.IdentifierTokenSyntax, equalsToken As InternalSyntax.PunctuationSyntax, value As ExpressionSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ConstDirectiveTriviaSyntax(kind, errors, annotations, hashToken, constKeyword, name, equalsToken, DirectCast(value.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax)), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ConstDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As ConstDirectiveTriviaSyntax return Update(hashToken, Me.ConstKeyword, Me.Name, Me.EqualsToken, Me.Value) End Function ''' <summary> ''' The "Const" keyword. ''' </summary> Public ReadOnly Property ConstKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ConstDirectiveTriviaSyntax)._constKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ConstKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithConstKeyword(constKeyword as SyntaxToken) As ConstDirectiveTriviaSyntax return Update(Me.HashToken, constKeyword, Me.Name, Me.EqualsToken, Me.Value) End Function ''' <summary> ''' The name of the pre-processing constant being defined. ''' </summary> Public ReadOnly Property Name As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ConstDirectiveTriviaSyntax)._name, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as SyntaxToken) As ConstDirectiveTriviaSyntax return Update(Me.HashToken, Me.ConstKeyword, name, Me.EqualsToken, Me.Value) End Function ''' <summary> ''' The "=" token. ''' </summary> Public ReadOnly Property EqualsToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ConstDirectiveTriviaSyntax)._equalsToken, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the EqualsToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEqualsToken(equalsToken as SyntaxToken) As ConstDirectiveTriviaSyntax return Update(Me.HashToken, Me.ConstKeyword, Me.Name, equalsToken, Me.Value) End Function ''' <summary> ''' An expression representing the value of the pre-processing constant being ''' defined. ''' </summary> Public ReadOnly Property Value As ExpressionSyntax Get Return GetRed(_value, 4) End Get End Property ''' <summary> ''' Returns a copy of this with the Value property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithValue(value as ExpressionSyntax) As ConstDirectiveTriviaSyntax return Update(Me.HashToken, Me.ConstKeyword, Me.Name, Me.EqualsToken, value) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 4 Return Me._value Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 4 Return Me.Value Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitConstDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitConstDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="constKeyword"> ''' The value for the ConstKeyword property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> ''' <param name="equalsToken"> ''' The value for the EqualsToken property. ''' </param> ''' <param name="value"> ''' The value for the Value property. ''' </param> Public Function Update(hashToken As SyntaxToken, constKeyword As SyntaxToken, name As SyntaxToken, equalsToken As SyntaxToken, value As ExpressionSyntax) As ConstDirectiveTriviaSyntax If hashToken <> Me.HashToken OrElse constKeyword <> Me.ConstKeyword OrElse name <> Me.Name OrElse equalsToken <> Me.EqualsToken OrElse value IsNot Me.Value Then Dim newNode = SyntaxFactory.ConstDirectiveTrivia(hashToken, constKeyword, name, equalsToken, value) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the beginning of an #If pre-processing directive appearing in ''' source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.IfDirectiveTrivia"/></description></item> ''' <item><description><see cref="SyntaxKind.ElseIfDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class IfDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend _condition as ExpressionSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, elseKeyword As InternalSyntax.KeywordSyntax, ifOrElseIfKeyword As InternalSyntax.KeywordSyntax, condition As ExpressionSyntax, thenKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IfDirectiveTriviaSyntax(kind, errors, annotations, hashToken, elseKeyword, ifOrElseIfKeyword, DirectCast(condition.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExpressionSyntax), thenKeyword), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IfDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As IfDirectiveTriviaSyntax return Update(Me.Kind, hashToken, Me.ElseKeyword, Me.IfOrElseIfKeyword, Me.Condition, Me.ThenKeyword) End Function ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ElseKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IfDirectiveTriviaSyntax)._elseKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(1), Me.GetChildIndex(1)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the ElseKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElseKeyword(elseKeyword as SyntaxToken) As IfDirectiveTriviaSyntax return Update(Me.Kind, Me.HashToken, elseKeyword, Me.IfOrElseIfKeyword, Me.Condition, Me.ThenKeyword) End Function Public ReadOnly Property IfOrElseIfKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IfDirectiveTriviaSyntax)._ifOrElseIfKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the IfOrElseIfKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithIfOrElseIfKeyword(ifOrElseIfKeyword as SyntaxToken) As IfDirectiveTriviaSyntax return Update(Me.Kind, Me.HashToken, Me.ElseKeyword, ifOrElseIfKeyword, Me.Condition, Me.ThenKeyword) End Function Public ReadOnly Property Condition As ExpressionSyntax Get Return GetRed(_condition, 3) End Get End Property ''' <summary> ''' Returns a copy of this with the Condition property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCondition(condition as ExpressionSyntax) As IfDirectiveTriviaSyntax return Update(Me.Kind, Me.HashToken, Me.ElseKeyword, Me.IfOrElseIfKeyword, condition, Me.ThenKeyword) End Function ''' <remarks> ''' This child is optional. If it is not present, then Nothing is returned. ''' </remarks> Public ReadOnly Property ThenKeyword As SyntaxToken Get Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.IfDirectiveTriviaSyntax)._thenKeyword If slot IsNot Nothing return new SyntaxToken(Me, slot, Me.GetChildPosition(4), Me.GetChildIndex(4)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the ThenKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithThenKeyword(thenKeyword as SyntaxToken) As IfDirectiveTriviaSyntax return Update(Me.Kind, Me.HashToken, Me.ElseKeyword, Me.IfOrElseIfKeyword, Me.Condition, thenKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 3 Return Me._condition Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 3 Return Me.Condition Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitIfDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitIfDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="kind"> ''' The new kind. ''' </param> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="elseKeyword"> ''' The value for the ElseKeyword property. ''' </param> ''' <param name="ifOrElseIfKeyword"> ''' The value for the IfOrElseIfKeyword property. ''' </param> ''' <param name="condition"> ''' The value for the Condition property. ''' </param> ''' <param name="thenKeyword"> ''' The value for the ThenKeyword property. ''' </param> Public Function Update(kind As SyntaxKind, hashToken As SyntaxToken, elseKeyword As SyntaxToken, ifOrElseIfKeyword As SyntaxToken, condition As ExpressionSyntax, thenKeyword As SyntaxToken) As IfDirectiveTriviaSyntax If kind <> Me.Kind OrElse hashToken <> Me.HashToken OrElse elseKeyword <> Me.ElseKeyword OrElse ifOrElseIfKeyword <> Me.IfOrElseIfKeyword OrElse condition IsNot Me.Condition OrElse thenKeyword <> Me.ThenKeyword Then Dim newNode = SyntaxFactory.IfDirectiveTrivia(kind, hashToken, elseKeyword, ifOrElseIfKeyword, condition, thenKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an #Else pre-processing directive appearing in source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ElseDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ElseDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, elseKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseDirectiveTriviaSyntax(kind, errors, annotations, hashToken, elseKeyword), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As ElseDirectiveTriviaSyntax return Update(hashToken, Me.ElseKeyword) End Function Public ReadOnly Property ElseKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)._elseKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ElseKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithElseKeyword(elseKeyword as SyntaxToken) As ElseDirectiveTriviaSyntax return Update(Me.HashToken, elseKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitElseDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitElseDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="elseKeyword"> ''' The value for the ElseKeyword property. ''' </param> Public Function Update(hashToken As SyntaxToken, elseKeyword As SyntaxToken) As ElseDirectiveTriviaSyntax If hashToken <> Me.HashToken OrElse elseKeyword <> Me.ElseKeyword Then Dim newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an #End If pre-processing directive appearing in source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EndIfDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EndIfDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, endKeyword As InternalSyntax.KeywordSyntax, ifKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax(kind, errors, annotations, hashToken, endKeyword, ifKeyword), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As EndIfDirectiveTriviaSyntax return Update(hashToken, Me.EndKeyword, Me.IfKeyword) End Function Public ReadOnly Property EndKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)._endKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the EndKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEndKeyword(endKeyword as SyntaxToken) As EndIfDirectiveTriviaSyntax return Update(Me.HashToken, endKeyword, Me.IfKeyword) End Function Public ReadOnly Property IfKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)._ifKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the IfKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithIfKeyword(ifKeyword as SyntaxToken) As EndIfDirectiveTriviaSyntax return Update(Me.HashToken, Me.EndKeyword, ifKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEndIfDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEndIfDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="endKeyword"> ''' The value for the EndKeyword property. ''' </param> ''' <param name="ifKeyword"> ''' The value for the IfKeyword property. ''' </param> Public Function Update(hashToken As SyntaxToken, endKeyword As SyntaxToken, ifKeyword As SyntaxToken) As EndIfDirectiveTriviaSyntax If hashToken <> Me.HashToken OrElse endKeyword <> Me.EndKeyword OrElse ifKeyword <> Me.IfKeyword Then Dim newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endKeyword, ifKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the beginning of a #Region directive appearing in source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.RegionDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class RegionDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, regionKeyword As InternalSyntax.KeywordSyntax, name As InternalSyntax.StringLiteralTokenSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RegionDirectiveTriviaSyntax(kind, errors, annotations, hashToken, regionKeyword, name), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As RegionDirectiveTriviaSyntax return Update(hashToken, Me.RegionKeyword, Me.Name) End Function ''' <summary> ''' The "Region" keyword. ''' </summary> Public ReadOnly Property RegionKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)._regionKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the RegionKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithRegionKeyword(regionKeyword as SyntaxToken) As RegionDirectiveTriviaSyntax return Update(Me.HashToken, regionKeyword, Me.Name) End Function ''' <summary> ''' The label of the code region being defined. ''' </summary> Public ReadOnly Property Name As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)._name, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the Name property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithName(name as SyntaxToken) As RegionDirectiveTriviaSyntax return Update(Me.HashToken, Me.RegionKeyword, name) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitRegionDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitRegionDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="regionKeyword"> ''' The value for the RegionKeyword property. ''' </param> ''' <param name="name"> ''' The value for the Name property. ''' </param> Public Function Update(hashToken As SyntaxToken, regionKeyword As SyntaxToken, name As SyntaxToken) As RegionDirectiveTriviaSyntax If hashToken <> Me.HashToken OrElse regionKeyword <> Me.RegionKeyword OrElse name <> Me.Name Then Dim newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, name) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an #End Region directive appearing in source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EndRegionDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EndRegionDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, endKeyword As InternalSyntax.KeywordSyntax, regionKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax(kind, errors, annotations, hashToken, endKeyword, regionKeyword), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As EndRegionDirectiveTriviaSyntax return Update(hashToken, Me.EndKeyword, Me.RegionKeyword) End Function ''' <summary> ''' The "End" keyword. ''' </summary> Public ReadOnly Property EndKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)._endKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the EndKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEndKeyword(endKeyword as SyntaxToken) As EndRegionDirectiveTriviaSyntax return Update(Me.HashToken, endKeyword, Me.RegionKeyword) End Function ''' <summary> ''' The "Region" keyword. ''' </summary> Public ReadOnly Property RegionKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)._regionKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the RegionKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithRegionKeyword(regionKeyword as SyntaxToken) As EndRegionDirectiveTriviaSyntax return Update(Me.HashToken, Me.EndKeyword, regionKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEndRegionDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEndRegionDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="endKeyword"> ''' The value for the EndKeyword property. ''' </param> ''' <param name="regionKeyword"> ''' The value for the RegionKeyword property. ''' </param> Public Function Update(hashToken As SyntaxToken, endKeyword As SyntaxToken, regionKeyword As SyntaxToken) As EndRegionDirectiveTriviaSyntax If hashToken <> Me.HashToken OrElse endKeyword <> Me.EndKeyword OrElse regionKeyword <> Me.RegionKeyword Then Dim newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endKeyword, regionKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents the beginning of a #ExternalSource pre-processing directive ''' appearing in source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ExternalSourceDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ExternalSourceDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, externalSourceKeyword As InternalSyntax.KeywordSyntax, openParenToken As InternalSyntax.PunctuationSyntax, externalSource As InternalSyntax.StringLiteralTokenSyntax, commaToken As InternalSyntax.PunctuationSyntax, lineStart As InternalSyntax.IntegerLiteralTokenSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalSourceDirectiveTriviaSyntax(kind, errors, annotations, hashToken, externalSourceKeyword, openParenToken, externalSource, commaToken, lineStart, closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalSourceDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As ExternalSourceDirectiveTriviaSyntax return Update(hashToken, Me.ExternalSourceKeyword, Me.OpenParenToken, Me.ExternalSource, Me.CommaToken, Me.LineStart, Me.CloseParenToken) End Function Public ReadOnly Property ExternalSourceKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalSourceDirectiveTriviaSyntax)._externalSourceKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ExternalSourceKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithExternalSourceKeyword(externalSourceKeyword as SyntaxToken) As ExternalSourceDirectiveTriviaSyntax return Update(Me.HashToken, externalSourceKeyword, Me.OpenParenToken, Me.ExternalSource, Me.CommaToken, Me.LineStart, Me.CloseParenToken) End Function Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalSourceDirectiveTriviaSyntax)._openParenToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As ExternalSourceDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalSourceKeyword, openParenToken, Me.ExternalSource, Me.CommaToken, Me.LineStart, Me.CloseParenToken) End Function Public ReadOnly Property ExternalSource As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalSourceDirectiveTriviaSyntax)._externalSource, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the ExternalSource property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithExternalSource(externalSource as SyntaxToken) As ExternalSourceDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalSourceKeyword, Me.OpenParenToken, externalSource, Me.CommaToken, Me.LineStart, Me.CloseParenToken) End Function Public ReadOnly Property CommaToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalSourceDirectiveTriviaSyntax)._commaToken, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property ''' <summary> ''' Returns a copy of this with the CommaToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithCommaToken(commaToken as SyntaxToken) As ExternalSourceDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalSourceKeyword, Me.OpenParenToken, Me.ExternalSource, commaToken, Me.LineStart, Me.CloseParenToken) End Function Public ReadOnly Property LineStart As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalSourceDirectiveTriviaSyntax)._lineStart, Me.GetChildPosition(5), Me.GetChildIndex(5)) End Get End Property ''' <summary> ''' Returns a copy of this with the LineStart property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithLineStart(lineStart as SyntaxToken) As ExternalSourceDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalSourceKeyword, Me.OpenParenToken, Me.ExternalSource, Me.CommaToken, lineStart, Me.CloseParenToken) End Function Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalSourceDirectiveTriviaSyntax)._closeParenToken, Me.GetChildPosition(6), Me.GetChildIndex(6)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As ExternalSourceDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalSourceKeyword, Me.OpenParenToken, Me.ExternalSource, Me.CommaToken, Me.LineStart, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitExternalSourceDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitExternalSourceDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="externalSourceKeyword"> ''' The value for the ExternalSourceKeyword property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="externalSource"> ''' The value for the ExternalSource property. ''' </param> ''' <param name="commaToken"> ''' The value for the CommaToken property. ''' </param> ''' <param name="lineStart"> ''' The value for the LineStart property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(hashToken As SyntaxToken, externalSourceKeyword As SyntaxToken, openParenToken As SyntaxToken, externalSource As SyntaxToken, commaToken As SyntaxToken, lineStart As SyntaxToken, closeParenToken As SyntaxToken) As ExternalSourceDirectiveTriviaSyntax If hashToken <> Me.HashToken OrElse externalSourceKeyword <> Me.ExternalSourceKeyword OrElse openParenToken <> Me.OpenParenToken OrElse externalSource <> Me.ExternalSource OrElse commaToken <> Me.CommaToken OrElse lineStart <> Me.LineStart OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.ExternalSourceDirectiveTrivia(hashToken, externalSourceKeyword, openParenToken, externalSource, commaToken, lineStart, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an #End ExternalSource pre-processing directive appearing in source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EndExternalSourceDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EndExternalSourceDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, endKeyword As InternalSyntax.KeywordSyntax, externalSourceKeyword As InternalSyntax.KeywordSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndExternalSourceDirectiveTriviaSyntax(kind, errors, annotations, hashToken, endKeyword, externalSourceKeyword), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndExternalSourceDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As EndExternalSourceDirectiveTriviaSyntax return Update(hashToken, Me.EndKeyword, Me.ExternalSourceKeyword) End Function Public ReadOnly Property EndKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndExternalSourceDirectiveTriviaSyntax)._endKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the EndKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEndKeyword(endKeyword as SyntaxToken) As EndExternalSourceDirectiveTriviaSyntax return Update(Me.HashToken, endKeyword, Me.ExternalSourceKeyword) End Function Public ReadOnly Property ExternalSourceKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EndExternalSourceDirectiveTriviaSyntax)._externalSourceKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the ExternalSourceKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithExternalSourceKeyword(externalSourceKeyword as SyntaxToken) As EndExternalSourceDirectiveTriviaSyntax return Update(Me.HashToken, Me.EndKeyword, externalSourceKeyword) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEndExternalSourceDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEndExternalSourceDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="endKeyword"> ''' The value for the EndKeyword property. ''' </param> ''' <param name="externalSourceKeyword"> ''' The value for the ExternalSourceKeyword property. ''' </param> Public Function Update(hashToken As SyntaxToken, endKeyword As SyntaxToken, externalSourceKeyword As SyntaxToken) As EndExternalSourceDirectiveTriviaSyntax If hashToken <> Me.HashToken OrElse endKeyword <> Me.EndKeyword OrElse externalSourceKeyword <> Me.ExternalSourceKeyword Then Dim newNode = SyntaxFactory.EndExternalSourceDirectiveTrivia(hashToken, endKeyword, externalSourceKeyword) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an #ExternalChecksum pre-processing directive appearing in source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ExternalChecksumDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ExternalChecksumDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, externalChecksumKeyword As InternalSyntax.KeywordSyntax, openParenToken As InternalSyntax.PunctuationSyntax, externalSource As InternalSyntax.StringLiteralTokenSyntax, firstCommaToken As InternalSyntax.PunctuationSyntax, guid As InternalSyntax.StringLiteralTokenSyntax, secondCommaToken As InternalSyntax.PunctuationSyntax, checksum As InternalSyntax.StringLiteralTokenSyntax, closeParenToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalChecksumDirectiveTriviaSyntax(kind, errors, annotations, hashToken, externalChecksumKeyword, openParenToken, externalSource, firstCommaToken, guid, secondCommaToken, checksum, closeParenToken), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalChecksumDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As ExternalChecksumDirectiveTriviaSyntax return Update(hashToken, Me.ExternalChecksumKeyword, Me.OpenParenToken, Me.ExternalSource, Me.FirstCommaToken, Me.Guid, Me.SecondCommaToken, Me.Checksum, Me.CloseParenToken) End Function Public ReadOnly Property ExternalChecksumKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalChecksumDirectiveTriviaSyntax)._externalChecksumKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ExternalChecksumKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithExternalChecksumKeyword(externalChecksumKeyword as SyntaxToken) As ExternalChecksumDirectiveTriviaSyntax return Update(Me.HashToken, externalChecksumKeyword, Me.OpenParenToken, Me.ExternalSource, Me.FirstCommaToken, Me.Guid, Me.SecondCommaToken, Me.Checksum, Me.CloseParenToken) End Function Public ReadOnly Property OpenParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalChecksumDirectiveTriviaSyntax)._openParenToken, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the OpenParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithOpenParenToken(openParenToken as SyntaxToken) As ExternalChecksumDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalChecksumKeyword, openParenToken, Me.ExternalSource, Me.FirstCommaToken, Me.Guid, Me.SecondCommaToken, Me.Checksum, Me.CloseParenToken) End Function Public ReadOnly Property ExternalSource As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalChecksumDirectiveTriviaSyntax)._externalSource, Me.GetChildPosition(3), Me.GetChildIndex(3)) End Get End Property ''' <summary> ''' Returns a copy of this with the ExternalSource property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithExternalSource(externalSource as SyntaxToken) As ExternalChecksumDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalChecksumKeyword, Me.OpenParenToken, externalSource, Me.FirstCommaToken, Me.Guid, Me.SecondCommaToken, Me.Checksum, Me.CloseParenToken) End Function Public ReadOnly Property FirstCommaToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalChecksumDirectiveTriviaSyntax)._firstCommaToken, Me.GetChildPosition(4), Me.GetChildIndex(4)) End Get End Property ''' <summary> ''' Returns a copy of this with the FirstCommaToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithFirstCommaToken(firstCommaToken as SyntaxToken) As ExternalChecksumDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalChecksumKeyword, Me.OpenParenToken, Me.ExternalSource, firstCommaToken, Me.Guid, Me.SecondCommaToken, Me.Checksum, Me.CloseParenToken) End Function Public ReadOnly Property Guid As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalChecksumDirectiveTriviaSyntax)._guid, Me.GetChildPosition(5), Me.GetChildIndex(5)) End Get End Property ''' <summary> ''' Returns a copy of this with the Guid property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithGuid(guid as SyntaxToken) As ExternalChecksumDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalChecksumKeyword, Me.OpenParenToken, Me.ExternalSource, Me.FirstCommaToken, guid, Me.SecondCommaToken, Me.Checksum, Me.CloseParenToken) End Function Public ReadOnly Property SecondCommaToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalChecksumDirectiveTriviaSyntax)._secondCommaToken, Me.GetChildPosition(6), Me.GetChildIndex(6)) End Get End Property ''' <summary> ''' Returns a copy of this with the SecondCommaToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithSecondCommaToken(secondCommaToken as SyntaxToken) As ExternalChecksumDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalChecksumKeyword, Me.OpenParenToken, Me.ExternalSource, Me.FirstCommaToken, Me.Guid, secondCommaToken, Me.Checksum, Me.CloseParenToken) End Function Public ReadOnly Property Checksum As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalChecksumDirectiveTriviaSyntax)._checksum, Me.GetChildPosition(7), Me.GetChildIndex(7)) End Get End Property ''' <summary> ''' Returns a copy of this with the Checksum property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithChecksum(checksum as SyntaxToken) As ExternalChecksumDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalChecksumKeyword, Me.OpenParenToken, Me.ExternalSource, Me.FirstCommaToken, Me.Guid, Me.SecondCommaToken, checksum, Me.CloseParenToken) End Function Public ReadOnly Property CloseParenToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ExternalChecksumDirectiveTriviaSyntax)._closeParenToken, Me.GetChildPosition(8), Me.GetChildIndex(8)) End Get End Property ''' <summary> ''' Returns a copy of this with the CloseParenToken property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithCloseParenToken(closeParenToken as SyntaxToken) As ExternalChecksumDirectiveTriviaSyntax return Update(Me.HashToken, Me.ExternalChecksumKeyword, Me.OpenParenToken, Me.ExternalSource, Me.FirstCommaToken, Me.Guid, Me.SecondCommaToken, Me.Checksum, closeParenToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitExternalChecksumDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitExternalChecksumDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="externalChecksumKeyword"> ''' The value for the ExternalChecksumKeyword property. ''' </param> ''' <param name="openParenToken"> ''' The value for the OpenParenToken property. ''' </param> ''' <param name="externalSource"> ''' The value for the ExternalSource property. ''' </param> ''' <param name="firstCommaToken"> ''' The value for the FirstCommaToken property. ''' </param> ''' <param name="guid"> ''' The value for the Guid property. ''' </param> ''' <param name="secondCommaToken"> ''' The value for the SecondCommaToken property. ''' </param> ''' <param name="checksum"> ''' The value for the Checksum property. ''' </param> ''' <param name="closeParenToken"> ''' The value for the CloseParenToken property. ''' </param> Public Function Update(hashToken As SyntaxToken, externalChecksumKeyword As SyntaxToken, openParenToken As SyntaxToken, externalSource As SyntaxToken, firstCommaToken As SyntaxToken, guid As SyntaxToken, secondCommaToken As SyntaxToken, checksum As SyntaxToken, closeParenToken As SyntaxToken) As ExternalChecksumDirectiveTriviaSyntax If hashToken <> Me.HashToken OrElse externalChecksumKeyword <> Me.ExternalChecksumKeyword OrElse openParenToken <> Me.OpenParenToken OrElse externalSource <> Me.ExternalSource OrElse firstCommaToken <> Me.FirstCommaToken OrElse guid <> Me.Guid OrElse secondCommaToken <> Me.SecondCommaToken OrElse checksum <> Me.Checksum OrElse closeParenToken <> Me.CloseParenToken Then Dim newNode = SyntaxFactory.ExternalChecksumDirectiveTrivia(hashToken, externalChecksumKeyword, openParenToken, externalSource, firstCommaToken, guid, secondCommaToken, checksum, closeParenToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents #Enable Warning pre-processing directive appearing in source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.EnableWarningDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class EnableWarningDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend _errorCodes as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, enableKeyword As InternalSyntax.KeywordSyntax, warningKeyword As InternalSyntax.KeywordSyntax, errorCodes As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnableWarningDirectiveTriviaSyntax(kind, errors, annotations, hashToken, enableKeyword, warningKeyword, if(errorCodes IsNot Nothing, errorCodes.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnableWarningDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As EnableWarningDirectiveTriviaSyntax return Update(hashToken, Me.EnableKeyword, Me.WarningKeyword, Me.ErrorCodes) End Function Public ReadOnly Property EnableKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnableWarningDirectiveTriviaSyntax)._enableKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the EnableKeyword property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithEnableKeyword(enableKeyword as SyntaxToken) As EnableWarningDirectiveTriviaSyntax return Update(Me.HashToken, enableKeyword, Me.WarningKeyword, Me.ErrorCodes) End Function Public ReadOnly Property WarningKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.EnableWarningDirectiveTriviaSyntax)._warningKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the WarningKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithWarningKeyword(warningKeyword as SyntaxToken) As EnableWarningDirectiveTriviaSyntax return Update(Me.HashToken, Me.EnableKeyword, warningKeyword, Me.ErrorCodes) End Function Public ReadOnly Property ErrorCodes As SeparatedSyntaxList(Of IdentifierNameSyntax) Get Dim listNode = GetRed(_errorCodes, 3) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of IdentifierNameSyntax)(listNode, Me.GetChildIndex(3)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the ErrorCodes property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithErrorCodes(errorCodes as SeparatedSyntaxList(Of IdentifierNameSyntax)) As EnableWarningDirectiveTriviaSyntax return Update(Me.HashToken, Me.EnableKeyword, Me.WarningKeyword, errorCodes) End Function Public Shadows Function AddErrorCodes(ParamArray items As IdentifierNameSyntax()) As EnableWarningDirectiveTriviaSyntax Return Me.WithErrorCodes(Me.ErrorCodes.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 3 Return Me._errorCodes Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 3 Return GetRed(_errorCodes, 3) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitEnableWarningDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitEnableWarningDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="enableKeyword"> ''' The value for the EnableKeyword property. ''' </param> ''' <param name="warningKeyword"> ''' The value for the WarningKeyword property. ''' </param> ''' <param name="errorCodes"> ''' The value for the ErrorCodes property. ''' </param> Public Function Update(hashToken As SyntaxToken, enableKeyword As SyntaxToken, warningKeyword As SyntaxToken, errorCodes As SeparatedSyntaxList(Of IdentifierNameSyntax)) As EnableWarningDirectiveTriviaSyntax If hashToken <> Me.HashToken OrElse enableKeyword <> Me.EnableKeyword OrElse warningKeyword <> Me.WarningKeyword OrElse errorCodes <> Me.ErrorCodes Then Dim newNode = SyntaxFactory.EnableWarningDirectiveTrivia(hashToken, enableKeyword, warningKeyword, errorCodes) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents #Disable Warning pre-processing directive appearing in source. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.DisableWarningDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class DisableWarningDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend _errorCodes as SyntaxNode Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, disableKeyword As InternalSyntax.KeywordSyntax, warningKeyword As InternalSyntax.KeywordSyntax, errorCodes As SyntaxNode) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DisableWarningDirectiveTriviaSyntax(kind, errors, annotations, hashToken, disableKeyword, warningKeyword, if(errorCodes IsNot Nothing, errorCodes.Green, Nothing)), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DisableWarningDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As DisableWarningDirectiveTriviaSyntax return Update(hashToken, Me.DisableKeyword, Me.WarningKeyword, Me.ErrorCodes) End Function Public ReadOnly Property DisableKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DisableWarningDirectiveTriviaSyntax)._disableKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the DisableKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithDisableKeyword(disableKeyword as SyntaxToken) As DisableWarningDirectiveTriviaSyntax return Update(Me.HashToken, disableKeyword, Me.WarningKeyword, Me.ErrorCodes) End Function Public ReadOnly Property WarningKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.DisableWarningDirectiveTriviaSyntax)._warningKeyword, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the WarningKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithWarningKeyword(warningKeyword as SyntaxToken) As DisableWarningDirectiveTriviaSyntax return Update(Me.HashToken, Me.DisableKeyword, warningKeyword, Me.ErrorCodes) End Function Public ReadOnly Property ErrorCodes As SeparatedSyntaxList(Of IdentifierNameSyntax) Get Dim listNode = GetRed(_errorCodes, 3) If listNode IsNot Nothing Return new SeparatedSyntaxList(Of IdentifierNameSyntax)(listNode, Me.GetChildIndex(3)) End If Return Nothing End Get End Property ''' <summary> ''' Returns a copy of this with the ErrorCodes property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithErrorCodes(errorCodes as SeparatedSyntaxList(Of IdentifierNameSyntax)) As DisableWarningDirectiveTriviaSyntax return Update(Me.HashToken, Me.DisableKeyword, Me.WarningKeyword, errorCodes) End Function Public Shadows Function AddErrorCodes(ParamArray items As IdentifierNameSyntax()) As DisableWarningDirectiveTriviaSyntax Return Me.WithErrorCodes(Me.ErrorCodes.AddRange(items)) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case 3 Return Me._errorCodes Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case 3 Return GetRed(_errorCodes, 3) Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitDisableWarningDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitDisableWarningDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="disableKeyword"> ''' The value for the DisableKeyword property. ''' </param> ''' <param name="warningKeyword"> ''' The value for the WarningKeyword property. ''' </param> ''' <param name="errorCodes"> ''' The value for the ErrorCodes property. ''' </param> Public Function Update(hashToken As SyntaxToken, disableKeyword As SyntaxToken, warningKeyword As SyntaxToken, errorCodes As SeparatedSyntaxList(Of IdentifierNameSyntax)) As DisableWarningDirectiveTriviaSyntax If hashToken <> Me.HashToken OrElse disableKeyword <> Me.DisableKeyword OrElse warningKeyword <> Me.WarningKeyword OrElse errorCodes <> Me.ErrorCodes Then Dim newNode = SyntaxFactory.DisableWarningDirectiveTrivia(hashToken, disableKeyword, warningKeyword, errorCodes) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an #r directive appearing in scripts. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.ReferenceDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class ReferenceDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax, referenceKeyword As InternalSyntax.KeywordSyntax, file As InternalSyntax.StringLiteralTokenSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax(kind, errors, annotations, hashToken, referenceKeyword, file), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As ReferenceDirectiveTriviaSyntax return Update(hashToken, Me.ReferenceKeyword, Me.File) End Function Public ReadOnly Property ReferenceKeyword As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)._referenceKeyword, Me.GetChildPosition(1), Me.GetChildIndex(1)) End Get End Property ''' <summary> ''' Returns a copy of this with the ReferenceKeyword property changed to the ''' specified value. Returns this instance if the specified value is the same as ''' the current value. ''' </summary> Public Shadows Function WithReferenceKeyword(referenceKeyword as SyntaxToken) As ReferenceDirectiveTriviaSyntax return Update(Me.HashToken, referenceKeyword, Me.File) End Function Public ReadOnly Property File As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)._file, Me.GetChildPosition(2), Me.GetChildIndex(2)) End Get End Property ''' <summary> ''' Returns a copy of this with the File property changed to the specified value. ''' Returns this instance if the specified value is the same as the current value. ''' </summary> Public Shadows Function WithFile(file as SyntaxToken) As ReferenceDirectiveTriviaSyntax return Update(Me.HashToken, Me.ReferenceKeyword, file) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Select case i Case Else Return Nothing End Select End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitReferenceDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitReferenceDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> ''' <param name="referenceKeyword"> ''' The value for the ReferenceKeyword property. ''' </param> ''' <param name="file"> ''' The value for the File property. ''' </param> Public Function Update(hashToken As SyntaxToken, referenceKeyword As SyntaxToken, file As SyntaxToken) As ReferenceDirectiveTriviaSyntax If hashToken <> Me.HashToken OrElse referenceKeyword <> Me.ReferenceKeyword OrElse file <> Me.File Then Dim newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class ''' <summary> ''' Represents an unrecognized pre-processing directive. This occurs when the ''' parser encounters a hash '#' token at the beginning of a physical line but does ''' recognize the text that follows as a valid Visual Basic pre-processing ''' directive. ''' </summary> ''' <remarks> ''' <para>This node is associated with the following syntax kinds:</para> ''' <list type="bullet"> ''' <item><description><see cref="SyntaxKind.BadDirectiveTrivia"/></description></item> ''' </list> ''' </remarks> Public NotInheritable Class BadDirectiveTriviaSyntax Inherits DirectiveTriviaSyntax Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer) MyBase.New(green, parent, startLocation) Debug.Assert(green IsNot Nothing) Debug.Assert(startLocation >= 0) End Sub Friend Sub New(ByVal kind As SyntaxKind, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation(), hashToken As InternalSyntax.PunctuationSyntax) Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.BadDirectiveTriviaSyntax(kind, errors, annotations, hashToken), Nothing, 0) End Sub ''' <summary> ''' The "#" token in a preprocessor directive. ''' </summary> Public Shadows ReadOnly Property HashToken As SyntaxToken Get return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.BadDirectiveTriviaSyntax)._hashToken, Me.Position, 0) End Get End Property Friend Overrides Function GetHashTokenCore() As SyntaxToken Return Me.HashToken End Function Friend Overrides Function WithHashTokenCore(hashToken As SyntaxToken) As DirectiveTriviaSyntax Return WithHashToken(hashToken) End Function ''' <summary> ''' Returns a copy of this with the HashToken property changed to the specified ''' value. Returns this instance if the specified value is the same as the current ''' value. ''' </summary> Public Shadows Function WithHashToken(hashToken as SyntaxToken) As BadDirectiveTriviaSyntax return Update(hashToken) End Function Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode If i = 0 Then Return Nothing Else Return Nothing End If End Function Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode Return Nothing End Function Public Overrides Function Accept(Of TResult)(ByVal visitor As VisualBasicSyntaxVisitor(Of TResult)) As TResult Return visitor.VisitBadDirectiveTrivia(Me) End Function Public Overrides Sub Accept(ByVal visitor As VisualBasicSyntaxVisitor) visitor.VisitBadDirectiveTrivia(Me) End Sub ''' <summary> ''' Returns a copy of this with the specified changes. Returns this instance if ''' there are no actual changes. ''' </summary> ''' <param name="hashToken"> ''' The value for the HashToken property. ''' </param> Public Function Update(hashToken As SyntaxToken) As BadDirectiveTriviaSyntax If hashToken <> Me.HashToken Then Dim newNode = SyntaxFactory.BadDirectiveTrivia(hashToken) Dim annotations = Me.GetAnnotations() If annotations IsNot Nothing AndAlso annotations.Length > 0 return newNode.WithAnnotations(annotations) End If Return newNode End If Return Me End Function End Class End Namespace