public ICliMetadataCustomAttribute GetCustomAttribute(ICliManager identityManager, ICliMetadataCustomAttributeTableRow target)
 {
     if (identityManager is _ICliManager)
     {
         return(_GetCustomAttribute((_ICliManager)identityManager, target));
     }
     throw new ArgumentException(string.Format("identityManager must implement {0}", typeof(_ICliManager).FullName));
 }
示例#2
0
        public static IType ParseTypeIdentifier(string typeIdentifier, ICliManager identityManager, IAssembly relativeAssembly = null)
        {
            var relativeAssemblyId           = relativeAssembly == null ? null : relativeAssembly.UniqueIdentifier;
            TypeIdentityParser currentParser = new TypeIdentityParser(typeIdentifier, relativeAssemblyId != null ? new TIAssemblyIdentityRule(relativeAssemblyId.Name, new TIVersionRule(relativeAssemblyId.Version.Major, relativeAssemblyId.Version.Minor, relativeAssemblyId.Version.Build, relativeAssemblyId.Version.Revision), relativeAssemblyId.Culture, relativeAssemblyId.PublicKeyToken) : null);
            var typeIdentity = currentParser.ParseQualifiedTypeName();

            return(typeIdentity.DecodeParsedType(identityManager, relativeAssembly));
        }
示例#3
0
 internal static CommonVBTypeRefs GetCommonTypeRefs(ICliManager manager)
 {
     if (!managerCache.ContainsKey(manager))
     {
         managerCache.Add(manager, new CommonVBTypeRefs(manager));
     }
     return(managerCache[manager]);
 }
示例#4
0
 /// <summary>
 /// Obtains a type expression from the <paramref name="target"/> provided.
 /// </summary>
 /// <param name="target">The <see cref="Type"/> to receive the type reference
 /// expression of.</param>
 /// <param name="identityManager">The <see cref="ICliManager"/>
 /// which is responsible for marshalling type and assembly identities
 /// within the current type model.</param>
 /// <returns>A new <see cref="ITypeReferenceExpression"/>.</returns>
 /// <remarks>Used to obtain a type as an expression for linking a type as the
 /// origin of a primary expression.</remarks>
 /// <exception cref="System.ArgumentNullException">thrown when <paramref name="target"/> is null.</exception>
 public static ITypeReferenceExpression GetTypeExpression(this Type target, ICliManager identityManager)
 {
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     return(identityManager.ObtainTypeReference(target).GetTypeExpression());
 }
示例#5
0
 /// <summary>
 /// Creates a new <see cref="ByRefType"/> with the <paramref name="elementType"/>
 /// provided.
 /// </summary>
 /// <param name="elementType">The <see cref="IType"/> which is to be made
 /// into a by-reference type.</param>
 /// <exception cref="System.ArgumentException">thrown when <paramref name="elementType"/>
 /// is already a reference type.</exception>
 internal ByRefType(IType elementType, ICliManager manager)
 {
     if (elementType.ElementClassification == TypeElementClassification.Reference)
     {
         throw ThrowHelper.ObtainArgumentException(ArgumentWithException.elementType, ExceptionMessageId.TypeInvalidElementType, ThrowHelper.GetArgumentExceptionWord(ExceptionWordId.by_reference_type), ThrowHelper.GetArgumentExceptionWord(ExceptionWordId.by_reference_type));
     }
     //throw new ArgumentException("elementType");
     this.elementType = elementType;
     this.manager     = manager;
 }
示例#6
0
 public static IFieldReferenceExpression GetFieldExpression(this Type target, ICliManager identityManager, string fieldName)
 {
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     if (string.IsNullOrEmpty(fieldName))
     {
         throw new ArgumentNullException("fieldName");
     }
     return(target.GetTypeExpression(identityManager).GetField(fieldName));
 }
示例#7
0
        public static TType GetTypeReference <TType>(this Type target, ICliManager identityManager)
            where TType :
        IType
        {
            var reference = target.GetTypeReference(identityManager);

            if (reference is TType)
            {
                return((TType)reference);
            }
            throw new InvalidOperationException(string.Format("{0} is not of the expected type {1}.", target.FullName, typeof(TType).Name));
        }
示例#8
0
        /// <summary>
        /// Obtains a method expression relative to a <paramref name="target"/>
        /// <see cref="Type"/> which points to the method group
        /// provided through <paramref name="methodName"/>.
        /// </summary>
        /// <param name="target">The <see cref="Type"/> which contains
        /// the method group under the alias <paramref name="methodName"/>.</param>
        /// <param name="methodName">The alias or identifier of the method group
        /// from the <paramref name="target"/> <see cref="Type"/>.</param>
        /// <param name="identityManager">The <see cref="ICliManager"/>
        /// which is responsible for marshalling type and assembly identities
        /// within the current type model.</param>
        /// <returns>A <see cref="IMethodReferenceStub"/>
        /// which denotes a stub reference to the method group
        /// by the alias <paramref name="methodName"/>.</returns>
        public static IMethodReferenceStub GetMethodExpression(this Type target, ICliManager identityManager, string methodName)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (string.IsNullOrEmpty(methodName))
            {
                throw new ArgumentNullException("methodName");
            }

            return(target.GetTypeExpression(identityManager).GetMethod(methodName));
        }
