コード例 #1
0
        protected override Expression CreateExpressionTree(ResolveContext ec, TypeSpec delegate_type)
        {
            if (ec.IsInProbingMode)
            {
                return(this);
            }

            BlockContext bc = new BlockContext(ec.MemberContext, ec.ConstructorBlock, ec.BuiltinTypes.Void)
            {
                CurrentAnonymousMethod = ec.CurrentAnonymousMethod
            };

            Expression args = Parameters.CreateExpressionTree(bc, loc);
            Expression expr = Block.CreateExpressionTree(ec);

            if (expr == null)
            {
                return(null);
            }

            Arguments arguments = new Arguments(2);

            arguments.Add(new Argument(expr));
            arguments.Add(new Argument(args));
            return(CreateExpressionFactoryCall(ec, "Lambda",
                                               new TypeArguments(new TypeExpression(delegate_type, loc)),
                                               arguments));
        }
コード例 #2
0
        protected override Expression CreateExpressionTree(EmitContext ec, Type delegate_type)
        {
            if (ec.IsInProbingMode)
            {
                return(this);
            }

            Expression args = Parameters.CreateExpressionTree(ec, loc);
            Expression expr = Block.CreateExpressionTree(ec);

            if (expr == null)
            {
                return(null);
            }

            ArrayList arguments = new ArrayList(2);

            arguments.Add(new Argument(expr));
            arguments.Add(new Argument(args));
            return(CreateExpressionFactoryCall("Lambda",
                                               new TypeArguments(new TypeExpression(delegate_type, loc)),
                                               arguments));
        }
コード例 #3
0
        protected override Expression CreateExpressionTree(ResolveContext ec, Type delegate_type)
        {
            if (ec.IsInProbingMode)
            {
                return(this);
            }

            BlockContext bc   = new BlockContext(ec.MemberContext, ec.CurrentBlock.Explicit, TypeManager.void_type);
            Expression   args = Parameters.CreateExpressionTree(bc, loc);
            Expression   expr = Block.CreateExpressionTree(ec);

            if (expr == null)
            {
                return(null);
            }

            Arguments arguments = new Arguments(2);

            arguments.Add(new Argument(expr));
            arguments.Add(new Argument(args));
            return(CreateExpressionFactoryCall(ec, "Lambda",
                                               new TypeArguments(new TypeExpression(delegate_type, loc)),
                                               arguments));
        }