本文整理汇总了C#中DTypeDesc类的典型用法代码示例。如果您正苦于以下问题:C# DTypeDesc类的具体用法?C# DTypeDesc怎么用?C# DTypeDesc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DTypeDesc类属于命名空间,在下文中一共展示了DTypeDesc类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DPropertyDesc
/// <summary>
/// Used by compiler and full-reflect.
/// </summary>
internal DPropertyDesc(DTypeDesc/*!*/ declaringType, PhpMemberAttributes memberAttributes)
: base(declaringType, memberAttributes)
{
Debug.Assert(declaringType != null);
this._getterStub = null; // to be generated on demand
this._setterStub = null; // to be generated on demand
}
开发者ID:tiaohai,项目名称:Phalanger,代码行数:10,代码来源:Properties.cs
示例2: ClassContextHolder
/// <summary>
/// Initialize the ClassCOntextHolder with a known DTypeDesc.
/// Use UnknownTypeDesc.Singleton to specify an unknown caller. In this case the caller will be determined when needed.
/// </summary>
/// <param name="caller"></param>
public ClassContextHolder(DTypeDesc caller)
{
if (caller == null || !caller.IsUnknown)
{
ClassContext = caller;
}
}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:12,代码来源:Serializers.CLR.cs
示例3: PhpGetMemberBinder
public PhpGetMemberBinder(string fieldName, DTypeDesc classContext, bool issetSemantics, Type/*!*/returnType)
{
this._fieldName = fieldName;
this._classContext = classContext;
this._issetSemantics = issetSemantics;
this._returnType = returnType;
}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:7,代码来源:PhpGetMemberBinder.cs
示例4: GetTypeOf
public static DObject GetTypeOf(NamingContext/*!*/ namingContext, DTypeDesc caller, object typeNameOrObject)
{
ScriptContext context = ScriptContext.CurrentContext;
DTypeDesc type = PhpObjects.ClassNameOrObjectToType(context, namingContext, caller, typeNameOrObject, true);
if (type == null) return null;
return ClrObject.Create(type.RealType);
}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:8,代码来源:CLR.cs
示例5: Call
public static void Call(NamingContext namingContext, DTypeDesc caller, string className)
{
ScriptContext context = ScriptContext.CurrentContext;
// If class isn't defined autoload functions are called automatically until class is declared
if (context.IsSplAutoloadEnabled)
ScriptContext.CurrentContext.ResolveType(className, namingContext, caller, null, ResolveTypeFlags.UseAutoload);
}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:8,代码来源:Autoload.cs
示例6: TypesProvider
/// <param name="context">A script context to get declarators from.</param>
/// <param name="caller">A current type context.</param>
public TypesProvider(ScriptContext/*!*/ context, DTypeDesc/*!*/ caller)
{
Debug.Assert(context != null && caller != null);
this.context = context;
this.caller = caller;
Debug.WriteLine("PROVIDER", "created");
}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:10,代码来源:DynamicCode.cs
示例7: DRoutineDesc
/// <summary>
/// Used by compiler through subclasses (<paramref name="arglessStub"/> is <B>null</B> then).
/// Called by a declaring helper at run-time.
/// </summary>
/// <param name="declaringType">The declaring type. Can be null.</param>
/// <param name="memberAttributes">Attributes of the function.</param>
/// <param name="arglessStub">The stub to be called. Cannot be null.</param>
/// <param name="needsIndex">True to allocate <see cref="Index"/>. Usable for preserved descs, for global functions that can be reused.</param>
internal DRoutineDesc(DTypeDesc/*!*/ declaringType, PhpMemberAttributes memberAttributes, RoutineDelegate arglessStub, bool needsIndex)
: base(declaringType, memberAttributes)
{
Debug.Assert(declaringType != null);
this._arglessStub = arglessStub;
// allocate an index, only for preserved descs
if (needsIndex) // assign an index only if needed (save indexes, since they cause prealocation of larger BitArray)
this.Index = System.Threading.Interlocked.Increment(ref LastIndex);
}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:18,代码来源:MethodDescs.cs
示例8: LinqContext
// variables may be null when the code is global
protected LinqContext(DObject outerType, Dictionary<string, object> variables, ScriptContext/*!*/ context, DTypeDesc typeHandle)
{
if (context == null)
throw new ArgumentNullException("context");
this.variables = variables;
this.outerType = outerType;
this.context = context;
this.typeHandle = typeHandle;
}
开发者ID:tiaohai,项目名称:Phalanger,代码行数:12,代码来源:LinqHelper.cs
示例9: Create
/// <summary>
/// Creates appropriate binder according to paramaters specified
/// </summary>
/// <param name="methodName">Name of the method known during binder creation.</param>
/// <param name="genericParamsCount">Number of generic type arguments of the method</param>
/// <param name="paramsCount">Number of arguments of the method</param>
/// <param name="callerClassContext">TypeDesc of the class that is calling this method</param>
/// <param name="returnType">Type which is expected from the call site to return</param>
/// <returns>Return appropriate binder derived from PhpInvokeMemberBinder</returns>
public static PhpInvokeMemberBinder Create(string methodName, int genericParamsCount, int paramsCount, DTypeDesc callerClassContext, Type returnType)
{
if (methodName == null)
{
return new PhpIndirectInvokeMemberBinder(genericParamsCount, paramsCount, callerClassContext, returnType);
}
else
{
return new PhpInvokeMemberBinder(methodName, genericParamsCount, paramsCount, callerClassContext, returnType);
}
}
开发者ID:hansdude,项目名称:Phalanger,代码行数:21,代码来源:PhpInvokeMemberBinder.cs
示例10: CallUserFunction
public static object CallUserFunction(DTypeDesc caller, PhpCallback function, params object[] args)
{
if (function == null)
{
PhpException.ArgumentNull("function");
return null;
}
if (function.IsInvalid) return null;
// invoke the callback:
return PhpVariable.Dereference(function.Invoke(caller, args));
}
开发者ID:kripper,项目名称:Phalanger,代码行数:12,代码来源:Functions.cs
示例11: notsetOperation
static PhpReference notsetOperation(DObject self, string name, DTypeDesc caller, PhpReference refrnc)
{
bool getter_exists;
// the CT property has been unset -> try to invoke __get
PhpReference get_ref = self.InvokeGetterRef(name, caller, out getter_exists);
if (getter_exists) return get_ref ?? new PhpReference();
Debug.Assert(refrnc != null);
refrnc.IsAliased = true;
refrnc.IsSet = true;
return refrnc;
}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:14,代码来源:PhpGetMemberBinder.cs
示例12: CallUserFunctionArray
public static object CallUserFunctionArray(DTypeDesc caller, PhpCallback function, PhpArray args)
{
object[] args_array;
if (args != null)
{
args_array = new object[args.Count];
args.CopyValuesTo(args_array, 0);
}
else
{
args_array = ArrayUtils.EmptyObjects;
}
return CallUserFunction(caller, function, args_array);
}
开发者ID:kripper,项目名称:Phalanger,代码行数:16,代码来源:Functions.cs
示例13: BindOrBiteMyLegsOff
public void BindOrBiteMyLegsOff(DTypeDesc caller, NamingContext namingContext)
{
if (Callback != null)
{
if (Callback.TargetInstance == null && Parser._handlerObject != null)
_currentCallback = new PhpCallback(Parser._handlerObject, Callback.RoutineName);
else
_currentCallback = Callback;
Bound = _currentCallback.Bind(true, caller, namingContext);
}
else
{
Bound = false;
}
}
开发者ID:toburger,项目名称:Phalanger,代码行数:16,代码来源:XmlParserResource.cs
示例14: PhpInvokeBinderKey
public static CallSiteBinder/*!*/MethodCall(string methodName, int genericParamsCount, int paramsCount, DTypeDesc classContext, Type/*!*/returnType)
{
// CallSite< Func< CallSite, object /*target instance*/, ScriptContext, {args}*/*method call arguments*/, (DTypeDesc)?/*class context, iff <classContext>.IsUnknown*/, (object)?/*method name, iff <methodName>==null*/, <returnType> > >
PhpInvokeBinderKey key = new PhpInvokeBinderKey(methodName, genericParamsCount, paramsCount, classContext, returnType);
lock (invokeMemberBinders)
{
PhpInvokeMemberBinder res;
if (!invokeMemberBinders.TryGetValue(key.ToString(), out res))
{
invokeMemberBinders[key.ToString()] = res = PhpBaseInvokeMemberBinder.Create(methodName, genericParamsCount, paramsCount, classContext, returnType);
}
return res;
}
}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:18,代码来源:Binder.cs
示例15: 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
示例16: CallUserMethodInternal
/// <summary>
/// Calls the method referred by <paramref name="methodName"/> from the user defined
/// object <paramref name="classNameOrObject"/> with parameters <paramref name="args"/>.
/// </summary>
/// <param name="caller">DTypeDesc of the caller's class context. Can be UnknownTypeDesc.</param>
/// <param name="methodName">The name of the method.</param>
/// <param name="classNameOrObject">An instance to invoke the method on or a class name.</param>
/// <param name="args">Parameters to invoke the method with.</param>
/// <returns>The method's return value (always dereferenced).</returns>
internal static object CallUserMethodInternal(DTypeDesc caller, string methodName, object classNameOrObject, ICollection args)
{
PhpException.Throw(PhpError.Notice, LibResources.GetString("call_user_method_deprecated"));
object ret_val = false;
DObject obj;
string class_name;
ScriptContext context = ScriptContext.CurrentContext;
//DTypeDesc classContext = PhpStackTrace.GetClassContext(); // TODO: GetClassContext only if needed by context.ResolveType
if (caller != null && caller.IsUnknown) caller = PhpStackTrace.GetClassContext();
if ((obj = classNameOrObject as DObject) != null)
{
// push arguments on stack
context.Stack.AddFrame(args);
ret_val = obj.InvokeMethod(methodName, caller, context);
}
else if ((class_name = PhpVariable.AsString(classNameOrObject)) != null)
{
// push arguments on stack
context.Stack.AddFrame(args);
ResolveTypeFlags flags = ResolveTypeFlags.UseAutoload | ResolveTypeFlags.ThrowErrors;
DTypeDesc type = PHP.Core.Convert.ObjectToTypeDesc(class_name, flags, caller, context, null, null);
ret_val = Operators.InvokeStaticMethod(type, methodName, null, caller, context);
}
else
{
PhpException.InvalidArgument("classNameOrObject", LibResources.GetString("arg:not_object_or_class_name"));
}
return PhpVariable.Dereference(ret_val);
}
开发者ID:kripper,项目名称:Phalanger,代码行数:45,代码来源:Objects.cs
示例17: ReflectionException
public ReflectionException(ScriptContext context, DTypeDesc caller)
: base(context, caller)
{
}
开发者ID:tiaohai,项目名称:Phalanger,代码行数:4,代码来源:Reflection.cs
示例18: RecursiveDirectoryIterator
public RecursiveDirectoryIterator(ScriptContext/*!*/context, DTypeDesc caller)
: base(context, caller)
{
}
开发者ID:MpApQ,项目名称:Phalanger,代码行数:4,代码来源:FileSystem.cs
示例19: FilesystemIterator
public FilesystemIterator(ScriptContext/*!*/context, DTypeDesc caller)
: base(context, caller)
{
}
开发者ID:MpApQ,项目名称:Phalanger,代码行数:4,代码来源:FileSystem.cs
示例20: SplFileInfo
public SplFileInfo(ScriptContext/*!*/context, DTypeDesc caller)
: base(context, caller)
{
}
开发者ID:MpApQ,项目名称:Phalanger,代码行数:4,代码来源:FileSystem.cs
注:本文中的DTypeDesc类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论