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


C# Reflection.PhpRoutine类代码示例

本文整理汇总了C#中PHP.Core.Reflection.PhpRoutine的典型用法代码示例。如果您正苦于以下问题:C# PhpRoutine类的具体用法?C# PhpRoutine怎么用?C# PhpRoutine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PhpRoutine类属于PHP.Core.Reflection命名空间,在下文中一共展示了PhpRoutine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GeneratePeekPseudoGenericArgument

        private static Expression/*!*/ GeneratePeekPseudoGenericArgument(PhpRoutine routine, DynamicMetaObject scriptContext, DynamicMetaObject arg, int index)
        {
            bool optional = index >= routine.Signature.MandatoryGenericParamCount;
            int indexTransformed = index + 1; // in PHP indexes of arguments starts from index 1

            if (optional)
                return PeekTypeOptional(routine, scriptContext, arg, indexTransformed);
            else
                return PeekType(routine, scriptContext, arg, indexTransformed);

        }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:11,代码来源:PhpRoutineExtensions.cs

示例2: InvokePhpMethod

        /// <summary>
        /// This method binds rules for PhpMethod
        /// </summary>
        private void InvokePhpMethod(DynamicMetaObject/*!*/ target, DynamicMetaObject[]/*!!*/ args, /*object targetObj,*/ PhpRoutine/*!*/ routine, out BindingRestrictions restrictions, out Expression invokeMethodExpr)
        {
            Debug.Assert(target != null && target.Value != null);
            Debug.Assert(!(target.Value is IClrValue), "PhpRoutine should not be declared on CLR value type!");

            /*if (target.Value is PhpObject)
            {
                // Restriction: typeof(target) == |target.TypeDesc.RealType|
                var targetPhpObj = (PhpObject)target.Value;
                Debug.Assert(targetPhpObj.TypeDesc.RealType == target.LimitType);
                Debug.Assert(target.Value.GetType() == target.LimitType);
                restrictions = BindingRestrictions.GetTypeRestriction(target.Expression, targetPhpObj.TypeDesc.RealType);
            }
            else*/
            Debug.Assert(typeof(ClrObject).IsSealed);   // just to ensure following condition is correct
            if (target.Value.GetType() == typeof(ClrObject))
            {
                target = new ClrDynamicMetaObject(target);  // unwrap the real object, get restrictions
                restrictions = target.Restrictions;
            }
            else
            {
                Debug.Assert(target.Value.GetType() == target.LimitType);   // just for sure
                Debug.Assert(!(target.Value is PhpObject) || ((PhpObject)target.Value).TypeDesc.RealType == target.LimitType);

                restrictions = BindingRestrictions.GetTypeRestriction(target.Expression, target.LimitType);
            }

            BindingRestrictions argumentsRestrictions;
            Expression[] arguments;

            if (routine.Name != Name.SpecialMethodNames.Call)
            {
                args = GetArgumentsRange(args, 0, RealMethodArgumentCount);// This can't be done when _call method is invoked

                //Check if method has ArgAware attribute
                if ((routine.Properties & RoutineProperties.IsArgsAware) != 0 ||
                    routine.IsStatic)// this is because of hack in PHP.Library.XML library static methods that can be also called like instance methods
                {
                    DynamicMetaObject scriptContext = args[0];

                    //Select arguments without scriptContext
                    DynamicMetaObject[] realArgs = GetArgumentsRange(args, 1, RealMethodArgumentCount - 1);

                    InvokeArgLess(target, scriptContext, routine.RoutineDesc, realArgs, out argumentsRestrictions, out invokeMethodExpr);
                    restrictions = restrictions.Merge(argumentsRestrictions);
                    return;
                }

                arguments = routine.PrepareArguments(args, _genericParamsCount, _paramsCount, out argumentsRestrictions);
                restrictions = restrictions.Merge(argumentsRestrictions);
            }
            else
            {
                arguments = BinderHelper.PackToExpressions(args);
            }

            //((PhpObject)target))
            var realObjEx = Expression.Convert(target.Expression, routine.ArgFullInfo.DeclaringType);//targetObj.TypeDesc.RealType);

            //ArgFull( ((PhpObject)target), ScriptContext, args, ... )
            invokeMethodExpr = Expression.Call(BinderHelper.WrapInstanceMethodCall(routine.ArgFullInfo),
                                     BinderHelper.CombineArguments(realObjEx, arguments));

            invokeMethodExpr = ReturnArgumentHelpers.ReturnValueConversion(routine.ArgFullInfo, invokeMethodExpr);

            invokeMethodExpr = HandleResult(invokeMethodExpr, routine.ArgFullInfo.ReturnType, false);

        }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:72,代码来源:PhpInvokeMemberBinder.cs

