dumper.vb
来自「大名鼎鼎的mono是.NET平台的跨平台(支持linux」· VB 代码 · 共 1,255 行 · 第 1/3 页
VB
1,255 行
Public Sub Dump(ByVal Element As DoStatement) Dumper.Write("Do ") If Element.PreCondition IsNot Nothing Then If Element.IsWhile Then Dumper.Write("While ") Else Dumper.Write("Until ") Element.PreCondition.Dump(Dumper) End If Dumper.WriteLine("") Dump(Element.CodeBlock) Dumper.Write("Loop ") If Element.PostCondition IsNot Nothing Then If Element.IsWhile Then Dumper.Write("While ") Else Dumper.Write("Until ") Element.PostCondition.Dump(Dumper) End If Dumper.WriteLine("") End Sub Public Sub Dump(ByVal Element As CatchStatement) Dumper.Write("Catch ") If Element.Variable IsNot Nothing Then Element.Variable.Dump(Dumper) Dumper.Write(" As ") Dump(Element.TypeName) Dumper.Write(" ") End If If Element.When IsNot Nothing Then Dumper.Write("When ") Element.When.Dump(Dumper) End If Dumper.WriteLine("") Dump(Element.CodeBlock) End Sub Sub Dump(ByVal Element As CaseClauses) Dim sep As String = "" For Each e As CaseClause In Element Dumper.Write(sep) Dump(e) sep = ", " Next End Sub Public Sub Dump(ByVal Element As CaseStatement) Dumper.Write("Case ") If Element.IsElse Then Dumper.WriteLine("Else") Else Dump(Element.Clauses) Dumper.WriteLine("") End If Dump(Element.CodeBlock) End Sub Public Sub Dump(ByVal Element As ArrayElementInitializer) Dumper.Write("{") If Element.Initializers IsNot Nothing Then Dump(Element.Initializers) End If Dumper.Write("}") End Sub Public Sub Dump(ByVal Element As AssemblyDeclaration) Dumper.WriteLine("'Dump of assembly:") Dumper.Indent() If Element.Attributes IsNot Nothing Then Dump(Element.Attributes) Dumper.WriteLine("") Dump(Element.TypeDeclarations) Dumper.Unindent() Dumper.WriteLine("'End of dump of assembly.") End Sub Sub Dump(ByVal Element As ClassDeclaration) Dumper.Write("Class " & Element.Name) Dump(Element.TypeParameters) Dumper.WriteLine("") Dumper.Indent() Dump(Element.Members) Dumper.Unindent() Dumper.WriteLine("End Class") End Sub Public Sub Dump(ByVal Element As Argument) If Element.Expression IsNot Nothing Then Dump(Element.Expression) End Sub Sub Dump(ByVal Expression As Expression) 'Helper.NotImplemented() 'Expression.dump() Expression.Dump(Dumper) End Sub Public Sub Dump(ByVal Element As ArgumentList) If Element Is Nothing Then Return Dim sep As String = "" For Each arg As Argument In Element.Arguments Dumper.Write(sep) Dump(arg) sep = ", " Next End Sub Sub Dump(ByVal Element As TypeArgumentList) Dim sep As String = "" For Each t As TypeName In Element Dumper.Write(sep) Dump(t) sep = ", " Next End Sub Public Sub Dump(ByVal Element As OptionExplicitStatement) Dumper.Write("Option Explicit ") If Element.Off Then Dumper.WriteLine("Off") Else Dumper.WriteLine("On") End If End Sub Public Sub Dump(ByVal Element As OptionCompareStatement) Dumper.Write("Option Compare ") If Element.IsBinary Then Dumper.WriteLine("Binary") Else Dumper.WriteLine("Text") End If End Sub Public Sub Dump(ByVal Element As OptionStrictStatement) Dumper.Write("Option Strict ") If Not Element.IsOn Then Dumper.WriteLine("Off") Else Dumper.WriteLine("On") End If End Sub Sub Dump(ByVal Element As ImportsClauses) For Each e As ImportsClause In Element Dump(e) Next End Sub Public Sub Dump(ByVal Element As ImportsClause) Helper.NotImplementedYet("Dump(Element.Clause)") End Sub Sub Dump(ByVal Element As ImportsNamespaceClause) Helper.NotImplementedYet("Dump(Element.Object)") End Sub Sub Dump(ByVal Element As BoundList) If Element.Expressions.GetUpperBound(0) >= 0 AndAlso Element.Expressions(0) IsNot Nothing Then Element.Expressions(0).Dump(Dumper) End If For i As Integer = 1 To Element.Expressions.GetUpperBound(0) Dumper.Write(", ") If Element.Expressions(i) IsNot Nothing Then Element.Expressions(i).Dump(Dumper) End If Next End Sub Public Sub Dump(ByVal Element As ImportsAliasClause) Element.Identifier.Dump(Dumper) Dumper.Write(" = ") Dump(Element.Second) End Sub Sub Dump(ByVal Element As CodeFiles) Helper.NotImplementedYet("Dump(CodeFiles)") 'Dumper.WriteLine("Dump of codefiles:") 'Dumper.Indent() 'For Each cf As CodeFile In Me ' cf.Dump(Dumper) 'Next 'Dumper.Unindent() 'Dumper.WriteLine("End of dump of codefiles.") End Sub Sub Dump(ByVal Element As CodeFile) Dumper.WriteLine(Element.FileName & ":") Dumper.Indent() If Element.OptionCompare IsNot Nothing Then Dump(Element.OptionCompare) If Element.OptionStrict IsNot Nothing Then Dump(Element.OptionStrict) If Element.OptionExplicit IsNot Nothing Then Dump(Element.OptionExplicit) Dump(Element.Imports) Dumper.Unindent() End Sub 'Public Sub Dump(ByVal Element As ArrayTypeName) ' Dumper.Write("New ") ' Dump(Element.NonArrayTypeName) ' Dump(Element.ArrayNameModifier) ' Dump(Element.ArrayElementInitializer) 'End Sub Public Sub Dump(ByVal Element As ArrayTypeName) Dump(Element.TypeName) Dump(Element.ArrayTypeModifiers) End Sub Public Sub Dump(ByVal Element As CodeBlock) Dumper.Indent() 'Helper.DumpCollection(m_Variables, Dumper) 'Helper.DumpCollection(m_Statements, Dumper) Dumper.WriteLine("'Skipped codedump") Dumper.Unindent() End Sub Sub Dump(ByVal Elements As TypeDeclaration()) For Each member As TypeDeclaration In Elements Dump(member) Next End Sub Sub Dump(ByVal Element As FunctionSignature) Dump(DirectCast(Element, SubSignature)) If Element.TypeName IsNot Nothing Then Dumper.Write(" As ") If Element.ReturnTypeAttributes IsNot Nothing Then Dump(Element.ReturnTypeAttributes) Dumper.Write(" ") Dump(Element.TypeName) Dumper.Write(" ") End If End Sub Sub Dump(ByVal Element As TypeDeclaration) If TypeOf Element Is ClassDeclaration Then Dump(DirectCast(Element, ClassDeclaration)) : Return If TypeOf Element Is StructureDeclaration Then Dump(DirectCast(Element, StructureDeclaration)) : Return If TypeOf Element Is InterfaceDeclaration Then Dump(DirectCast(Element, InterfaceDeclaration)) : Return If TypeOf Element Is EnumDeclaration Then Dump(DirectCast(Element, EnumDeclaration)) : Return If TypeOf Element Is DelegateDeclaration Then Dump(DirectCast(Element, DelegateDeclaration)) : Return If TypeOf Element Is ModuleDeclaration Then Dump(DirectCast(Element, ModuleDeclaration)) : Return Helper.NotImplemented() End Sub Sub Dump(ByVal Element As MemberDeclarations) For Each member As IMember In Element If TypeOf member Is TypeDeclaration Then Dump(DirectCast(member, TypeDeclaration)) : Continue For If TypeOf member Is FunctionDeclaration Then Dump(DirectCast(member, FunctionDeclaration)) : Continue For If TypeOf member Is SubDeclaration Then Dump(DirectCast(member, SubDeclaration)) : Continue For If TypeOf member Is RegularPropertyDeclaration Then Dump(DirectCast(member, RegularPropertyDeclaration)) : Continue For If TypeOf member Is VariableDeclaration Then Dump(DirectCast(member, VariableDeclaration)) : Continue For If TypeOf member Is ConstructorDeclaration Then Dump(DirectCast(member, ConstructorDeclaration)) : Continue For If TypeOf member Is ConstantDeclaration Then Dump(DirectCast(member, ConstantDeclaration)) : Continue For If TypeOf member Is MustOverridePropertyDeclaration Then Dump(DirectCast(member, MustOverridePropertyDeclaration)) : Continue For If TypeOf member Is EnumMemberDeclaration Then Dump(DirectCast(member, EnumMemberDeclaration)) : Continue For If TypeOf member Is InterfacePropertyMemberDeclaration Then Dump(DirectCast(member, InterfacePropertyMemberDeclaration)) : Continue For If TypeOf member Is InterfaceSubDeclaration Then Dump(DirectCast(member, InterfaceSubDeclaration)) : Continue For If TypeOf member Is InterfaceFunctionDeclaration Then Dump(DirectCast(member, InterfaceFunctionDeclaration)) : Continue For Helper.NotImplemented() Next End Sub Sub Dump(ByVal obj As IList, ByVal Dumper As IndentedTextWriter, Optional ByVal Delimiter As String = "") Dim tmpDelimiter As String = "" For Each o As BaseObject In obj Dumper.Write(tmpDelimiter) Dump(o) tmpDelimiter = Delimiter Next End Sub Public Sub Dump(ByVal Element As RaiseEventStatement) Dumper.Write("RaiseEvent ") Element.Event.Dump(Dumper) If Element.Arguments IsNot Nothing Then Dumper.Write("(") Dump(Element.Arguments) Dumper.Write(")") End If Dumper.WriteLine("") End Sub Public Sub Dump(ByVal Element As UsingDeclarator) Element.Identifier.Dump(Dumper) If Element.TypeName IsNot Nothing Then Dumper.Write(" As ") If Element.IsNew Then Dumper.Write("New ") Dump(Element.TypeName) End If If Element.ArgumentList IsNot Nothing Then Dumper.Write("(") Dump(Element.ArgumentList) Dumper.Write(")") End If If Element.VariableInitializer IsNot Nothing Then Dumper.Write(" = ") Dump(Element.VariableInitializer) End If End Sub Public Sub Dump(ByVal Element As AttributeArgumentExpression) Element.Expression.Dump(Dumper) End Sub Sub Dump(ByVal Element As AttributePositionalArgumentList) Dim sep As String = "" For Each e As AttributeArgumentExpression In Element Dumper.Write(sep) Dump(e) sep = ", " Next End Sub Sub Dump(ByVal Element As VariablePropertyInitializerList) Dim sep As String = "" For Each e As VariablePropertyInitializer In Element Dumper.Write(sep) Dump(e) sep = ", " Next End Sub Public Sub Dump(ByVal Element As VariablePropertyInitializer) Dump(Element.IdentifierOrKeyword) Dumper.Write(" := ") Dump(Element.AttributeArgumentExpression) End Sub Public Sub Dump(ByVal Element As Attribute) If Element.IsAssembly Then Dumper.Write("Assembly: ") If Element.IsModule Then Dumper.Write("Module: ") If Element.SimpleTypeName IsNot Nothing Then Dump(Element.SimpleTypeName) ElseIf Element.ResolvedType IsNot Nothing Then Dumper.Write(Element.ResolvedType.FullName) End If Dumper.Write("(") If Element.AttributeArguments IsNot Nothing Then Dump(Element.AttributeArguments) End If Dumper.Write(")") End Sub Public Sub Dump(ByVal Element As AttributeArguments) If Element.PositionalArgumentList IsNot Nothing Then Dump(Element.PositionalArgumentList) If Element.VariablePropertyInitializerList IsNot Nothing Then Dump(Element.VariablePropertyInitializerList) End Sub Public Sub Dump(ByVal Element As IdentifierOrKeyword) Dumper.Write("[") Element.Token.Dump(Dumper) dumper.write("]") End Sub Sub Dump(ByVal Element As IdentifierOrKeywordWithTypeArguments) Dump(DirectCast(Element, IdentifierOrKeyword)) If Element.TypeArguments IsNot Nothing Then Dumper.Write("(Of ") Dump(Element.TypeArguments) Dumper.Write(")") End If End Sub Public Sub Dump(ByVal Element As VariableDeclaration) If Element.Modifiers Is Nothing Then Return 'Auto generated variable, such as in a for loop. If Element.CustomAttributes IsNot Nothing Then Dump(Element.CustomAttributes) Dump(Element.Modifiers) Dumper.Write(Element.Name) If Element.TypeName IsNot Nothing Then Dumper.Write(" As ") If Element.IsNew Then Dumper.Write("New ") Dump(Element.TypeName) End If If Element.VariableInitializer IsNot Nothing Then Dumper.Write(" = ") Dump(Element.VariableInitializer) ElseIf Element.ArgumentList IsNot Nothing Then Dumper.Write("(") Dump(Element.ArgumentList) Dumper.Write(")") End If Dumper.WriteLine("") End Sub Public Sub Dump(ByVal Element As EnumMemberDeclaration) If Element.CustomAttributes IsNot Nothing Then Dump(Element.CustomAttributes) Element.Identifier.Dump(Dumper) If Element.ConstantExpression IsNot Nothing Then Dumper.Write(" = ") Element.ConstantExpression.Dump(Dumper) End If Dumper.WriteLine("") End Sub Public Sub Dump(ByVal Element As ConversionOperatorDeclaration) If Element.CustomAttributes IsNot Nothing Then Dump(Element.CustomAttributes) Dump(Element.Modifiers) Dumper.Write("Operator CType(") Dump(Element.Operand) Dumper.Write(")") If Element.Signature.TypeName IsNot Nothing Then Dumper.Write(" As ") If Element.Signature.ReturnTypeAttributes IsNot Nothing Then Dump(Element.Signature.ReturnTypeAttributes) Dump(Element.Signature.TypeName) End If Dumper.WriteLine("") Dumper.Indent() Dump(Element.Code) Dumper.Unindent() Dumper.WriteLine("End Operator") End Sub Public Sub Dump(ByVal Element As ConstantDeclaration) Dumper.Write("Const ") Element.Identifier.Dump(Dumper) If Element.TypeName IsNot Nothing Then Dumper.Write(" As ") Dump(Element.TypeName) End If Dumper.Write(" = ") Element.ConstantExpression.Dump(Dumper) Dumper.WriteLine("") End Sub Public Sub Dump(ByVal Element As MustOverridePropertyDeclaration) If Element.CustomAttributes IsNot Nothing Then Dump(Element.CustomAttributes) Dump(Element.Modifiers) Dumper.Write("Property ") Dump(Element.Signature) If Element.ImplementsClause IsNot Nothing Then Dump(Element.ImplementsClause) Dumper.WriteLine("")
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?