当前位置: 首页>>代码示例>>C#>>正文


C# DTypeDesc.MakeFullName方法代码示例

本文整理汇总了C#中DTypeDesc.MakeFullName方法的典型用法代码示例。如果您正苦于以下问题:C# DTypeDesc.MakeFullName方法的具体用法?C# DTypeDesc.MakeFullName怎么用?C# DTypeDesc.MakeFullName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DTypeDesc的用法示例。


在下文中一共展示了DTypeDesc.MakeFullName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ThrowVisibilityError

        /// <summary>
        /// Generates Expression that throws a 'Protected method called' or 'Private method called' <see cref="PhpException"/>.
        /// </summary>
        /// <param name="method">The <see cref="DRoutineDesc"/>.</param>
        /// <param name="callerContext">The caller that was passed to method lookup or <B>null</B>
        /// if it should be determined by this method (by tracing the stack).</param>
        /// <remarks>
        /// This method is intended to be called after <see cref="DTypeDesc.GetMethod"/> has returned
        /// <see cref="GetMemberResult.BadVisibility"/> while performing a method lookup.
        /// </remarks>
        public static Expression/*!*/ ThrowVisibilityError(DRoutineDesc/*!*/ method, DTypeDesc/*!*/ callerContext)
        {
            if (method.IsProtected)
            {
                return ThrowError("protected_method_called",
                                  method.DeclaringType.MakeFullName(),
                                  method.MakeFullName(),
                                  callerContext == null ? String.Empty : callerContext.MakeFullName());
            }
            else if (method.IsPrivate)
            {
                return ThrowError("private_method_called",
                                  method.DeclaringType.MakeFullName(),
                                  method.MakeFullName(),
                                  callerContext == null ? String.Empty : callerContext.MakeFullName());
            }

            throw new NotImplementedException();
        }
开发者ID:kripper,项目名称:Phalanger,代码行数:29,代码来源:BinderHelper.cs

示例2: GetFullyQualifiedName

        public static string GetFullyQualifiedName(DTypeDesc type)
        {
            if (type == null)
                return string.Empty;

            return type.MakeFullName();
        }
开发者ID:kaviarasankk,项目名称:Phalanger,代码行数:7,代码来源:Operators.cs

示例3: ReportErrorMakingInstantiation

        private static void ReportErrorMakingInstantiation(DTypeDesc.MakeGenericArgumentsResult/*!*/ error,
            DTypeDesc/*!*/ genericType, DTypeDesc argument, GenericParameterDesc/*!*/ parameter)
        {
            switch (error)
            {
                case DTypeDesc.MakeGenericArgumentsResult.IncompatibleConstraint:
                    PhpException.Throw(PhpError.Error, CoreResources.GetString("incompatible_type_parameter_constraints_type",
                        argument.MakeFullName(), parameter.RealType.GenericParameterPosition, parameter.RealType.Name));
                    break;

                case DTypeDesc.MakeGenericArgumentsResult.MissingArgument:
                    PhpException.Throw(PhpError.Error, CoreResources.GetString("missing_type_argument_in_type_use",
                        genericType.MakeFullName(), parameter.RealType.GenericParameterPosition, parameter.RealType.Name));
                    break;

                case DTypeDesc.MakeGenericArgumentsResult.TooManyArguments:
                    PhpException.Throw(PhpError.Warning, CoreResources.GetString("too_many_type_arguments_in_type_use",
                        genericType.MakeFullName(), genericType.GenericParameters.Length));
                    break;
            }
        }
开发者ID:kaviarasankk,项目名称:Phalanger,代码行数:21,代码来源:Operators.cs

示例4: New

        public static object New(DTypeDesc type, DTypeDesc caller, ScriptContext context, NamingContext nameContext)
        {
            // error has been thrown by Convert.ObjectToTypeDesc or MakeGenericTypeInstantiation
            if (type == null)
            {
                context.Stack.RemoveFrame();
                return null;
            }

            // interfaces and abstract classes cannot be instantiated
            if (type.IsAbstract)
            {
                context.Stack.RemoveFrame();
                PhpException.CannotInstantiateType(type.MakeFullName(), type.IsInterface);
                return null;
            }

            return type.New(context.Stack, caller, nameContext);
        }
开发者ID:kaviarasankk,项目名称:Phalanger,代码行数:19,代码来源:Operators.cs

