public static BindingTargetInfo AddMethod(this BindingSourceTable targets, BuiltInMethod method, string methodName, int minParamCount = 0, int maxParamCount = 0, string parameterNames = null) { var callTarget = new BuiltInCallTarget(method, methodName, minParamCount, maxParamCount, parameterNames); var targetInfo = new BuiltInCallableTargetInfo(callTarget); targets.Add(methodName, targetInfo); return targetInfo; }
public string[] ParameterNames; //Just for information purpose public BuiltInCallTarget(BuiltInMethod method, string name, int minParamCount = 0, int maxParamCount = 0, string parameterNames = null) { Method = method; Name = name; MinParamCount = minParamCount; MaxParamCount = Math.Max(MinParamCount, maxParamCount); if (!string.IsNullOrEmpty(parameterNames)) ParameterNames = parameterNames.Split(','); }
public static BindingTargetInfo AddMethod(this BindingSourceTable targets, BuiltInMethod method, string methodName, int minParamCount = 0, int maxParamCount = 0, string parameterNames = null) { var callTarget = new BuiltInCallTarget(method, methodName, minParamCount, maxParamCount, parameterNames); var targetInfo = new BuiltInCallableTargetInfo(callTarget); targets.Add(methodName, targetInfo); return(targetInfo); }
public BuiltInCallTarget(BuiltInMethod method, string name, int minParamCount = 0, int maxParamCount = 0, string parameterNames = null) { Method = method; Name = name; MinParamCount = minParamCount; MaxParamCount = Math.Max(MinParamCount, maxParamCount); if (!string.IsNullOrEmpty(parameterNames)) { ParameterNames = parameterNames.Split(','); } }
public BuiltInCallTarget(BuiltInMethod method, string name, int paramCount, TypeInfo[] types = null, string paramNames = null) { Method = method; Name = name; ParamCount = paramCount; ParamTypes = types; if (!string.IsNullOrEmpty(paramNames)) { ParamNames = paramNames.Split(','); } }
public BindingTargetInfo AddMethod(BuiltInMethod method, string methodName, int paramCount = -1, TypeInfo[] types = null, string paramNames = null) { var callTarget = new BuiltInCallTarget(method, methodName, paramCount, types, paramNames); BuiltInCallableTargetInfo targetInfo = null; IBindingSource source; if (this.TryGetValue(methodName, out source)) { targetInfo = source as BuiltInCallableTargetInfo; var mTable = (targetInfo.BindingInstance as ConstantBinding).Target as MethodTable; mTable.Add(callTarget); } else { var mTable = new MethodTable(methodName); mTable.Add(callTarget); targetInfo = new BuiltInCallableTargetInfo(mTable); this[methodName] = targetInfo; } return(targetInfo); }
/// <summary> /// Initializes an instance with a built in method. /// </summary> public SFunction(BuiltInMethod method) : this((Delegate)method) { }
public Binding BindingInstance; //A singleton binding instance; we share it for all AST nodes (function call nodes) that call the method. public BuiltInCallableTargetInfo(BuiltInMethod method, string methodName, int minParamCount = 0, int maxParamCount = 0, string parameterNames = null) : this(new BuiltInCallTarget(method, methodName, minParamCount, maxParamCount, parameterNames)) { }