Ejemplo n.º 1
0
 // ===== ===== ===== ===== ===== method ===== ===== ===== ===== =====
 public LambdaExpression Generate(Lambda lambda)
 {
     Contract.Requires<ArgumentNullException>(lambda != null);
     Contract.Ensures(Contract.Result<LambdaExpression>() != null);
     var expr = GenElem(lambda.Element);
     var tmp = Expression.Parameter(expr.Type);
     var body = Expression.Block(
         new[] { tmp },
         StmtGen.DebugInfo(lambda.Range),
         Expression.Assign(tmp, expr),
         StmtGen.ClearInfo(),
         tmp);
     return Expression.Lambda(body, ParamList.ToEnum(_params).Reverse());
 }
Ejemplo n.º 2
0
 private LambdaExpression GenLambda(Lambda elem)
 {
     Contract.Requires<ArgumentNullException>(elem != null);
     Contract.Ensures(Contract.Result<Expression>() != null);
     return new LambdaGen(this.StmtGen).Generate(elem);
 }