Ejemplo n.º 1
0
        public override IDeclaredElement GetDeclaredElement()
        {
            ITypeElement declaredType = GetDeclaredType();

            if (declaredType == null)
            {
                return(null);
            }

            foreach (ITypeMember member in declaredType.EnumerateMembers(myMethodName, false))
            {
                var method = member as IMethod;
                if (method == null)
                {
                    continue;
                }
                if (method.IsAbstract)
                {
                    continue;
                }
                if (method.TypeParameters.Length > 0)
                {
                    continue;
                }
                if (method.AccessibilityDomain.DomainType != AccessibilityDomain.AccessibilityDomainType.PUBLIC)
                {
                    continue;
                }
                return(member);
            }
            return(null);
        }
        private static IDeclaredElement GetTypeMember([NotNull] FSharpMemberOrFunctionOrValue mfv,
                                                      [NotNull] ITypeElement typeElement)
        {
            var compiledName = mfv.GetMfvCompiledName();
            var members      = mfv.IsConstructor
        ? typeElement.Constructors.AsList <ITypeMember>()
        : typeElement.EnumerateMembers(compiledName, true).AsList();

            return(ChooseTypeMember(mfv, members));
        }
        public override IDeclaredElement GetDeclaredElement()
        {
            ITypeElement declaredType = GetDeclaredType();

            if (declaredType == null)
            {
                return(null);
            }

            return(declaredType.EnumerateMembers(FieldName, false)
                   .Where(member => member as IField != null)
                   .FirstOrDefault());
        }
        public override IDeclaredElement GetDeclaredElement()
        {
            ITypeElement declaredType = this.GetDeclaredType();

            if (declaredType == null)
            {
                return(null);
            }

            return(declaredType
                   .EnumerateMembers(this.FieldName, true)
                   .OfType <IField>()
                   .FirstOrDefault());
        }
 protected override IDeclaredElement?GetTypeMember(ITypeElement declaredType)
 {
     return(declaredType
            .EnumerateMembers <IField>(FieldName, declaredType.CaseSensitiveName)
            .FirstOrDefault());
 }