Pchp.CodeAnalysis.FlowAnalysis.TypeRefContext.AddToContext C# (CSharp) Method

AddToContext() public method

Adds properly types from another context matching given mask.
public AddToContext ( TypeRefContext context, TypeRefMask mask ) : TypeRefMask
context TypeRefContext Context of .
mask TypeRefMask Type mask representing types in .
return TypeRefMask
        public TypeRefMask AddToContext(TypeRefContext/*!*/context, TypeRefMask mask)
        {
            Contract.ThrowIfNull(context);

            if (mask.IsAnyType || mask.IsVoid || object.ReferenceEquals(this, context))
                return mask;

            var result = default(TypeRefMask);

            var types = context.Types;
            var count = Math.Min(types.Count, TypeRefMask.IndicesCount);
            for (int i = 0; i < count; i++)
            {
                if (mask.HasType(i))
                {
                    var index = AddToContext(types[i].Transfer(context, this));
                    result.AddType(index);
                }
            }

            //
            result.IsRef = mask.IsRef;
            result.IncludesSubclasses = mask.IncludesSubclasses;

            //
            return result;
        }

Same methods

TypeRefContext::AddToContext ( ITypeRef typeRef ) : int
TypeRefContext::AddToContext ( TypeRefContext other ) : void

Usage Example

コード例 #1
0
        /// <summary>
        /// Gets type mask at target type context representing given type names from given routine.
        /// </summary>
        public static TypeRefMask GetTypeMask(TypeRefContext /*!*/ targetCtx, TypeRefContext /*!*/ ctx, string[] tnames, bool fullyQualified = false)
        {
            Contract.ThrowIfNull(targetCtx);
            Contract.ThrowIfNull(ctx);

            var mask = GetTypeMask(ctx, tnames, fullyQualified);

            return(targetCtx.AddToContext(ctx, mask));
        }
All Usage Examples Of Pchp.CodeAnalysis.FlowAnalysis.TypeRefContext::AddToContext