示例3: EmitArgfullLateStaticBindTypeInitialization

        /// <summary>
        /// Stores late static binding type information if necessary.
        /// </summary>
        private void EmitArgfullLateStaticBindTypeInitialization(PhpRoutine/*!*/routine)
        {
            if (routine == null || !routine.UsesLateStaticBinding)
                return;

            if (routine.IsMethod)
            {
                if (routine.IsStatic)
                {
                    // static method,
                    // reads <context>.Stack.LateStaticBindType,
                    // saves it into a local variable:

                    // <context>.Stack.LateStaticBindType
                    this.EmitLoadScriptContext();
                    this.il.Emit(OpCodes.Ldfld, Fields.ScriptContext_Stack);
                    this.il.Emit(OpCodes.Ldfld, Fields.PhpStack_LateStaticBindType);

                    // DTypeDesc <loc_lsb> =
                    this.LateStaticBindTypePlace = new IndexedPlace(il.DeclareLocal(Types.DTypeDesc[0]));
                    this.LateStaticBindTypePlace.EmitStore(il);
                }
                else
                {
                    // instance method,
                    // uses ((DObject)this).TypeDesc
                    
                    Debug.Assert(this.SelfPlace != null && this.SelfPlace != LiteralPlace.Null, "SelfPlace expected to be non-NULL");
                    this.LateStaticBindTypePlace = new MethodCallPlace(Properties.DObject_TypeDesc.GetGetMethod(), false, this.SelfPlace);
                }
            }
            else
            {
                this.LateStaticBindTypePlace = LiteralPlace.Null;
            }

            
        }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:41,代码来源:CodeGenerator.cs

