private IEntity CreateEntityForMember(TypeMember member)
        {
            switch (member.NodeType)
            {
            case NodeType.Module:
                return(EntityFor((Module)member));

            case NodeType.InterfaceDefinition:
                return(new InternalInterface(this, (TypeDefinition)member));

            case NodeType.ClassDefinition:
                return(new InternalClass(this, (ClassDefinition)member));

            case NodeType.Field:
                return(new InternalField((Field)member));

            case NodeType.EnumDefinition:
                return(new InternalEnum(this, (EnumDefinition)member));

            case NodeType.EnumMember:
                return(new InternalEnumMember((EnumMember)member));

            case NodeType.Method:
                return(CreateEntityFor((Method)member));

            case NodeType.Constructor:
                return(new InternalConstructor(this, (Constructor)member));

            case NodeType.Property:
                return(new InternalProperty(this, (Property)member));

            case NodeType.Event:
                return(new InternalEvent((Event)member));
            }
            throw new ArgumentException("Member type not supported: " + member.GetType());
        }
        private static bool IsInterfaceMember(TypeMember node)
        {
            var declaringType = node.DeclaringType;

            if (null == declaringType)
            {
                throw CompilerErrorFactory.NotImplemented(node, string.Format("{0} '{1}' is not attached to any type. It should probably have been consumed by a macro but it hasn't.", node.GetType().Name, node.Name));
            }

            return(NodeType.InterfaceDefinition == declaringType.NodeType);
        }