public override object[] Call(params object[] args) { Types types = new Types(); if (args != null) { for (int i = 0; i < args.Length; ++i) { var type = args[i].UnwrapDynamic() as Type; if (type == null) { return(null); } types.Add(type); } } var core = _Core.BindTypes(types) as IClrTypeCore; if (core != null) { var rv = ObjectPool.GetReturnValueFromPool(1); rv[0] = ClrTypeWrapper.GetFromPool(core); return(rv); } return(null); }
public object[] Call(object target, params object[] args) { if (args == null || args.Length <= 0) { if (GLog.IsLogInfoEnabled) { GLog.LogInfo("Unable to determine types of the generic type from the calling args - empty args."); } } else { Types types = new Types(); bool allTypes = true; foreach (var arg in args) { if (!(arg is Type)) { allTypes = false; break; } } if (allTypes) { for (int i = 0; i < args.Length; ++i) { types.Add(args[i] as Type); } var core = BindTypes(types) as IClrTypeCore; if (core != null) { var rv = ObjectPool.GetReturnValueFromPool(1); rv[0] = ClrTypeWrapper.GetFromPool(core); return(rv); } } // try to determine generic type params. var cored = this.DetermineGenericTypeArg(args); if (cored != null) { return(cored.Call(target, args)); } else { if (GLog.IsLogInfoEnabled) { GLog.LogInfo("Unable to determine types of the generic type from the calling args."); } } } return(null); }
public object[] Call(object target, params object[] args) { if (_GenericCore != null && args != null) { Types types = new Types(); bool allTypes = true; foreach (var arg in args) { if (!(arg is Type)) { allTypes = false; break; } } if (allTypes) { for (int i = 0; i < args.Length; ++i) { types.Add(args[i] as Type); } var core = BindTypes(types) as IClrTypeCore; if (core != null) { var rv = ObjectPool.GetReturnValueFromPool(1); rv[0] = ClrTypeWrapper.GetFromPool(core); return(rv); } } } if (_NormalCore != null) { var rv = _NormalCore.Call(target, args); if (rv != null) { return(rv); } } if (_GenericCore != null) { return(_GenericCore.Call(target, args)); } return(null); }
public static ClrTypeWrapper GetTypeWrapper(Type ntype, Type[] gtypes) { var core = new ClrTypeCoreWithGeneric(ntype, gtypes); if (core != null) { if (core._NormalCore != null && core._GenericCore != null) { return(ClrTypeWrapper.GetFromPool(core)); } else if (core._NormalCore != null) { return(ClrTypeWrapper.GetFromPool(core._NormalCore)); } else if (core._GenericCore != null) { return(ClrTypeWrapper.GetFromPool(core._GenericCore)); } } return(null); }
public override object[] Call(params object[] args) { Types types = new Types(); bool allTypes = true; if (args != null) { for (int i = 0; i < args.Length; ++i) { var type = args[i].UnwrapDynamic() as Type; if (type == null) { allTypes = false; break; } types.Add(type); } } if (allTypes) { var core = _Core.BindTypes(types) as IClrTypeCore; if (core != null) { var rv = ObjectPool.GetReturnValueFromPool(1); rv[0] = ClrTypeWrapper.GetFromPool(core); return(rv); } } if (_Core._NormalCore != null) { return(_Core._NormalCore.CreateOverloadSelector(Target).Call(args)); } else { return(null); } }