예제 #1
0
 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; 
 }
예제 #2
0
 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(','); 
 }
예제 #3
0
        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);
        }
예제 #4
0
 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(',');
     }
 }
예제 #5
0
 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(',');
     }
 }
예제 #6
0
파일: Runtime.cs 프로젝트: hstde/Calc2
        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);
        }
예제 #7
0
 /// <summary>
 /// Initializes an instance with a built in method.
 /// </summary>
 public SFunction(BuiltInMethod method)
     : this((Delegate)method)
 {
 }
예제 #8
0
        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))
        {
        }
예제 #9
0
    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)) {
    }
예제 #10
0
 /// <summary>
 /// Initializes an instance with a built in method.
 /// </summary>
 public SFunction(BuiltInMethod method)
     : this((Delegate)method)
 { }