Beispiel #1
0
        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);
        }
Beispiel #2
0
 public BuiltInCallableTargetInfo(MethodTable target) : base(target.Name, BindingTargetType.BuiltInObject)
 {
     BindingInstance = new ConstantBinding(target, this);
 }