コード例 #1
0
        private Expression CallStatic(DynamicExpression node)
        {
            var binder = node.Binder as InvokeBinder;

            if (binder == null)
            {
                return(null);
            }
            var target = node.Arguments[0] as ParameterExpression;

            if (target == null)
            {
                return(null);
            }
            SuffixFuncInfo info;

            if (_dic.TryGetValue(target, out info) == false)
            {
                return(null);
            }
            var expr = SuffixFunc.SortAndInvoke(info.FuncExpr, info.Suffix, binder.CallInfo, i => node.Arguments[i + 1]);

            if (expr is InvocationExpression)
            {
                info.IsUsed = true;
            }
            return(expr);
        }
コード例 #2
0
ファイル: InteropEngine.cs プロジェクト: hiromi-mi/kurogane
        private void SetMessageBox()
        {
            Func <object, object> ShowMsg = delegate(object o) {
                var txt = o.ToString();
                MessageBox.Show(txt);
                return(o);
            };

            Global.SetVariable("表示", SuffixFunc.Create <Func <object, object> >(ShowMsg, "を"));
        }
コード例 #3
0
ファイル: InteropEngine.cs プロジェクト: hiromi-mi/kurogane
        private void SetConstractor()
        {
            Func <object, object> create = type => {
                if ((type is Type) == false)
                {
                    return(null);
                }
                var cInfo = ((Type)type).GetConstructor(new Type[0]);
                if (cInfo == null)
                {
                    return(null);
                }
                return(cInfo.Invoke(new object[0]));
            };

            Global.SetVariable("作成", SuffixFunc.Create(create, "を"));
        }