Esempio n. 1
0
        private static IMember ConvertToMember(IUnresolvedMember input)
        {
            IUnresolvedField field = input as IUnresolvedField;

            if (field != null)
            {
                return(new VB6Field(field));
            }

            IUnresolvedMethod method = input as IUnresolvedMethod;

            if (method != null)
            {
                return(new VB6Method(method));
            }

            IUnresolvedProperty property = input as IUnresolvedProperty;

            if (property != null)
            {
                return(new VB6Property(property));
            }

            return(null);
        }
        /// <summary>
        /// Gets the CompletionImage instance for the specified entity.
        /// Returns null when no image is available for the entity type.
        /// </summary>
        public static CompletionImage GetCompletionImage(IUnresolvedEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            switch (entity.SymbolKind)
            {
            case SymbolKind.TypeDefinition:
                return(GetCompletionImageForType(((IUnresolvedTypeDefinition)entity).Kind, entity.IsStatic));

            case SymbolKind.Field:
                IUnresolvedField field = (IUnresolvedField)entity;
                if (field.IsConst)
                {
                    if (field.DeclaringTypeDefinition != null && field.DeclaringTypeDefinition.Kind == TypeKind.Enum)
                    {
                        return(imageEnumValue);
                    }
                    else
                    {
                        return(imageLiteral);
                    }
                }
                return(field.IsReadOnly ? imageFieldReadOnly : imageField);

            case SymbolKind.Method:
                IUnresolvedMethod method = (IUnresolvedMethod)entity;
                // We cannot reliably detect extension methods in the unresolved type system (e.g. in VB we need to resolve an attribute),
                // but at least we can do it for C#:
                var defMethod = method as DefaultUnresolvedMethod;
                if (defMethod != null && defMethod.IsExtensionMethod)
                {
                    return(imageExtensionMethod);
                }
                return(method.IsOverridable ? imageVirtualMethod : imageMethod);

            case SymbolKind.Property:
                return(imageProperty);

            case SymbolKind.Indexer:
                return(imageIndexer);

            case SymbolKind.Event:
                return(imageEvent);

            case SymbolKind.Operator:
            case SymbolKind.Destructor:
                return(imageOperator);

            case SymbolKind.Constructor:
                return(imageConstructor);

            default:
                return(null);
            }
        }
Esempio n. 3
0
        private IMember ConvertToMember(IUnresolvedMember input)
        {
            IUnresolvedField field = input as IUnresolvedField;

            if (field != null)
            {
                return(new VB6Field(field));
            }

            return(new VB6Member <IUnresolvedMember>(input));
        }
        /// <summary>
        /// Gets the CompletionImage instance for the specified entity.
        /// Returns null when no image is available for the entity type.
        /// </summary>
        public static CompletionImage GetCompletionImage(IUnresolvedEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            switch (entity.SymbolKind)
            {
            case SymbolKind.TypeDefinition:
                return(GetCompletionImageForType(((IUnresolvedTypeDefinition)entity).Kind, entity.IsStatic));

            case SymbolKind.Field:
                IUnresolvedField field = (IUnresolvedField)entity;
                if (field.IsConst)
                {
                    if (field.DeclaringTypeDefinition != null && field.DeclaringTypeDefinition.Kind == TypeKind.Enum)
                    {
                        return(imageEnumValue);
                    }
                    else
                    {
                        return(imageLiteral);
                    }
                }
                return(field.IsReadOnly ? imageFieldReadOnly : imageField);

            case SymbolKind.Method:
                IUnresolvedMethod method = (IUnresolvedMethod)entity;
                return(method.IsOverridable ? imageVirtualMethod : imageMethod);

            case SymbolKind.Property:
                return(imageProperty);

            case SymbolKind.Indexer:
                return(imageIndexer);

            case SymbolKind.Event:
                return(imageEvent);

            case SymbolKind.Operator:
            case SymbolKind.Destructor:
                return(imageOperator);

            case SymbolKind.Constructor:
                return(imageConstructor);

            default:
                return(null);
            }
        }
Esempio n. 5
0
 public DefaultResolvedField(IUnresolvedField unresolved, ITypeResolveContext parentContext)
     : base(unresolved, parentContext)
 {
 }
Esempio n. 6
0
		public DefaultResolvedField(IUnresolvedField unresolved, ITypeResolveContext parentContext)
			: base(unresolved, parentContext)
		{
		}
Esempio n. 7
0
 public ResolvedFieldSpec(IUnresolvedField unresolved, ITypeResolveContext parentContext)
     : base(unresolved, parentContext)
 {
 }