예제 #1
0
        // TODO: Move it to MemberCore
        public static string GetMemberType(MemberContainer mc)
        {
            if (mc is PropertyDeclaration)
            {
                return("property");
            }
            if (mc is IndexerDeclaration)
            {
                return("indexer");
            }
            if (mc is EnumMemberDeclaration)
            {
                return("enum");
            }
            if (mc is FieldDeclaration)
            {
                return("field");
            }
            if (mc is MethodCore)
            {
                return("method");
            }

            if (mc is EventBase)
            {
                return("event");
            }

            return("type");
        }
예제 #2
0
        public override bool IsOverloadAllowed(MemberContainer overload)
        {
            if (overload is IndexerDeclaration)
            {
                return(false);
            }

            return(base.IsOverloadAllowed(overload));
        }
예제 #3
0
 public override void AddMember(MemberContainer member)
 {
     if (member.Name == UnderlyingValueField)
     {
         Report.Error(0, member.Location, "An item in an enumeration cannot have an identifier `{0}'",
                      UnderlyingValueField);
         return;
     }
     base.AddMember(member);
 }
예제 #4
0
        public override bool IsOverloadAllowed(MemberContainer overload)
        {
            if (overload is MethodCore)
            {
                caching_flags |= Flags.MethodOverloadsExist;
                return(true);
            }

            if (overload is AbstractPropertyEventMethod)
            {
                return(true);
            }

            return(base.IsOverloadAllowed(overload));
        }
        public override bool IsOverloadAllowed(MemberContainer overload)
        {
            //
            // Two members can differ in their explicit interface
            // type parameter only
            //
            InterfaceMemberContainer imb = overload as InterfaceMemberContainer;

            if (imb != null && imb.IsExplicitInterfaceImplementation)
            {
                if (IsExplicitInterfaceImplementation)
                {
                    caching_flags |= Flags.MethodOverloadsExist;
                }
                return(true);
            }

            return(IsExplicitInterfaceImplementation);
        }
예제 #6
0
        protected static MemberName MakeMemberName(MemberContainer host, string name, int unique_id, TypeParameters tparams, Location loc)
        {
            string         host_name = host == null ? null : host is InterfaceMemberContainer ? ((InterfaceMemberContainer)host).GetFullName(host.MemberName) : host.MemberName.Name;
            string         tname     = MakeName(host_name, "c", name, unique_id);
            TypeParameters args      = null;

            if (tparams != null)
            {
                args = new TypeParameters(tparams.Count);

                // Type parameters will be filled later when we have TypeContainer
                // instance, for now we need only correct arity to create valid name
                for (int i = 0; i < tparams.Count; ++i)
                {
                    args.Add((UnresolvedTypeParameterSpec)null);
                }
            }

            return(new MemberName(tname, args, loc));
        }
예제 #7
0
        public override bool DoResolve(ResolveContext resolver)
        {
            // Re-discover the property:

            ITypeReference explicitInterfaceType = null;

            if (IsExplicitInterfaceImplementation)
            {
                explicitInterfaceType = member_name.ExplicitInterface as ITypeReference;
            }


            ResolvedProperty = MemberContainer.Resolve(
                resolver.CurrentTypeResolveContext, SymbolKind, name,
                explicitInterfaceType, parameterTypeReferences: null) as ResolvedPropertySpec;

            // We need to use the property as current member so that indexer parameters can be resolved correctly.
            base.DoResolve(resolver);

            return(true);
        }
예제 #8
0
 /// <summary>
 /// Returns true when a member supports multiple overloads (methods, indexers, etc)
 /// </summary>
 public virtual bool IsOverloadAllowed(MemberContainer overload)
 {
     return(false);
 }
예제 #9
0
 public virtual void AddMember(MemberContainer member)
 {
     AddNameToContainer(member, member.Name);
     Members.Add(member);
     member.ApplyInterningProvider(CompilerContext.InternProvider);
 }