@@ -145,32 +145,15 @@ Expression DoVisitConditional(Expression test, Expression ifTrue, Expression ifF
145145
146146 protected override Expression VisitUnary ( UnaryExpression node )
147147 {
148- switch ( node . NodeType )
148+ return DoVisitUnary ( Visit ( node . Operand ) ) ;
149+
150+ Expression DoVisitUnary ( Expression updated )
149151 {
150- case ExpressionType . Convert :
151- case ExpressionType . ConvertChecked :
152- switch ( node . Operand . NodeType )
153- {
154- case ExpressionType . Constant :
155- return ProcessConstant ( ( ConstantExpression ) node . Operand ) ;
156- default :
157- return base . VisitUnary ( node ) ;
158- }
159- case ExpressionType . Lambda :
160- var lambdaExpression = ( LambdaExpression ) node . Operand ;
161- var ex = this . Visit ( lambdaExpression . Body ) ;
162-
163- var mapped = Expression . Quote ( Expression . Lambda ( ex , lambdaExpression . GetDestinationParameterExpressions ( this . InfoDictionary , this . TypeMappings ) ) ) ;
164- this . TypeMappings . AddTypeMapping ( ConfigurationProvider , node . Type , mapped . Type ) ;
165- return mapped ;
166- default :
167- return base . VisitUnary ( node ) ;
168- }
152+ if ( updated != node . Operand )
153+ return node . Update ( updated ) ;
169154
170- Expression ProcessConstant ( ConstantExpression operand )
171- => this . TypeMappings . TryGetValue ( operand . Type , out Type newType )
172- ? Expression . Constant ( Mapper . Map ( operand . Value , node . Type , newType ) , newType )
173- : base . VisitUnary ( node ) ;
155+ return node ;
156+ }
174157 }
175158
176159 protected override Expression VisitConstant ( ConstantExpression node )
0 commit comments