/// <inheritdoc />
        protected override CallingConventions GetFunctionCallingConvention(StaticFunctionWrapper function)
        {
            CodeFunction2 functionHandle = (CodeFunction2)function.Handle;

            // FIXME: No way to determine VarArgs convention.
            CallingConventions flags = CallingConventions.Standard;

            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, CallingConventions.HasThis, !functionHandle.IsShared);
            return(flags);
        }
        /// <inheritdoc />
        protected override ParameterAttributes GetParameterAttributes(StaticParameterWrapper parameter)
        {
            if (parameter.Handle is CodeTypeRef)
            {
                return(ParameterAttributes.None);
            }

            CodeParameter2 parameterHandle = (CodeParameter2)parameter.Handle;

            vsCMParameterKind   kind  = parameterHandle.ParameterKind;
            ParameterAttributes flags = 0;

            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, ParameterAttributes.HasDefault, parameterHandle.DefaultValue != null);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, ParameterAttributes.In, (kind & vsCMParameterKind.vsCMParameterKindIn) != 0);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, ParameterAttributes.Out, (kind & vsCMParameterKind.vsCMParameterKindOut) != 0);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, ParameterAttributes.Optional, (kind & vsCMParameterKind.vsCMParameterKindOptional) != 0);
            return(flags);
        }
        /// <inheritdoc />
        protected override TypeAttributes GetTypeAttributes(StaticDeclaredTypeWrapper type)
        {
            CodeType typeHandle = (CodeType)type.Handle;

            TypeAttributes flags = 0;

            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, TypeAttributes.Interface, typeHandle.Kind == vsCMElement.vsCMElementInterface);

            //TODO ReflectorFlagsUtils.AddFlagIfTrue(ref flags, TypeAttributes.Abstract, typeHandle.);
            //TODO ReflectorFlagsUtils.AddFlagIfTrue(ref flags, TypeAttributes.Sealed, modifiers.IsSealed);

            bool isNested = typeHandle.Parent is CodeType;

            // FIXME: Don't know what to do with WithEvents
            switch (typeHandle.Access)
            {
            case vsCMAccess.vsCMAccessPublic:
                flags |= isNested ? TypeAttributes.NestedPublic : TypeAttributes.Public;
                break;

            case vsCMAccess.vsCMAccessPrivate:
                flags |= isNested ? TypeAttributes.NestedPrivate : TypeAttributes.NotPublic;
                break;

            case vsCMAccess.vsCMAccessDefault:
            case vsCMAccess.vsCMAccessProject:
                flags |= isNested ? TypeAttributes.NestedAssembly : TypeAttributes.NotPublic;
                break;

            case vsCMAccess.vsCMAccessProtected:
                flags |= isNested ? TypeAttributes.NestedFamily : TypeAttributes.NotPublic;
                break;

            case vsCMAccess.vsCMAccessAssemblyOrFamily:
            case vsCMAccess.vsCMAccessProjectOrProtected:
                flags |= isNested ? TypeAttributes.NestedFamORAssem : TypeAttributes.NotPublic;
                break;
            }

            return(flags);
        }
        /// <inheritdoc />
        protected override MethodAttributes GetFunctionAttributes(StaticFunctionWrapper function)
        {
            CodeFunction2 functionHandle = (CodeFunction2)function.Handle;

            // FIXME: Don't know how to handle vsCMAccessWithEvents
            MethodAttributes flags = 0;

            switch (functionHandle.Access)
            {
            case vsCMAccess.vsCMAccessPublic:
                flags |= MethodAttributes.Public;
                break;

            case vsCMAccess.vsCMAccessPrivate:
                flags |= MethodAttributes.Private;
                break;

            case vsCMAccess.vsCMAccessDefault:
            case vsCMAccess.vsCMAccessProject:
                flags |= MethodAttributes.Assembly;
                break;

            case vsCMAccess.vsCMAccessProtected:
                flags |= MethodAttributes.Family;
                break;

            case vsCMAccess.vsCMAccessAssemblyOrFamily:
            case vsCMAccess.vsCMAccessProjectOrProtected:
                flags |= MethodAttributes.FamORAssem;
                break;
            }

            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, MethodAttributes.Static, functionHandle.IsShared);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, MethodAttributes.Abstract, (functionHandle.OverrideKind & vsCMOverrideKind.vsCMOverrideKindAbstract) != 0);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, MethodAttributes.Final, (functionHandle.OverrideKind & vsCMOverrideKind.vsCMOverrideKindSealed) != 0);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, MethodAttributes.Virtual, (functionHandle.OverrideKind & vsCMOverrideKind.vsCMOverrideKindVirtual) != 0);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, MethodAttributes.NewSlot, (functionHandle.OverrideKind & vsCMOverrideKind.vsCMOverrideKindOverride) == 0);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, MethodAttributes.HideBySig, true); // FIXME
            return(flags);
        }
        /// <inheritdoc />
        protected override FieldAttributes GetFieldAttributes(StaticFieldWrapper field)
        {
            CodeVariable2 fieldHandle = (CodeVariable2)field.Handle;

            // FIXME: Don't know how to handle vsCMAccessWithEvents
            FieldAttributes flags = 0;

            switch (fieldHandle.Access)
            {
            case vsCMAccess.vsCMAccessPublic:
                flags |= FieldAttributes.Public;
                break;

            case vsCMAccess.vsCMAccessPrivate:
                flags |= FieldAttributes.Private;
                break;

            case vsCMAccess.vsCMAccessDefault:
            case vsCMAccess.vsCMAccessProject:
                flags |= FieldAttributes.Assembly;
                break;

            case vsCMAccess.vsCMAccessProtected:
                flags |= FieldAttributes.Family;
                break;

            case vsCMAccess.vsCMAccessAssemblyOrFamily:
            case vsCMAccess.vsCMAccessProjectOrProtected:
                flags |= FieldAttributes.FamORAssem;
                break;
            }

            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, FieldAttributes.Static, fieldHandle.IsShared);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, FieldAttributes.InitOnly, fieldHandle.ConstKind == vsCMConstKind.vsCMConstKindReadOnly);
            ReflectorFlagsUtils.AddFlagIfTrue(ref flags, FieldAttributes.Literal, fieldHandle.ConstKind == vsCMConstKind.vsCMConstKindConst);
            return(flags);
        }