Exemplo n.º 1
0
        /// <summary>
        /// Checks whether a specified type implements some extension in this library and returns its name if so.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>A name of the extension which is partly or entirely implemented by the <paramref name="type"/>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="type"/> is a <B>null</B> reference.</exception>
        public string GetImplementedExtension(Type /*!*/ type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            // make sure this type belongs to this library
            if (!PhpLibraryModule.IsLibraryType(type))
            {
                return(null);
            }

            do
            {
                object[] attrs = type.GetCustomAttributes(typeof(ImplementsExtensionAttribute), false);

                if (attrs.Length == 1)
                {
                    return(((ImplementsExtensionAttribute)attrs[0]).Name);
                }

                type = type.DeclaringType;
            }while (type != null);//loop because of nested enum types ( e.g. in ClassLibrary )

            return(PhpLibraryAssembly.DefaultExtension);
        }
Exemplo n.º 2
0
		/// <summary>
		/// Used by both fast and full reflectors.
		/// </summary>
		internal PhpLibraryFunctionDesc(PhpLibraryModule/*!*/ declaringModule, RoutineDelegate/*!*/ arglessStub)
			: base(declaringModule.GlobalType.TypeDesc, PhpMemberAttributes.Public | PhpMemberAttributes.Static, arglessStub, true)
		{
			Debug.Assert(declaringModule != null && arglessStub != null);
		}
Exemplo n.º 3
0
 /// <summary>
 /// Used by both fast and full reflectors.
 /// </summary>
 internal PhpLibraryFunctionDesc(PhpLibraryModule /*!*/ declaringModule, RoutineDelegate /*!*/ arglessStub)
     : base(declaringModule.GlobalType.TypeDesc, PhpMemberAttributes.Public | PhpMemberAttributes.Static, arglessStub, true)
 {
     Debug.Assert(declaringModule != null && arglessStub != null);
 }