Пример #1
0
        public static CodeItem MapMember(VisualBasicSyntax.StatementSyntax member)
        {
            if (member == null)
            {
                return(null);
            }

            switch (member.Kind())
            {
            case VisualBasic.SyntaxKind.FunctionBlock:
            case VisualBasic.SyntaxKind.SubBlock:
                return(MethodMapper.MapMethod(member as VisualBasicSyntax.MethodBlockSyntax, _control, _semanticModel));

            case VisualBasic.SyntaxKind.SubStatement:
                return(MethodMapper.MapMethod(member as VisualBasicSyntax.MethodStatementSyntax, _control, _semanticModel));

            case VisualBasic.SyntaxKind.EnumBlock:
                return(EnumMapper.MapEnum(member as VisualBasicSyntax.EnumBlockSyntax, _control, _semanticModel));

            case VisualBasic.SyntaxKind.EnumMemberDeclaration:
                return(EnumMapper.MapEnumMember(member as VisualBasicSyntax.EnumMemberDeclarationSyntax, _control, _semanticModel));

            case VisualBasic.SyntaxKind.InterfaceBlock:
                return(InterfaceMapper.MapInterface(member as VisualBasicSyntax.InterfaceBlockSyntax, _control, _semanticModel, _tree));

            case VisualBasic.SyntaxKind.FieldDeclaration:
                return(FieldMapper.MapField(member as VisualBasicSyntax.FieldDeclarationSyntax, _control, _semanticModel));

            case VisualBasic.SyntaxKind.PropertyBlock:
                return(PropertyMapper.MapProperty(member as VisualBasicSyntax.PropertyBlockSyntax, _control, _semanticModel));

            case VisualBasic.SyntaxKind.StructureBlock:
                return(StructMapper.MapStruct(member as VisualBasicSyntax.StructureBlockSyntax, _control, _semanticModel));

            case VisualBasic.SyntaxKind.ClassBlock:
            case VisualBasic.SyntaxKind.ModuleBlock:
                return(ClassMapper.MapClass(member as VisualBasicSyntax.TypeBlockSyntax, _control, _semanticModel, _tree));

            case VisualBasic.SyntaxKind.EventBlock:
                return(DelegateEventMapper.MapEvent(member as VisualBasicSyntax.EventBlockSyntax, _control, _semanticModel));

            case VisualBasic.SyntaxKind.DelegateFunctionStatement:
                return(DelegateEventMapper.MapDelegate(member as VisualBasicSyntax.DelegateStatementSyntax, _control, _semanticModel));

            case VisualBasic.SyntaxKind.NamespaceBlock:
                return(NamespaceMapper.MapNamespace(member as VisualBasicSyntax.NamespaceBlockSyntax, _control, _semanticModel, _tree));

            case VisualBasic.SyntaxKind.ConstructorBlock:
                return(MethodMapper.MapConstructor(member as VisualBasicSyntax.ConstructorBlockSyntax, _control, _semanticModel));

            default:
                return(null);
            }
        }
Пример #2
0
        public static CodeItem MapMember(MemberDeclarationSyntax member)
        {
            if (member == null)
            {
                return(null);
            }

            switch (member.Kind())
            {
            case SyntaxKind.MethodDeclaration:
                return(MethodMapper.MapMethod(member as MethodDeclarationSyntax, _control, _semanticModel));

            case SyntaxKind.EnumDeclaration:
                return(EnumMapper.MapEnum(member as EnumDeclarationSyntax, _control, _semanticModel));

            case SyntaxKind.EnumMemberDeclaration:
                return(EnumMapper.MapEnumMember(member as EnumMemberDeclarationSyntax, _control, _semanticModel));

            case SyntaxKind.InterfaceDeclaration:
                return(InterfaceMapper.MapInterface(member as InterfaceDeclarationSyntax, _control, _semanticModel, _tree));

            case SyntaxKind.FieldDeclaration:
                return(FieldMapper.MapField(member as FieldDeclarationSyntax, _control, _semanticModel));

            case SyntaxKind.PropertyDeclaration:
                return(PropertyMapper.MapProperty(member as PropertyDeclarationSyntax, _control, _semanticModel));

            case SyntaxKind.StructDeclaration:
                return(StructMapper.MapStruct(member as StructDeclarationSyntax, _control, _semanticModel));

            case SyntaxKind.ClassDeclaration:
                return(ClassMapper.MapClass(member as ClassDeclarationSyntax, _control, _semanticModel, _tree));

            case SyntaxKind.EventFieldDeclaration:
                return(DelegateEventMapper.MapEvent(member as EventFieldDeclarationSyntax, _control, _semanticModel));

            case SyntaxKind.DelegateDeclaration:
                return(DelegateEventMapper.MapDelegate(member as DelegateDeclarationSyntax, _control, _semanticModel));

            case SyntaxKind.NamespaceDeclaration:
                return(NamespaceMapper.MapNamespace(member as NamespaceDeclarationSyntax, _control, _semanticModel, _tree));

            case SyntaxKind.ConstructorDeclaration:
                return(MethodMapper.MapConstructor(member as ConstructorDeclarationSyntax, _control, _semanticModel));

            case SyntaxKind.IndexerDeclaration:
                return(IndexerMapper.MapIndexer(member as IndexerDeclarationSyntax, _control, _semanticModel));

            default:
                return(null);
            }
        }