示例4: EmitArgfullLocalsInitialization

		/// <summary>
		/// Declares all locals used in a function.
		/// </summary>
		private void EmitArgfullLocalsInitialization(PhpRoutine/*!*/ routine)
		{
			bool optimized = (routine.Properties & RoutineProperties.HasUnoptimizedLocals) == 0;
			bool rt_var_table = (routine.Properties & RoutineProperties.HasRTVariablesTable) != 0;

			// TODO: MarkSequencePoint(0xFeeFee, 0xFeeFee, 0xFeeFee, 0xFeeFee);

			// emits creation of a new table of variables if it will be used in a function:
			if (rt_var_table)
			{
				il.LdcI4(routine.Builder.LocalVariables.Count);
				il.Emit(OpCodes.Newobj, PhpVariable.RTVariablesTableCtor);
				RTVariablesTablePlace.EmitStore(il);
			}

			if (optimized)
			{
				// declares and initializes real locals (skips arguments):
				foreach (VariablesTable.Entry entry in routine.Builder.LocalVariables)
				{
					if (!entry.IsParameter)
					{
						LocalBuilder local;

						if (entry.IsPhpReference)
						{
							local = il.DeclareLocal(Types.PhpReference[0]);

							// local = new PhpReference();
							il.Emit(OpCodes.Newobj, Constructors.PhpReference_Void);
							il.Stloc(local);
						}
						else
						{
							local = il.DeclareLocal(Types.Object[0]);
						}

						// stores local to table:
						entry.Variable = new Place(local);

						// gives locals names (if they are not parameters):
						if (sourceUnit.SymbolDocumentWriter != null)
							local.SetLocalSymInfo(entry.VariableName.Value);
					}
				}
			}
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:50,代码来源:CodeGenerator.cs

示例5: EmitArgfullOverloadBody

		/// <summary>
		/// Emits a body of an arg-full function or method overload.
		/// </summary>
        public void EmitArgfullOverloadBody(PhpRoutine/*!*/ routine, IEnumerable<Statement>/*!*/ body, Text.Span entirePosition, int declarationBodyPosition)
		{
			Debug.Assert(!routine.IsAbstract);

            if (context.Config.Compiler.Debug)
            {
                if (!routine.IsLambda)
                {
                    MarkSequencePoint(declarationBodyPosition);
                }
                il.Emit(OpCodes.Nop);

                EmitArgsAwareCheck(routine);
            }

			// declares and initializes real locals (should be before args init):
			EmitArgfullLocalsInitialization(routine);

			// initializes locals (from arguments or by empty value):
			EmitArgfullArgsInitialization(routine);

            // remember late static bind type from <stack>
            EmitArgfullLateStaticBindTypeInitialization(routine);

			// define user labels:
			DefineLabels(routine.Builder.Labels);

			// emits function's body:
            body.Emit(this);

			// marks ending "}" as the last sequence point of the routine:
			// (do not mark it in lambda functions as they are created from source code without braces);
			if (!routine.IsLambda)
			{
				MarkSequencePoint(entirePosition.End);
			}
            else if (context.Config.Compiler.Debug)
            {
                il.Emit(OpCodes.Nop);
            }

			EmitRoutineEpilogue(null, false);
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:46,代码来源:CodeGenerator.cs

示例6: EmitLoadArgsOnEvalStack

            internal void EmitLoadArgsOnEvalStack(CallSignature/*!*/node, CodeGenerator/*!*/ codeGenerator, PhpRoutine/*!*/ routine)
            {
                ILEmitter il = codeGenerator.IL;

                int mandatory_count = (routine.Signature != null) ? routine.Signature.MandatoryParamCount : 0;
                int formal_count = (routine.Signature != null) ? routine.Signature.ParamCount : 0;
                int actual_count = node.Parameters.Count;
                PhpTypeCode param_type;

                // loads all actual parameters which are not superfluous:
                for (int i = 0; i < Math.Min(actual_count, formal_count); i++)
                {
                    var p = node.Parameters[i];
                    codeGenerator.EmitBoxing(param_type = p.NodeCompiler<ActualParamCompiler>().Emit(p, codeGenerator));

                    // Actual param emitter should emit "boxing" to a reference if its access type is ReadRef.
                    // That's why no operation is needed here and references should match.
                    Debug.Assert((routine.Signature == null || routine.Signature.IsAlias(i)) == (param_type == PhpTypeCode.PhpReference));
                }

                // loads missing mandatory arguments:
                for (int i = actual_count; i < mandatory_count; i++)
                {
                    // CALL PhpException.MissingArgument(<i+1>,<name>);
                    il.LdcI4(i + 1);
                    il.Emit(OpCodes.Ldstr, routine.FullName);
                    codeGenerator.EmitPhpException(Methods.PhpException.MissingArgument);

                    // LOAD null;
                    if (routine.Signature.IsAlias(i))
                        il.Emit(OpCodes.Newobj, Constructors.PhpReference_Void);
                    else
                        il.Emit(OpCodes.Ldnull);
                }

                // loads missing optional arguments:
                for (int i = Math.Max(mandatory_count, actual_count); i < formal_count; i++)
                {
                    // LOAD Arg.Default;
                    il.Emit(OpCodes.Ldsfld, Fields.Arg_Default);
                }
            }
开发者ID:kaviarasankk,项目名称:Phalanger,代码行数:42,代码来源:CallSignature.cs

示例7: EmitLoadOnEvalStack

 /// <summary>
 /// Emits IL instructions that load actual parameters on the evaluation stack.
 /// </summary>
 /// <param name="node">Instance.</param>
 /// <param name="codeGenerator">Code generator.</param>
 /// <param name="routine">PHP method being called.</param>
 /// <remarks>
 /// <para>
 /// The function has mandatory and optional formal arguments.
 /// Mandatory arguments are those formal arguments which are not preceded by 
 /// any formal argument with default value. The others are optional.
 /// If a formal argument without default value is declared beyond the last mandatory argument
 /// it is treated as optional one by the caller. The callee checks this and throws warning.
 /// </para>
 /// Missing arguments handling:
 /// <list type="bullet">
 ///   <item>missing mandatory argument - WARNING; LOAD(null);</item>
 ///   <item>missing optional argument - LOAD(Arg.Default);</item>
 ///   <item>superfluous arguments are ignored</item>
 /// </list>
 /// </remarks>
 public void EmitLoadOnEvalStack(CallSignature/*!*/node, CodeGenerator/*!*/ codeGenerator, PhpRoutine/*!*/ routine)
 {
     EmitLoadTypeArgsOnEvalStack(node, codeGenerator, routine);
     EmitLoadArgsOnEvalStack(node, codeGenerator, routine);
 }
开发者ID:kaviarasankk,项目名称:Phalanger,代码行数:26,代码来源:CallSignature.cs

示例8: DefineMethodExportStubs

		/// <summary>
		/// Enumerates all export overloads for the given target PHP method.
		/// </summary>
		public static IEnumerable<StubInfo> DefineMethodExportStubs(
			PhpRoutine/*!*/ target, PhpType/*!*/ declaringType,
			MethodAttributes attributes,
			bool defineConstructors,
			StubSignatureFilter/*!*/ signatureFilter)
		{
            Debug.Assert(target.Builder != null);

            Type return_type = Types.Object[0];

            PhpRoutineSignature signature = target.Signature;
			AST.FormalParam[] formal_params = target.Builder.Signature.FormalParams;
			AST.FormalTypeParam[] formal_type_params = target.Builder.TypeSignature.TypeParams;

			int gen_sig_count = signature.GenericParamCount - signature.MandatoryGenericParamCount + 1;
			int arg_sig_count = signature.ParamCount - signature.MandatoryParamCount + 1;

			// TODO: return type hints
			// HACK: change return type to void for methods that are apparently event handlers
			if (signature.GenericParamCount == 0 && arg_sig_count == 1 && signature.ParamCount == 2 &&
				(signature.TypeHints[0] == null || signature.TypeHints[0].RealType == Types.Object[0]) &&
				(signature.TypeHints[1] != null && typeof(EventArgs).IsAssignableFrom(signature.TypeHints[1].RealType)))
			{
				return_type = Types.Void;
			}

			for (int gen_sig = 0; gen_sig < gen_sig_count; gen_sig++)
			{
				for (int arg_sig = 0; arg_sig < arg_sig_count; arg_sig++)
				{
					// determine parameter types (except for method mandatory generic parameters)
					object[] parameter_types = GetStubParameterTypes(
						arg_sig + signature.MandatoryParamCount,
						gen_sig + signature.MandatoryGenericParamCount,
						signature,
						formal_type_params);

					// determine generic parameter names
					string[] generic_param_names = new string[target.Signature.MandatoryGenericParamCount + gen_sig];
					for (int i = 0; i < generic_param_names.Length; i++)
					{
						generic_param_names[i] = formal_type_params[i].Name.ToString();
					}

					// are we allowed to generate this signature?
					if (!signatureFilter(generic_param_names, parameter_types, return_type)) continue;

					GenericTypeParameterBuilder[] generic_params = StubInfo.EmptyGenericParameters;
					MethodBase method_base = null;
					MethodBuilder method = null;

					if (!defineConstructors)
					{
                        method = declaringType.RealTypeBuilder.DefineMethod(target.FullName, attributes);

						// determine generic parameters
						if (generic_param_names.Length > 0) generic_params = method.DefineGenericParameters(generic_param_names);

						method_base = method;
					}

					ParameterInfo[] parameters = new ParameterInfo[parameter_types.Length];

					// fill in parameter infos
					Type[] real_parameter_types = new Type[parameters.Length];
					for (int i = 0; i < parameters.Length; i++)
					{
						Type type = parameter_types[i] as Type;

						// generic method parameter fixup
						if (type == null)
						{
							int index = (int)parameter_types[i];
							if (index < 0) type = generic_params[-(index + 1)].MakeByRefType();
							else type = generic_params[index];
						}

						string param_name;
						ParameterAttributes param_attrs;
						if (i < formal_params.Length)
						{
							param_name = formal_params[i].Name.ToString();
							param_attrs = (formal_params[i].IsOut ? ParameterAttributes.Out : ParameterAttributes.None);
						}
						else
						{
							param_name = "args" + (i + 1);
							param_attrs = ParameterAttributes.None;
						}

						parameters[i] = new StubParameterInfo(i, type, param_attrs, param_name);
						real_parameter_types[i] = type;
					}

					if (method != null)
					{
						method.SetParameters(real_parameter_types);
//.........这里部分代码省略.........
开发者ID:dw4dev,项目名称:Phalanger,代码行数:101,代码来源:ClrStubBuilder.cs

示例9: ResolveMethod

        /// <summary>
        /// Resolves a method of given <see cref="DType"/> by its name.
        /// </summary>
        /// <param name="type">The type of routine being resolved.</param>
        /// <param name="methodName">The name of routine to be resolved.</param>
        /// <param name="position">Position of method call used for error reporting.</param>
        /// <param name="referringType">The type where the seached routine is being called. Can be <c>null</c>.</param>
        /// <param name="referringRoutine">The routine where the searched routine is being called. Can be <c>null</c>.</param>
        /// <param name="calledStatically">True if the searched routine is called statically - if it uses static method call syntax.
        /// This affects the __call or __callStatic method lookup.
        /// It affects also the error reporting, where for instance method calls, the bad visibility error is
        /// ignored and falls back to return <see cref="UnknownMethod"/>.</param>
        /// <param name="checkVisibilityAtRuntime">Will determine if the routine call must be checked for visibility at runtime.</param>
        /// <param name="isCallMethod">Will determine if __call or __callStatic magic methods were found instead.</param>
        /// <returns>The resolved routine. Cannot return <c>null</c>.</returns>
		public DRoutine/*!*/ ResolveMethod(DType/*!*/ type, Name methodName, Position position,
			PhpType referringType, PhpRoutine referringRoutine, bool calledStatically,
            out bool checkVisibilityAtRuntime, out bool isCallMethod)
		{
			checkVisibilityAtRuntime = false;
            isCallMethod = false;

			// we cannot resolve a method unless we know the inherited members:
			if (type.IsDefinite)
			{
				KnownType known;

				// the method is a constructor:
				if (methodName.IsConstructName || (known = type as KnownType) != null && methodName.Equals(known.QualifiedName.Name))
					return ResolveConstructor(type, position, referringType, referringRoutine, out checkVisibilityAtRuntime);

				DRoutine routine;
				GetMemberResult member_result;

				member_result = type.GetMethod(methodName, referringType, out routine);

                // Look for __call or __callStatic magic methods if no method was found:
                // Note: __call when looking for instance method is disabled, since there can be the searched method in some future override.
                if (member_result == GetMemberResult.NotFound && calledStatically)
                {
                    // in PHP, it is possible to call instance methods statically if we are in instance method context.
                    // In such case we have to look for __call instead of __callStatic:
                    
                    // determine the proper call method:
                    // use __call for instance method invocation, including static method invocation within the current type (e.g. A::foo(), parent::foo(), ...)
                    // use __callStatic for static method invocation
                    Name callMethodName =
                        (!calledStatically ||   // just to have complete condition here, always false
                        (referringRoutine != null && referringType != null && !referringRoutine.IsStatic &&  // in non-static method
                        type.TypeDesc.IsAssignableFrom(referringType.TypeDesc)) // {CurrentType} is inherited from or equal {type}
                        ) ? DObject.SpecialMethodNames.Call : DObject.SpecialMethodNames.CallStatic;

                    member_result = type.GetMethod(callMethodName, referringType, out routine);

                    if (member_result != GetMemberResult.NotFound)
                        isCallMethod = true;
                }

				switch (member_result)
				{
					case GetMemberResult.OK:
						return routine;

					case GetMemberResult.NotFound:
                        if (calledStatically) // throw an error only in we are looking for static method, instance method can be defined in some future inherited class
                            ErrorSink.Add(Errors.UnknownMethodCalled, SourceUnit, position, type.FullName, methodName);
						return new UnknownMethod(type, methodName.Value);

					case GetMemberResult.BadVisibility:
						{
                            if (!calledStatically)    // instance method will check the routine dynamically, there can be some override later
                                return new UnknownMethod(type, methodName.Value);

							if (referringType == null && referringRoutine == null)
							{
								// visibility must be checked at run-time:
								checkVisibilityAtRuntime = true;
								return routine;
							}
							else
							{
								// definitive error:
								if (routine.IsPrivate)
								{
									ErrorSink.Add(Errors.PrivateMethodCalled, SourceUnit, position, type.FullName, methodName.Value,
										referringType.FullName);
								}
								else
								{
									ErrorSink.Add(Errors.ProtectedMethodCalled, SourceUnit, position, type.FullName, methodName.Value,
					  referringType.FullName);
								}

								return new UnknownMethod(type, methodName.Value);
							}
						}

					default:
						Debug.Fail();
						return null;
//.........这里部分代码省略.........
开发者ID:Ashod,项目名称:Phalanger,代码行数:101,代码来源:Analyzer.cs

示例10: ResolveTypeName

		public DType/*!*/ ResolveTypeName(GenericQualifiedName genericName, PhpType referringType,
			PhpRoutine referringRoutine, Position position, bool mustResolve)
		{
			DType type = ResolveTypeName(genericName.QualifiedName, referringType, referringRoutine, position, mustResolve);

			DTypeDesc[] arguments = (genericName.GenericParams.Length > 0) ? new DTypeDesc[genericName.GenericParams.Length] : DTypeDesc.EmptyArray;

			for (int i = 0; i < arguments.Length; i++)
			{
				arguments[i] = ResolveType(genericName.GenericParams[i], referringType, referringRoutine, position, mustResolve).TypeDesc;
			}

			return type.MakeConstructedType(this, arguments, position);
		}
开发者ID:Ashod,项目名称:Phalanger,代码行数:14,代码来源:Analyzer.cs

示例11: ResolveTypeParameterName

		private GenericParameter ResolveTypeParameterName(Name name, PhpType referringType, PhpRoutine referringRoutine)
		{
			GenericParameter result = null;

			if (referringRoutine != null)
			{
				result = referringRoutine.Signature.GetGenericParameter(name);
				if (result != null)
					return result;
			}

			if (referringType != null)
			{
				result = referringType.GetGenericParameter(name);
				if (result != null)
					return result;
			}

			return result;
		}
开发者ID:Ashod,项目名称:Phalanger,代码行数:20,代码来源:Analyzer.cs

示例12: ResolveType

		public DType ResolveType(object typeNameOrPrimitiveType, PhpType referringType, PhpRoutine referringRoutine,
				Position position, bool mustResolve)
		{
			Debug.Assert(typeNameOrPrimitiveType == null || typeNameOrPrimitiveType is PrimitiveType
			  || typeNameOrPrimitiveType is GenericQualifiedName);

			DType result = typeNameOrPrimitiveType as PrimitiveType;
			if (result != null)
				return result;

			if (typeNameOrPrimitiveType != null)
			{
				return ResolveTypeName((GenericQualifiedName)typeNameOrPrimitiveType, referringType,
							referringRoutine, position, mustResolve);
			}

			return null;
		}
开发者ID:Ashod,项目名称:Phalanger,代码行数:18,代码来源:Analyzer.cs

示例13: GetReferringScope

		private Scope GetReferringScope(PhpType referringType, PhpRoutine referringRoutine)
		{
			if (referringType != null) return referringType.Declaration.Scope;
            if (referringRoutine is PhpFunction) return ((PhpFunction)referringRoutine).Declaration.Scope;
            //if (referringRoutine is PhpLambdaFunction) ...

			// used for global statements during full analysis:
			Debug.Assert(currentScope.IsValid, "Scope is available only during full analysis.");
			return currentScope;
		}
开发者ID:Ashod,项目名称:Phalanger,代码行数:10,代码来源:Analyzer.cs

示例14: ResolveType

        /// <summary>
        /// Resolves type based on provided <paramref name="typeName"/>.
        /// </summary>
        /// <param name="typeName">Either <see cref="GenericQualifiedName"/> or <see cref="PrimitiveTypeName"/> or <c>null</c> reference.</param>
        /// <param name="referringType"></param>
        /// <param name="referringRoutine"></param>
        /// <param name="position"></param>
        /// <param name="mustResolve"></param>
        /// <returns></returns>
        internal DType ResolveType(object typeName, PhpType referringType, PhpRoutine referringRoutine,
				Position position, bool mustResolve)
		{
			DType result = null;

            if (typeName != null)
            {
                if (typeName.GetType() == typeof(GenericQualifiedName))
                {
                    result = ResolveTypeName((GenericQualifiedName)typeName,
                        referringType, referringRoutine, position, mustResolve);
                }
                else if (typeName.GetType() == typeof(PrimitiveTypeName))
                {
                    result = PrimitiveType.GetByName((PrimitiveTypeName)typeName);
                }
                else
                {
                    throw new ArgumentException("typeName");
                }
            }

            return result;
		}
开发者ID:kripper,项目名称:Phalanger,代码行数:33,代码来源:Analyzer.cs

示例15: PhpRoutineBuilder

		internal PhpRoutineBuilder(PhpRoutine/*!*/ routine, Signature signature, TypeSignature typeSignature)
		{
			this.routine = routine;
			this.signature = signature;
			this.typeSignature = typeSignature;
			this.localVariables = new VariablesTable(10);
			this.labels = new Dictionary<VariableName, Statement>(1);
		}
开发者ID:tiaohai,项目名称:Phalanger,代码行数:8,代码来源:Methods.cs


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