本文整理汇总了C#中DTypeDesc类的典型用法代码示例。如果您正苦于以下问题:C# DTypeDesc类的具体用法?C# DTypeDesc怎么用?C# DTypeDesc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DTypeDesc类属于命名空间,在下文中一共展示了DTypeDesc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例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;
}
}
示例3: PhpGetMemberBinder
public PhpGetMemberBinder(string fieldName, DTypeDesc classContext, bool issetSemantics, Type/*!*/returnType)
{
this._fieldName = fieldName;
this._classContext = classContext;
this._issetSemantics = issetSemantics;
this._returnType = returnType;
}
示例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);
}
示例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);
}
示例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");
}
示例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);
}
示例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;
}
示例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);
}
}
示例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));
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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();
}