/// <summary> /// Add empty argless stub just to allow initialization without dynamic wrappers. /// </summary> /// <param name="functions"></param> /// <param name="functionName"></param> /// <returns></returns> private DRoutineDesc /*!*/ AddEmptyArglessStub(Dictionary <string, DRoutineDesc> /*!*/ functions, string functionName) { var desc = new PhpLibraryFunctionDesc(this, (instance, stack) => { throw new NotImplementedException("empty argless!"); }); functions.Add(functionName, desc); return(desc); }
/// <summary> /// Add the argless stub <c>method</c> into the list of functions. /// </summary> /// <param name="functions">Dictionary of functions to insert the stub into.</param> /// <param name="method">The method of the stub.</param> /// <param name="functionName">The PHP name representing the function.</param> private DRoutineDesc AddArglessStub(Dictionary <string, DRoutineDesc> /*!*/ functions, MethodInfo /*!*/ method, string /*!*/ functionName) { RoutineDelegate argless_stub; try { argless_stub = (RoutineDelegate)Delegate.CreateDelegate(typeof(RoutineDelegate), method, true); } catch (Exception) { throw new ReflectionException(CoreResources.GetString("invalid_dynamic_wrapper_format", dynamicWrapper.CodeBase)); } DRoutineDesc desc; try { desc = new PhpLibraryFunctionDesc(this, argless_stub); functions.Add(functionName, desc); return(desc); } catch (ArgumentNullException) { throw new ArgumentNullException("Function with <null> name passed."); } catch (ArgumentException) { throw new ArgumentException("Function '" + method.Name + "' reflected before."); } }
/// <summary> /// Add empty argless stub just to allow initialization without dynamic wrappers. /// </summary> /// <param name="functions"></param> /// <param name="functionName"></param> /// <returns></returns> private DRoutineDesc/*!*/AddEmptyArglessStub(Dictionary<string, DRoutineDesc>/*!*/functions, string functionName) { var desc = new PhpLibraryFunctionDesc(this, (instance, stack) => { throw new NotImplementedException("empty argless!"); }); functions.Add(functionName, desc); return desc; }
/// <summary> /// Add the argless stub <c>method</c> into the list of functions. /// </summary> /// <param name="functions">Dictionary of functions to insert the stub into.</param> /// <param name="method">The method of the stub.</param> /// <param name="functionName">The PHP name representing the function.</param> private DRoutineDesc AddArglessStub(Dictionary<string, DRoutineDesc>/*!*/functions, MethodInfo/*!*/method, string/*!*/functionName) { RoutineDelegate argless_stub; try { argless_stub = (RoutineDelegate)Delegate.CreateDelegate(typeof(RoutineDelegate), method, true); } catch (Exception) { throw new ReflectionException(CoreResources.GetString("invalid_dynamic_wrapper_format", dynamicWrapper.CodeBase)); } DRoutineDesc desc; try { desc = new PhpLibraryFunctionDesc(this, argless_stub); functions.Add(functionName, desc); return desc; } catch (ArgumentNullException) { throw new ArgumentNullException("Function with <null> name passed."); } catch (ArgumentException) { throw new ArgumentException("Function '" + method.Name + "' reflected before."); } }
/// <summary> /// Used by full-reflect. /// </summary> public PhpLibraryFunction(PhpLibraryFunctionDesc/*!*/ functionDesc, Name name, FunctionImplOptions options, int estimatedOverloadCount) : base(functionDesc) { this.name = name; this.options = options; this.overloads = new List<Overload>(estimatedOverloadCount); }