Пример #1
0
        public override Expression Compile()
        {
            var        scope     = new ModuleScope(Compiler);
            var        moduleVar = scope.Module as ParameterExpression;
            Expression header    = Assign(moduleVar, GetModule());

            header = CallFrame.Expressions.Push(null, header);

            Compiler.StartScope(scope);

            try
            {
                var body = Body.Accept(Compiler);
                body = Expression.TryFinally(body, CallFrame.Expressions.Pop());

                return(scope.CompileBody(Expression.Block(header, body)));
            }
            finally
            {
                Compiler.EndScope();
            }
        }