2 writes to _writer
VisualBasicSyntaxGenerator (2)
RedNodes\RedNodeWriter.vb (2)
20
_writer
= writer
25
_writer
= writer
283 references to _writer
VisualBasicSyntaxGenerator (283)
RedNodes\RedNodeWriter.vb (283)
31
_writer
.WriteLine()
32
_writer
.WriteLine("Namespace {0}", Ident(_parseTree.NamespaceName))
33
_writer
.WriteLine()
46
_writer
.WriteLine("End Namespace")
52
_writer
.WriteLine()
53
_writer
.WriteLine("Namespace {0}", Ident(_parseTree.NamespaceName & ".Syntax"))
54
_writer
.WriteLine()
58
_writer
.WriteLine()
60
_writer
.WriteLine()
65
_writer
.WriteLine("End Namespace")
86
GenerateXmlComment(
_writer
, enumeration, 4)
89
_writer
.WriteLine(" <Flags()> _")
91
_writer
.WriteLine(" Public Enum {0}", EnumerationTypeName(enumeration))
97
_writer
.WriteLine(" End Enum")
98
_writer
.WriteLine()
104
_writer
.WriteLine()
107
GenerateXmlComment(
_writer
, enumerator, 8)
109
_writer
.Write(" {0}", Ident(enumerator.Name))
111
_writer
.Write(" = {0}", GetConstantValue(enumerator.Value))
113
_writer
.WriteLine()
127
GenerateXmlComment(
_writer
, nodeStructure, 4, includeRemarks:=True)
130
_writer
.Write(" ")
132
_writer
.Write("Partial ")
135
_writer
.WriteLine("Public MustInherit Class {0}", StructureTypeName(nodeStructure))
137
_writer
.WriteLine("Public NotInheritable Class {0}", StructureTypeName(nodeStructure))
144
_writer
.WriteLine(" Inherits {0}", StructureTypeName(nodeStructure.ParentStructure))
146
_writer
.WriteLine()
203
_writer
.WriteLine(" End Class")
204
_writer
.WriteLine()
214
_writer
.WriteLine(" Public Shadows Function Add{0}(ParamArray items As {1}()) As {2}", child.Name, itemType, nodeStructure.Name)
215
_writer
.WriteLine(" Return Add{0}Core(items)", child.Name)
216
_writer
.WriteLine(" End Function")
217
_writer
.WriteLine(" Friend MustOverride Function Add{0}Core(ParamArray items As {1}()) As {2}", child.Name, itemType, nodeStructure.Name)
221
_writer
.WriteLine(" Public Shadows Function Add{0}(ParamArray items As {1}()) As {2}", child.Name, itemType, nodeStructure.Name)
222
_writer
.WriteLine(" Return Me.With{0}(Me.{0}.AddRange(items))", child.Name)
223
_writer
.WriteLine(" End Function")
224
_writer
.WriteLine()
229
_writer
.WriteLine(" Friend Overrides Function Add{0}Core(ParamArray items As {1}()) As {2}", child.Name, itemType, nodeStructure.ParentStructure.Name)
230
_writer
.WriteLine(" Return Add{0}(items)", child.Name)
231
_writer
.WriteLine(" End Function")
232
_writer
.WriteLine()
277
_writer
.WriteLine(" Public Shadows Function Add{0}{1}(ParamArray items As {2}()) As {3}", child.Name, nestedList.Name, itemType, nodeStructure.Name)
278
_writer
.WriteLine(" Return Add{0}{1}Core(items)", child.Name, nestedList.Name)
279
_writer
.WriteLine(" End Function")
280
_writer
.WriteLine(" Friend MustOverride Function Add{0}{1}Core(ParamArray items As {2}()) As {3}", child.Name, nestedList.Name, itemType, nodeStructure.Name)
281
_writer
.WriteLine()
285
_writer
.WriteLine(" Public Shadows Function Add{0}{1}(ParamArray items As {2}()) As {3}", child.Name, nestedList.Name, itemType, nodeStructure.Name)
286
_writer
.WriteLine(" Dim _child = If(Me.{0} IsNot Nothing, Me.{0}, SyntaxFactory.{1}())", child.Name, FactoryName(childStructure))
287
_writer
.WriteLine(" Return Me.With{0}(_child.Add{1}(items))", child.Name, nestedList.Name)
288
_writer
.WriteLine(" End Function")
289
_writer
.WriteLine()
294
_writer
.WriteLine(" Friend Overrides Function Add{0}{1}Core(ParamArray items As {2}()) As {3}", child.Name, nestedList.Name, itemType, nodeStructure.ParentStructure.Name)
295
_writer
.WriteLine(" Return Add{0}{1}(items)", child.Name, nestedList.Name)
296
_writer
.WriteLine(" End Function")
297
_writer
.WriteLine()
304
_writer
.WriteLine(" Public Overrides ReadOnly Property IsTerminal As Boolean")
305
_writer
.WriteLine(" Get")
306
_writer
.WriteLine(" Return {0}", If(nodeStructure.IsTerminal, "True", "False"))
307
_writer
.WriteLine(" End Get")
308
_writer
.WriteLine(" End Property")
309
_writer
.WriteLine()
316
_writer
.WriteLine(" Friend {0} as {1}", ChildVarName(child), ChildPrivateFieldTypeRef(child))
320
_writer
.WriteLine()
328
_writer
.WriteLine(" Friend Sub New(ByVal green As GreenNode, ByVal parent as SyntaxNode, ByVal startLocation As Integer)")
329
_writer
.WriteLine(" MyBase.New(green, parent, startLocation)")
330
_writer
.WriteLine(" Debug.Assert(green IsNot Nothing)")
331
_writer
.WriteLine(" Debug.Assert(startLocation >= 0)")
332
_writer
.WriteLine(" End Sub")
333
_writer
.WriteLine()
338
_writer
.Write(" Friend Sub New(")
341
_writer
.Write("ByVal kind As {0}, ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation()", NodeKindType())
345
_writer
.Write(", text as String")
350
_writer
.Write(", precedingTrivia As SyntaxTriviaList, followingTrivia As SyntaxTriviaList", StructureTypeName(_parseTree.RootTrivia))
354
_writer
.Write(", ")
359
_writer
.Write(", ")
362
_writer
.WriteLine(")")
366
_writer
.Write(" Me.New(New Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.{0}(", StructureTypeName(nodeStructure))
369
_writer
.Write("kind", NodeKindType())
371
_writer
.Write(", errors, annotations")
375
_writer
.Write(", text")
380
_writer
.Write(", precedingTrivia.Node, followingTrivia.Node")
385
_writer
.Write(", {0}", FieldParamName(allFields(i)))
391
_writer
.Write(", {0}", ChildParamName(child))
394
_writer
.Write(", if({0} IsNot Nothing, {0}.Green, Nothing)", ChildParamName(child))
399
_writer
.Write(", if({0} IsNot Nothing", ChildParamName(child))
403
_writer
.Write(", DirectCast({0}.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.{1})", ChildParamName(child), BaseTypeReference(child))
407
_writer
.Write(", Nothing)")
412
_writer
.WriteLine("), Nothing, 0)")
417
_writer
.WriteLine(" Debug.Assert(text IsNot Nothing)")
421
_writer
.WriteLine(" End Sub")
422
_writer
.WriteLine()
429
_writer
.Write("{0} As {1}", FieldParamName(field, conflictName), FieldTypeRef(field))
434
_writer
.Write("{0} As {1}", ChildParamName(child, conflictName), ChildConstructorTypeRef(child))
439
_writer
.Write("{0} As {1}", ChildParamName(child, conflictName), ChildFactoryTypeRef(node, child, False, False))
466
GenerateXmlComment(
_writer
, field, 8)
468
_writer
.WriteLine(" Public {2}ReadOnly Property {0} As {1}", FieldPropertyName(field), FieldTypeRef(field), GetModifiers(field.ContainingStructure, False, field.Name))
469
_writer
.WriteLine(" Get")
470
_writer
.WriteLine(" Return DirectCast(Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.{0}).{1}", TypeName, FieldPropertyName(field))
471
_writer
.WriteLine(" End Get")
472
_writer
.WriteLine(" End Property")
473
_writer
.WriteLine("")
481
GenerateXmlComment(
_writer
, child, 8)
485
_writer
.WriteLine(" Public ReadOnly Property {0} As {1}", ChildPropertyName(child), ChildPropertyTypeRef(nodeStructure, child))
486
_writer
.WriteLine(" Get")
487
_writer
.WriteLine(" Return Me.Get{0}Core()", child.Name, ChildPropertyTypeRef(nodeStructure, child))
488
_writer
.WriteLine(" End Get")
489
_writer
.WriteLine(" End Property")
490
_writer
.WriteLine("")
492
_writer
.WriteLine(" Friend {0}Function Get{1}Core() As {2}", GetModifiers(child.ContainingStructure, isOverride, child.Name), child.Name, ChildPropertyTypeRef(nodeStructure, child, denyOverride:=True))
494
_writer
.WriteLine(" End Function")
495
_writer
.WriteLine()
499
_writer
.WriteLine(" Public {0}ReadOnly Property {1} As {2}", If(isOverride, "Shadows ", ""), ChildPropertyName(child), ChildPropertyTypeRef(nodeStructure, child))
500
_writer
.WriteLine(" Get")
502
_writer
.WriteLine(" End Get")
503
_writer
.WriteLine(" End Property")
504
_writer
.WriteLine("")
506
_writer
.WriteLine(" Friend {0}Function Get{1}Core() As {2}", GetModifiers(child.ContainingStructure, isOverride, child.Name), child.Name, ChildPropertyTypeRef(nodeStructure, child, denyOverride:=True))
507
_writer
.WriteLine(" Return Me.{0}", ChildPropertyName(child), ChildPropertyTypeRef(nodeStructure, child))
508
_writer
.WriteLine(" End Function")
509
_writer
.WriteLine()
513
_writer
.WriteLine(" Public {0}ReadOnly Property {1} As {2}", GetModifiers(child.ContainingStructure, isOverride, child.Name), ChildPropertyName(child), ChildPropertyTypeRef(nodeStructure, child))
514
_writer
.WriteLine(" Get")
516
_writer
.WriteLine(" End Get")
517
_writer
.WriteLine(" End Property")
518
_writer
.WriteLine("")
526
_writer
.WriteLine($" {extraIndent}Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.{{0}}).{{1}}", StructureTypeName(nodeStructure), ChildVarName(child))
527
_writer
.WriteLine($" {extraIndent}If slot IsNot Nothing")
528
_writer
.WriteLine($" {extraIndent} return new SyntaxTokenList(Me, slot, {{0}}, {{1}})", Me.GetChildPosition(childIndex), Me.GetChildIndex(childIndex))
529
_writer
.WriteLine($" {extraIndent}End If")
530
_writer
.WriteLine($" {extraIndent}Return Nothing")
533
_writer
.WriteLine($" {extraIndent}Dim slot = DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.{{0}}).{{1}}", StructureTypeName(nodeStructure), ChildVarName(child))
534
_writer
.WriteLine($" {extraIndent}If slot IsNot Nothing")
535
_writer
.WriteLine($" {extraIndent} return new SyntaxToken(Me, slot, {{0}}, {{1}})", Me.GetChildPosition(childIndex), Me.GetChildIndex(childIndex))
536
_writer
.WriteLine($" {extraIndent}End If")
537
_writer
.WriteLine($" {extraIndent}Return Nothing")
539
_writer
.WriteLine($" {extraIndent}return new SyntaxToken(Me, DirectCast(Me.Green, Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax.{{0}}).{{1}}, {{2}}, {{3}})", StructureTypeName(nodeStructure), ChildVarName(child), Me.GetChildPosition(childIndex), Me.GetChildIndex(childIndex))
544
_writer
.WriteLine($" {extraIndent}Dim listNode = GetRedAtZero({{0}})", ChildVarName(child))
546
_writer
.WriteLine($" {extraIndent}Dim listNode = GetRed({{0}}, {{1}})", ChildVarName(child), childIndex)
548
_writer
.WriteLine($" {extraIndent}Return new {{0}}(listNode)", ChildPropertyTypeRef(nodeStructure, child, False))
555
_writer
.WriteLine($" {extraIndent}Return GetRedAtZero({{0}})", ChildVarName(child))
557
_writer
.WriteLine($" {extraIndent}Return DirectCast(GetRedAtZero({{0}}), {{1}})", ChildVarName(child), type)
561
_writer
.WriteLine($" {extraIndent}Return GetRed({{0}}, {{1}})", ChildVarName(child), childIndex)
563
_writer
.WriteLine($" {extraIndent}Return DirectCast(GetRed({{0}}, {{1}}), {{2}})", ChildVarName(child), childIndex, type)
599
GenerateWithXmlComment(
_writer
, withChild, 8)
601
_writer
.WriteLine($" Public Function {ChildWithFunctionName(withChild)}({ChildParamName(withChild)} As {ChildPropertyTypeRef(nodeStructure, withChild)}) As {StructureTypeName(nodeStructure)}")
602
_writer
.WriteLine($" Return {ChildWithFunctionName(withChild)}Core({ChildParamName(withChild)})")
603
_writer
.WriteLine($" End Function")
605
_writer
.WriteLine($" Friend MustOverride Function {ChildWithFunctionName(withChild)}Core({ChildParamName(withChild)} As {ChildPropertyTypeRef(nodeStructure, withChild)}) As {StructureTypeName(nodeStructure)}")
611
_writer
.WriteLine($" Friend Overrides Function {ChildWithFunctionName(withChild)}Core({ChildParamName(withChild)} As {ChildPropertyTypeRef(nodeStructure, withChild)}) As {StructureTypeName(nodeStructure.ParentStructure)}")
612
_writer
.WriteLine($" Return {ChildWithFunctionName(withChild)}({ChildParamName(withChild)})")
613
_writer
.WriteLine($" End Function")
614
_writer
.WriteLine()
618
GenerateWithXmlComment(
_writer
, withChild, 8)
619
_writer
.WriteLine(" Public Shadows Function {0}({1} as {2}) As {3}", ChildWithFunctionName(withChild), ChildParamName(withChild), ChildPropertyTypeRef(nodeStructure, withChild), StructureTypeName(nodeStructure))
620
_writer
.Write(" return Update(")
623
_writer
.Write("Me.Kind")
631
_writer
.Write(", ")
633
_writer
.Write("{0}", FieldParamName(allFields(i)))
640
_writer
.Write(", ")
643
_writer
.Write("{0}", ChildParamName(child))
645
_writer
.Write("Me.{0}", UpperFirstCharacter(child.Name))
650
_writer
.WriteLine(")")
651
_writer
.WriteLine(" End Function")
654
_writer
.WriteLine("")
661
GenerateXmlComment(
_writer
, child, 8)
663
_writer
.WriteLine(" Public {2}ReadOnly Property {0} As {1}", ChildPropertyName(child), ChildPropertyTypeRef(node, child), GetModifiers(child.ContainingStructure, isOverride, child.Name))
664
_writer
.WriteLine(" Get")
666
_writer
.WriteLine(" Dim listNode = GetRedAtZero({0})", ChildVarName(child), childIndex)
668
_writer
.WriteLine(" Dim listNode = GetRed({0}, {1})", ChildVarName(child), childIndex)
670
_writer
.WriteLine(" If listNode IsNot Nothing")
671
_writer
.WriteLine(" Return new {0}(listNode, {1})", ChildPropertyTypeRef(node, child), GetChildIndex(childIndex))
672
_writer
.WriteLine(" End If")
673
_writer
.WriteLine(" Return Nothing")
674
_writer
.WriteLine(" End Get")
675
_writer
.WriteLine(" End Property")
676
_writer
.WriteLine("")
684
_writer
.WriteLine(" Public {0} Function Accept(Of TResult)(ByVal visitor As {1}(Of TResult)) As TResult", If(IsRoot(nodeStructure), "Overridable", "Overrides"), _parseTree.VisitorName)
685
_writer
.WriteLine(" Return visitor.{0}(Me)", VisitorMethodName(nodeStructure))
686
_writer
.WriteLine(" End Function")
687
_writer
.WriteLine()
689
_writer
.WriteLine(" Public {0} Sub Accept(ByVal visitor As {1})", If(IsRoot(nodeStructure), "Overridable", "Overrides"), _parseTree.VisitorName)
690
_writer
.WriteLine(" visitor.{0}(Me)", VisitorMethodName(nodeStructure))
691
_writer
.WriteLine(" End Sub")
692
_writer
.WriteLine()
707
_writer
.WriteLine()
709
GenerateSummaryXmlComment(
_writer
, String.Format("Returns a copy of this with the specified changes. Returns this instance if there are no actual changes.", nodeStructure.Name))
712
GenerateParameterXmlComment(
_writer
, "kind", String.Format("The new kind.", nodeStructure.Name))
716
GenerateParameterXmlComment(
_writer
, LowerFirstCharacter(OptionalChildName(child)), String.Format("The value for the {0} property.", child.Name))
719
_writer
.Write(" Public ")
721
_writer
.Write("Shadows ")
724
_writer
.Write("Function Update(")
727
_writer
.Write("kind As SyntaxKind")
733
_writer
.Write(", ")
739
_writer
.WriteLine(") As {0}", structureName)
742
_writer
.Write(" If ")
745
_writer
.Write("kind <> Me.Kind")
751
_writer
.Write(" OrElse ")
755
_writer
.Write("{0} <> Me.{1}", ChildParamName(child), ChildPropertyName(child))
757
_writer
.Write("{0} <> Me.{1}", ChildParamName(child), ChildPropertyName(child))
759
_writer
.Write("{0} IsNot Me.{1}", ChildParamName(child), ChildPropertyName(child))
763
_writer
.WriteLine(" Then")
767
_writer
.Write(" Dim newNode = SyntaxFactory.{0}(", factory)
769
_writer
.Write("kind, ")
773
_writer
.Write(", ")
775
_writer
.Write("{0}", ChildParamName(child))
778
_writer
.WriteLine(")")
780
_writer
.WriteLine(" Dim annotations = Me.GetAnnotations()")
781
_writer
.WriteLine(" If annotations IsNot Nothing AndAlso annotations.Length > 0")
782
_writer
.WriteLine(" return newNode.WithAnnotations(annotations)")
783
_writer
.WriteLine(" End If")
784
_writer
.WriteLine(" Return newNode")
785
_writer
.WriteLine(" End If")
786
_writer
.WriteLine(" Return Me")
787
_writer
.WriteLine(" End Function")
788
_writer
.WriteLine()
793
_writer
.WriteLine()
807
_writer
.WriteLine(" Friend Overrides Function GetNodeSlot(i as Integer) as SyntaxNode")
813
_writer
.WriteLine(" Select case i")
821
_writer
.WriteLine(" Case {0}", i)
824
_writer
.WriteLine(" Return GetRedAtZero({0})", ChildVarName(child))
826
_writer
.WriteLine(" Return GetRed({0}, {1})", ChildVarName(child), i)
829
_writer
.WriteLine(" Return Me.{0}", ChildPropertyName(child))
833
_writer
.WriteLine(" Case Else")
834
_writer
.WriteLine(" Return Nothing")
835
_writer
.WriteLine(" End Select")
838
_writer
.WriteLine(" If i = 0 Then")
841
_writer
.WriteLine(" Return GetRedAtZero({0})", ChildVarName(child))
843
_writer
.WriteLine(" Return Me.{0}", ChildPropertyName(child))
846
_writer
.WriteLine(" Else")
847
_writer
.WriteLine(" Return Nothing")
848
_writer
.WriteLine(" End If")
851
_writer
.WriteLine(" Return Nothing")
854
_writer
.WriteLine(" End Function")
855
_writer
.WriteLine()
869
_writer
.WriteLine(" Friend Overrides Function GetCachedSlot(i as Integer) as SyntaxNode")
875
_writer
.WriteLine(" Select case i")
880
_writer
.WriteLine(" Case {0}", i)
881
_writer
.WriteLine(" Return Me.{0}", ChildVarName(child), i)
884
_writer
.WriteLine(" Case Else")
885
_writer
.WriteLine(" Return Nothing")
886
_writer
.WriteLine(" End Select")
888
_writer
.WriteLine(" If i = 0 Then")
891
_writer
.WriteLine(" Return Nothing")
893
_writer
.WriteLine(" Return Me.{0}", ChildVarName(child))
896
_writer
.WriteLine(" Else")
897
_writer
.WriteLine(" Return Nothing")
898
_writer
.WriteLine(" End If")
901
_writer
.WriteLine(" End Function")
902
_writer
.WriteLine()
907
_writer
.WriteLine(" Public MustInherit Class {0}{1}", Ident(_parseTree.VisitorName), If(withResult, "(Of TResult)", ""))
915
_writer
.WriteLine(" End Class")
916
_writer
.WriteLine()
924
_writer
.WriteLine(" Public Overridable {2} {0}(ByVal node As {1}){3}",
930
_writer
.WriteLine(" {0}Me.DefaultVisit(node){1}", If(withResult, "Return ", ""), If(withResult, "", " : Return"))
931
_writer
.WriteLine(" End {0}", If(withResult, "Function", "Sub"))
936
_writer
.WriteLine(" Public MustInherit Class {0}", Ident(_parseTree.RewriteVisitorName))
937
_writer
.WriteLine(" Inherits {0}(Of SyntaxNode)", Ident(_parseTree.VisitorName))
938
_writer
.WriteLine()
944
_writer
.WriteLine(" End Class")
945
_writer
.WriteLine()
962
_writer
.WriteLine(" Public Overrides Function {0}(ByVal node As {1}) As SyntaxNode",
971
_writer
.WriteLine(" Dim anyChanges As Boolean = False")
972
_writer
.WriteLine()
978
_writer
.WriteLine(" Dim {0} = VisitList(node.{1})", ChildNewVarName(child), ChildPropertyName(child))
980
_writer
.WriteLine(" If node.{0}.Node IsNot {1}.Node Then anyChanges = True", ChildPropertyName(child), ChildNewVarName(child))
982
_writer
.WriteLine(" If node.{0} IsNot {1}.Node Then anyChanges = True", ChildVarName(child), ChildNewVarName(child))
986
_writer
.WriteLine(" Dim {0} = DirectCast(VisitToken(node.{2}).Node, {3})" + Environment.NewLine +
990
_writer
.WriteLine(" Dim {0} = DirectCast(Visit(node.{2}), {1})" + Environment.NewLine +
995
_writer
.WriteLine()
998
_writer
.WriteLine(" If anyChanges Then")
1000
_writer
.Write(" Return New {0}(node.Kind", StructureTypeName(nodeStructure))
1002
_writer
.Write(", node.Green.GetDiagnostics, node.Green.GetAnnotations")
1005
_writer
.Write(", node.{0}", FieldPropertyName(field))
1010
_writer
.Write(", {0}.Node", ChildNewVarName(child))
1012
_writer
.Write(", {0}.Node", ChildNewVarName(child))
1015
_writer
.Write(", {0}", ChildNewVarName(child), ChildFieldTypeRef(child))
1017
_writer
.Write(", {0}", ChildNewVarName(child))
1020
_writer
.WriteLine(")")
1022
_writer
.WriteLine(" Else")
1023
_writer
.WriteLine(" Return node")
1024
_writer
.WriteLine(" End If")
1026
_writer
.WriteLine(" End Function")
1027
_writer
.WriteLine()