Code Review: AstImprovements

tfpt review “/shelveset:AstImprovements;REDMOND\tomat”
Comment :
Adds ExpressionCollectionBuilder (moves the implementation from
IronRuby). This allows to construct optimized expressions via C#
initializer syntax. Adds a subclass BlockBuilder that can be used to
build blocks like so:

Expression result = new BlockBuilder {

(condition) ? foo : null,

If the expression used in the initializer is null it is skipped.
If the expression is a sequence of expressions
(IEnumerable) its content is included in the block.
BlockBuilder defines an implicit conversion to Expression.


Tree transformation refactorings:

  • Replaces some AstFactory utility methods with AstUtils equivalents.
  • Creates Lambda explicitly to avoid calls to MakeGenericType.
  • Uses BlockBuilder for building complex blocks.