Example #1
0
        /// <summary>
        /// Adds extension methods to <paramref name="res"/>.
        /// </summary>
        public static void AddExtensions(LanguageProperties language, Action <IMethodOrProperty> methodFound, IClass callingClass, IReturnType resolvedType, bool searchInAllNamespaces = false)
        {
            if (language == null)
            {
                throw new ArgumentNullException("language");
            }
            if (methodFound == null)
            {
                throw new ArgumentNullException("methodFound");
            }
            if (resolvedType == null)
            {
                throw new ArgumentNullException("resolvedType");
            }
            if (callingClass == null)
            {
                throw new ArgumentNullException("callingClass");
            }

            // convert resolvedType into direct type to speed up the IsApplicable lookups
            resolvedType = resolvedType.GetDirectReturnType();

            foreach (IMethodOrProperty mp in CtrlSpaceResolveHelper.FindAllExtensions(language, callingClass, searchInAllNamespaces))
            {
                TryAddExtension(language, methodFound, mp, resolvedType);
            }
        }
Example #2
0
        public override IReturnType GetDirectReturnType()
        {
            IReturnType newBaseType = baseType.GetDirectReturnType();

            IReturnType[] newTypeArguments     = new IReturnType[typeArguments.Count];
            bool          typeArgumentsChanged = false;

            for (int i = 0; i < typeArguments.Count; i++)
            {
                if (typeArguments[i] != null)
                {
                    newTypeArguments[i] = typeArguments[i].GetDirectReturnType();
                }
                if (typeArguments[i] != newTypeArguments[i])
                {
                    typeArgumentsChanged = true;
                }
            }
            if (baseType == newBaseType && !typeArgumentsChanged)
            {
                return(this);
            }
            else
            {
                return(new ConstructedReturnType(newBaseType, newTypeArguments));
            }
        }
        /// <summary>
        /// Adds extension methods to <paramref name="res"/>.
        /// </summary>
        public static void AddExtensions(LanguageProperties language, ArrayList res, IClass callingClass, IReturnType resolvedType)
        {
            if (language == null)
            {
                throw new ArgumentNullException("language");
            }
            if (res == null)
            {
                throw new ArgumentNullException("res");
            }
            if (resolvedType == null)
            {
                throw new ArgumentNullException("resolvedType");
            }
            if (callingClass == null)
            {
                throw new ArgumentNullException("callingClass");
            }

            // convert resolvedType into direct type to speed up the IsApplicable lookups
            resolvedType = resolvedType.GetDirectReturnType();

            foreach (IMethodOrProperty mp in CtrlSpaceResolveHelper.FindAllExtensions(language, callingClass))
            {
                TryAddExtension(language, res, mp, resolvedType);
            }
        }
Example #4
0
        public virtual IReturnType GetDirectReturnType()
        {
            IReturnType baseType = BaseType;

            using (var l = busyManager.Enter(this)) {
                return((l.Success && baseType != null) ? baseType.GetDirectReturnType() : UnknownReturnType.Instance);
            }
        }
        public virtual IReturnType GetDirectReturnType()
        {
            IReturnType baseType = BaseType;
            IReturnType tmp      = (baseType != null && TryEnter()) ? baseType.GetDirectReturnType() : UnknownReturnType.Instance;

            Leave();
            return(tmp);
        }
        public override IReturnType GetDirectReturnType()
        {
            IReturnType newBaseType = baseType.GetDirectReturnType();

            if (newBaseType == baseType)
            {
                return(this);
            }
            else
            {
                return(new PointerReturnType(newBaseType));
            }
        }
Example #7
0
        public override IReturnType GetDirectReturnType()
        {
            IReturnType newElementType = elementType.GetDirectReturnType();

            if (newElementType == elementType)
            {
                return(this);
            }
            else
            {
                return(new ArrayReturnType(pc, newElementType, dimensions));
            }
        }
Example #8
0
        public override IReturnType GetDirectReturnType()
        {
            if (baseType == null)
            {
                return(this);
            }
            IReturnType newBaseType = baseType.GetDirectReturnType();

            if (newBaseType == baseType)
            {
                return(this);
            }
            else
            {
                return(new ReferenceReturnType(newBaseType));
            }
        }
        public override string Convert(IReturnType returnType)
        {
            CheckThread();

            if (returnType == null)
            {
                return(String.Empty);
            }

            returnType = returnType.GetDirectReturnType();

            var builder = new StringBuilder();

            AppendReturnType(builder, returnType, false);

            return(builder.ToString());
        }
Example #10
0
        public override string Convert(IReturnType returnType)
        {
            //DC
            //CheckThread();
            //if (false == CheckThread())
            //    return "";      // this could have some weird side effects

            if (returnType == null)
            {
                return(String.Empty);
            }

            returnType = returnType.GetDirectReturnType();

            StringBuilder builder = new StringBuilder();

            AppendReturnType(builder, returnType, false);

            return(builder.ToString());
        }
Example #11
0
        public override string Convert(IReturnType returnType)
        {
            //	CheckThread();

            if (returnType == null)
            {
                return(String.Empty);
            }

            //returnType = returnType.GetDirectReturnType(); //DC:13/Feb/13 was returning ? a lot
            var directReturnType = returnType.GetDirectReturnType();

            if (directReturnType.ToString().Contains("ICSharpCode.SharpDevelop.Dom.UnknownReturnType") == false)
            {
                returnType = directReturnType;
            }

            StringBuilder builder = new StringBuilder();

            AppendReturnType(builder, returnType, false);

            return(builder.ToString());
        }
Example #12
0
		public override string Convert(IReturnType returnType)
		{
			CheckThread();
			
			if (returnType == null) {
				return String.Empty;
			}
			
			returnType = returnType.GetDirectReturnType();
			
			StringBuilder builder = new StringBuilder();
			
			AppendReturnType(builder, returnType, false);
			
			return builder.ToString();
		}
		public override string Convert(IReturnType returnType)
		{
            //DC 
            //CheckThread();                
            //if (false == CheckThread())
            //    return "";      // this could have some weird side effects
			
			if (returnType == null) {
				return String.Empty;
			}
			
			returnType = returnType.GetDirectReturnType();
			
			StringBuilder builder = new StringBuilder();
			
			AppendReturnType(builder, returnType, false);
			
			return builder.ToString();
		}
		public override string Convert(IReturnType returnType)
		{
		//	CheckThread();
			
			if (returnType == null) {
				return String.Empty;
			}
			
			//returnType = returnType.GetDirectReturnType(); //DC:13/Feb/13 was returning ? a lot
            var directReturnType = returnType.GetDirectReturnType();
            if(directReturnType.ToString().Contains("ICSharpCode.SharpDevelop.Dom.UnknownReturnType") == false)
                returnType = directReturnType;
			
			StringBuilder builder = new StringBuilder();
			
			AppendReturnType(builder, returnType, false);
			
			return builder.ToString();
		}