private Expression GenBinary(BinaryExpr elem) { Contract.Requires <ArgumentNullException>(elem != null); Contract.Ensures(Contract.Result <Expression>() != null); var left = GenElem(elem.Left); var right = GenElem(elem.Right); var binder = SearchBinder(elem.ExprType); if (binder != null) { return(Expression.Dynamic(binder, typeof(object), left, right)); } switch (elem.ExprType) { case BinaryOperationType.Cons: return(Cons(left, right)); case BinaryOperationType.Concat: { return(ExpressionHelper.BetaReduction <object, object, object>( (arg0, arg1) => String.Concat(arg0, arg1), left, right)); } } throw Error("未定義の演算が現れました。", elem.Range.Start); }
private Expression GenBinary(BinaryExpr elem) { Contract.Requires<ArgumentNullException>(elem != null); Contract.Ensures(Contract.Result<Expression>() != null); var left = GenElem(elem.Left); var right = GenElem(elem.Right); var binder = SearchBinder(elem.ExprType); if (binder != null) { return Expression.Dynamic(binder, typeof(object), left, right); } switch (elem.ExprType) { case BinaryOperationType.Cons: return Cons(left, right); case BinaryOperationType.Concat: { return ExpressionHelper.BetaReduction<object, object, object>( (arg0, arg1) => String.Concat(arg0, arg1), left, right); } } throw Error("未定義の演算が現れました。", elem.Range.Start); }