示例5: GetStaticMethodDesc

        /// <summary>
        /// Attemps to find a method desc according to a given class name and method name. Used when
        /// a non-virtual dispatch is about to be performed and when a <c>array(class, method)</c>
        /// callback is being bound.
        /// </summary>
        /// <param name="requestedType">The type whose method should be returned.</param>
        /// <param name="methodName">The method name.</param>
        /// <param name="self">Current <c>$this</c>. Will be set to an instance, on which the resulting
        /// CLR method should be invoked (<B>null</B> if the CLR method is static).</param>
        /// <param name="caller"><see cref="Type"/> of the object that request the lookup.</param>
        /// <param name="context">Current <see cref="ScriptContext"/>.</param>
        /// <param name="quiet">If <B>true</B>, no exceptions will be thrown if an error occurs.</param>
        /// <param name="removeFrame">If <B>true</B>, <see cref="PhpStack.RemoveFrame"/> will be called
        /// before throwing an exception.</param>
        /// <param name="isCallerMethod">Will be set to true, if required method was not found but __callStatic was.</param>
        /// <returns>The <see cref="DRoutineDesc"/> or <B>null</B> on error.</returns>
        internal static DRoutineDesc GetStaticMethodDesc(DTypeDesc requestedType, string methodName, ref DObject self,
            DTypeDesc caller, ScriptContext context, bool quiet, bool removeFrame, out bool isCallerMethod)
        {
            Debug.Assert(requestedType != null);

            isCallerMethod = false;

            DRoutineDesc method;
            GetMemberResult result = requestedType.GetMethod(new Name(methodName), caller, out method);

            if (result == GetMemberResult.NotFound)
            {
                // if not found, perform __callStatic or __call 'magic' method lookup
                Name callMethod = (self != null && requestedType.IsAssignableFrom(self.TypeDesc)) ?
                    Name.SpecialMethodNames.Call : Name.SpecialMethodNames.CallStatic;

                if ((result = requestedType.GetMethod(callMethod, caller, out method)) != GetMemberResult.NotFound)
                {
                    isCallerMethod = true;
                }
                else
                {
                    // there is no such method in the class
                    if (removeFrame) context.Stack.RemoveFrame();
                    if (!quiet) PhpException.UndefinedMethodCalled(requestedType.MakeFullName(), methodName);

                    return null;
                }
            }

            if (result == GetMemberResult.BadVisibility)
            {
                if (removeFrame) context.Stack.RemoveFrame();
                if (!quiet)
                {
                    PhpException.MethodNotAccessible(
                        method.DeclaringType.MakeFullName(),
                        method.MakeFullName(),
                        (caller == null ? String.Empty : caller.MakeFullName()),
                        method.IsProtected);
                }
                return null;
            }

            // check whether the method is abstract
            if (method.IsAbstract)
            {
                if (removeFrame) context.Stack.RemoveFrame();
                if (!quiet) PhpException.AbstractMethodCalled(method.DeclaringType.MakeFullName(), method.MakeFullName());

                return null;
            }

            if (method.IsStatic)
            {
                self = null;
            }
            else
            {
                // check whether self is of acceptable type
                if (self != null && !method.DeclaringType.RealType.IsInstanceOfType(self.RealObject)) self = null;


                /*
                // PHP allows for static invocations of instance method
				if (self == null &&
					(requestedType.IsAbstract || !(requestedType is PhpTypeDesc)) &&
					(method.DeclaringType.IsAbstract || !(method.DeclaringType is PhpTypeDesc)))
				{
					// calling instance methods declared in abstract classes statically through abstract classes
					// is unsupported -  passing null as 'this' to such instance method could result in
					// NullReferenceException even if the method does not touch $this
					if (removeFrame) context.Stack.RemoveFrame();
					if (!quiet)
					{
						PhpException.Throw(PhpError.Error, CoreResources.GetString("nonstatic_method_called_statically",
							method.DeclaringType.MakeFullName(), method.MakeFullName()));
					}
					return null;
				}

				if (self == null)
				{
                    if (!quiet && !context.Config.Variables.ZendEngineV1Compatible)
//.........这里部分代码省略.........
开发者ID:kaviarasankk,项目名称:Phalanger,代码行数:101,代码来源:Operators.cs

示例6: UnsetStaticProperty

        public static void UnsetStaticProperty(DTypeDesc type, object propertyName, DTypeDesc caller, ScriptContext context)
        {
            // convert propertyName to string
            string name = (propertyName == null ? String.Empty : Convert.ObjectToString(propertyName));

            // throw the error
            PhpException.StaticPropertyUnset(type.MakeFullName(), name);
        }
开发者ID:kaviarasankk,项目名称:Phalanger,代码行数:8,代码来源:Operators.cs

示例7: GetStaticPropertyDesc

        /// <summary>
        /// Gets the <see cref="DPropertyDesc"/> of a static property of a class.
        /// </summary>
        /// <param name="type">The class to get the property of.</param>
        /// <param name="propertyName">The property name.</param>
        /// <param name="caller"><see cref="DTypeDesc"/> of the object that request the retrieval.</param>
        /// <param name="context">Current <see cref="ScriptContext"/>.</param>
        /// <param name="quiet">If <B>true</B>, the &quot;property not found&quot; exception should not be thrown.</param>
        /// <returns>The <see cref="DPropertyDesc"/> representing the static property or <B>null</B> if an error occurs.</returns>
        /// <exception cref="PhpException">The property denoted by <paramref name="propertyName"/> was not found. (Error)</exception>
        /// <exception cref="PhpException">The property is inaccessible due to its protected or private visibility level (Error).
        /// </exception>
        internal static DPropertyDesc GetStaticPropertyDesc(DTypeDesc type, object propertyName, DTypeDesc caller,
            ScriptContext context, bool quiet)
        {
            if (type == null) return null;

            // convert propertyName to string
            string name = (propertyName == null ? String.Empty : Convert.ObjectToString(propertyName));

            // find the property
            DPropertyDesc property;
            switch (type.GetProperty(new VariableName(name), caller, out property))
            {
                case GetMemberResult.NotFound:
                    {
                        if (!quiet) PhpException.UndeclaredStaticProperty(type.MakeFullName(), name);
                        return null;
                    }

                case GetMemberResult.BadVisibility:
                    {
                        if (!quiet)
                        {
                            PhpException.PropertyNotAccessible(
                                property.DeclaringType.MakeFullName(),
                                name,
                                (caller == null ? String.Empty : caller.MakeFullName()),
                                property.IsProtected);
                        }
                        return null;
                    }

                case GetMemberResult.OK:
                    {
                        if (!property.IsStatic) goto case GetMemberResult.NotFound;
                        break;
                    }
            }

            // make sure that the property has been initialized for this request
            property.EnsureInitialized(context);

            return property;
        }
开发者ID:kaviarasankk,项目名称:Phalanger,代码行数:55,代码来源:Operators.cs

示例8: GetClassConstant

        public static object GetClassConstant(DTypeDesc type, string constantName, DTypeDesc caller, ScriptContext context)
        {
            if (type == null) return null;

            // lookup the constant desc
            DConstantDesc constant;
            switch (type.GetConstant(new VariableName(constantName), caller, out constant))
            {
                case GetMemberResult.NotFound:
                    {
                        PhpException.Throw(PhpError.Error, CoreResources.GetString("undefined_class_constant",
                            type.MakeFullName(), constantName));
                        return null;
                    }

                case GetMemberResult.BadVisibility:
                    {
                        PhpException.ConstantNotAccessible(
                            constant.DeclaringType.MakeFullName(),
                            constantName,
                            (caller == null ? String.Empty : caller.MakeFullName()),
                            constant.IsProtected);
                        return null;
                    }
            }

            // make sure that the constant has been initialized for this request
            return PhpVariable.Dereference(constant.GetValue(context));
        }
开发者ID:kaviarasankk,项目名称:Phalanger,代码行数:29,代码来源:Operators.cs

示例9: GetCalledClass

		public static string GetCalledClass(DTypeDesc caller)
		{
            if (caller == null || caller.IsUnknown)
                return null;

            return caller.MakeFullName();
		}
开发者ID:kripper,项目名称:Phalanger,代码行数:7,代码来源:Objects.cs

示例10: AddDependentType

 private static void AddDependentType(PhpTypeDesc/*!*/selfType, List<KeyValuePair<string, DTypeDesc>>/*!*/dependentTypes, DTypeDesc dependentType)
 {
     if (dependentType != null && dependentType is PhpTypeDesc && dependentType.RealType.Module != selfType.RealType.Module)// base type if from different module (external dependency)
         dependentTypes.Add(new KeyValuePair<string, DTypeDesc>(dependentType.MakeFullName(), dependentType));
 }
开发者ID:MpApQ,项目名称:Phalanger,代码行数:5,代码来源:CompilationUnits.cs

示例11: AddDependentType

 private static void AddDependentType(PhpTypeDesc/*!*/selfType, List<KeyValuePair<string, DTypeDesc>>/*!*/dependentTypes, DTypeDesc dependentType)
 {
     if (dependentType != null && dependentType is PhpTypeDesc && !IsSameCompilationUnit(selfType, dependentType))
         dependentTypes.Add(new KeyValuePair<string, DTypeDesc>(dependentType.MakeFullName(), dependentType));
 }
开发者ID:proff,项目名称:Phalanger,代码行数:5,代码来源:CompilationUnits.cs


注:本文中的DTypeDesc.MakeFullName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。