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