示例#9
0
 /// <summary>
 /// Obtains an <see cref="IMethodInvokeExpression"/> from the
 /// <paramref name="target"/> <see cref="Type"/> under the
 /// method group provided by <paramref name="methodName"/> with the
 /// <paramref name="parenters"/> that denote the information to pass.
 /// </summary>
 /// <param name="target">The <see cref="Type"/> which contains
 /// the method group under the alias <paramref name="methodName"/>.</param>
 /// <param name="identityManager">The <see cref="ICliManager"/>
 /// which is responsible for marshalling type and assembly identities
 /// within the current type model.</param>
 /// <param name="methodName">The alias or identifier of the method group
 /// from the <paramref name="target"/> <see cref="Type"/>.</param>
 /// <param name="parameters">The <see cref="IExpression"/> array of
 /// parameters which denote the information to pass to the method group
 /// under the <paramref name="methodName"/> alias.</param>
 /// <returns>A <see cref="IMethodInvokeExpression"/> which expresses
 /// the invocation.</returns>
 public static IMethodInvokeExpression GetMethodInvokeExpression(this Type target, ICliManager identityManager, string methodName, params IExpression[] parameters)
 {
     return(target.GetMethodExpression(identityManager, methodName).Invoke(parameters));
 }
示例#10
0
 public static IExpressionFusionExpression Fuse(this Type target, IFusionTermExpression term, ICliManager identityManager)
 {
     return(((IFusionTargetExpression)target.GetTypeExpression(identityManager)).Fuse(term));
 }
示例#11
0
 public static IExpressionToCommaTypeReferenceFusionExpression Fuse(this IFusionTypeCollectionTargetExpression target, ICliManager identityManager, params Type[] types)
 {
     return(new ExpressionToCommaTypeReferenceFusionExpression(target, types.ToCollection(identityManager)));
 }
示例#12
0
 public static IIndexerReferenceExpression GetIndexerExpression(this Type target, ICliManager identityManager, string indexerName, params IExpression[] parameters)
 {
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     if (indexerName == string.Empty)
     {
         throw new ArgumentOutOfRangeException("indexerName", "May be null, but not empty.");
     }
     return(target.GetTypeExpression(identityManager).GetIndexer(indexerName, parameters));
 }
示例#13
0
 public static IExpressionFusionExpression Fuse(this Type target, string term, ICliManager identityManager)
 {
     return(identityManager.ObtainTypeReference(target).Fuse(term));
 }
示例#14
0
 public static IControlledTypeCollection ToCollection(this Type[] entries, ICliManager identityManager)
 {
     return(new TypeCollection((from t in entries
                                select identityManager.ObtainTypeReference(t)).ToArray()));
 }
示例#15
0
 public static IIndexerReferenceExpression GetIndexerExpression(this Type target, ICliManager identityManager, params IExpression[] parameters)
 {
     return(target.GetIndexerExpression(identityManager, null, parameters));
 }
示例#16
0
 public static IPropertyReferenceExpression GetPropertyExpression(this Type target, ICliManager identityManager, string propertyName)
 {
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     if (string.IsNullOrEmpty(propertyName))
     {
         throw new ArgumentNullException("propertyName");
     }
     return(target.GetTypeExpression(identityManager).GetProperty(propertyName));
 }
示例#17
0
 public static IType GetTypeReference(this Type target, ICliManager identityManager)
 {
     return(identityManager.ObtainTypeReference(target));
 }
示例#18
0
 /// <summary>
 /// Obtains a <see cref="TypeReferenceExpression"/> for the <paramref name="target"/>
 /// provided.
 /// </summary>
 /// <param name="target">A <see cref="IExpressionFusionExpression"/> which represents
 /// a symbolic form of a type.</param>
 /// <param name="identityManager">The <see cref="ICliManager"/>
 /// which is responsible for marshalling type and assembly identities
 /// within the current type model.</param>
 /// <returns>A new <see cref="ITypeReferenceExpression"/> which wraps the <paramref name="target"/>
 /// in a <see cref="SymbolType"/>.</returns>
 /// <exception cref="System.ArgumentNullException">thrown when <paramref name="target"/> is null.</exception>
 public static ITypeReferenceExpression GetTypeExpression(this IExpressionFusionExpression target, ICliManager identityManager)
 {
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     return(new SymbolType(target, identityManager).GetTypeExpression());
 }
示例#19
0
 public ICliMetadataCustomAttribute GetValue(ICliManager manager)
 {
     return(this.MetadataRoot.BlobHeap.GetCustomAttribute(manager, this));
 }
示例#20
0
 private CommonVBTypeRefs(ICliManager manager)
 {
     this.manager = manager;
 }
示例#21
0
 public static IMethodInvokeExpression GetMethodInvokeExpression <T1, T2, T3, T4>(this Type target, ICliManager identityManager, string methodName, params IExpression[] parameters)
 {
     return(new UnboundMethodReferenceStub(target.GetTypeExpression(identityManager), methodName, new Type[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4) }.ToCollection(identityManager)).Invoke(parameters));
 }
示例#22
0
 public static ICreateInstanceExpression GetNewExpression(this Type target, ICliManager identityManager, params IExpression[] parameters)
 {
     return(identityManager.ObtainTypeReference(target).GetNewExpression(parameters));
 }