예제 #1
0
        protected internal override void TraverseEval(Eval eval)
        {
            var m = eval.InvokedMethod();

            eval.InvocationArgs().ForEach(Traverse);

            var lam = eval.InvokedLambda();

            if (lam.InvokedAsCtor)
            {
                il.newobj(m);
            }
            else if (lam.InvokedAsVirtual)
            {
                il.callvirt(m);
            }
            else
            {
                il.call(m);
            }

            var rets_smth     = lam.Sig.Ret != typeof(void);
            var ret_aint_used = !(Stack.SecondOrDefault() is Expression);

            if (rets_smth && ret_aint_used)
            {
                il.pop();
            }
        }
예제 #2
0
파일: Codebase.cs 프로젝트: xeno-by/conflux
        public Eval Redirect(Eval eval)
        {
            var m = eval.InvokedMethod();
            var a = eval.InvocationArgs().ToReadOnly();

            var redirectors = _redirects.Select(kvp => kvp.Key(m) ? kvp.Value : null).Where(f => f != null);
            var f_mredir = redirectors.AssertSingle().Item1;
            var m_redir = f_mredir(m, a);
            var f_aredir = redirectors.AssertSingle().Item2;
            var a_redir = f_aredir(m, a);

            if (m_redir == null || a_redir == null) return null;
            // todo. this doesn't preserve virtuality of the call!
            return new Eval(new Apply(new Lambda(m_redir), a_redir));
        }
예제 #3
0
        public Eval Redirect(Eval eval)
        {
            var m = eval.InvokedMethod();
            var a = eval.InvocationArgs().ToReadOnly();

            var redirectors = _redirects.Select(kvp => kvp.Key(m) ? kvp.Value : null).Where(f => f != null);
            var f_mredir    = redirectors.AssertSingle().Item1;
            var m_redir     = f_mredir(m, a);
            var f_aredir    = redirectors.AssertSingle().Item2;
            var a_redir     = f_aredir(m, a);

            if (m_redir == null || a_redir == null)
            {
                return(null);
            }
            // todo. this doesn't preserve virtuality of the call!
            return(new Eval(new Apply(new Lambda(m_redir), a_redir)));
        }
예제 #4
0
        protected  override void TraverseEval(Eval eval)
        {
            var m = eval.InvokedMethod();
            eval.InvocationArgs().ForEach(Traverse);

            var lam = eval.InvokedLambda();
            if (lam.InvokedAsCtor) il.newobj(m);
            else if (lam.InvokedAsVirtual) il.callvirt(m);
            else il.call(m);

            var rets_smth = lam.Sig.Ret != typeof(void);
            var ret_aint_used = !(Stack.SecondOrDefault() is Expression);
            if (rets_smth && ret_aint_used) il.pop();
        }